annotate lib/lua/lua-5.2.2/lctype.h @ 2553:48708da03b7f

Party Creation UI logic separated from MainMenu
author a.parshin
date Wed, 13 May 2015 02:20:05 +0200
parents 41cc4dd3c122
children
rev   line source
1866
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
1 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
2 ** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
3 ** 'ctype' functions for Lua
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
4 ** See Copyright Notice in lua.h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
5 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
7 #ifndef lctype_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
8 #define lctype_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
9
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
10 #include "lua.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
11
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
12
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
13 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
14 ** WARNING: the functions defined here do not necessarily correspond
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
15 ** to the similar functions in the standard C ctype.h. They are
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
16 ** optimized for the specific needs of Lua
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
17 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
18
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
19 #if !defined(LUA_USE_CTYPE)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
20
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
21 #if 'A' == 65 && '0' == 48
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
22 /* ASCII case: can use its own tables; faster and fixed */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
23 #define LUA_USE_CTYPE 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
24 #else
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
25 /* must use standard C ctype */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
26 #define LUA_USE_CTYPE 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
27 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
28
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
29 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
30
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
31
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
32 #if !LUA_USE_CTYPE /* { */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
33
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
34 #include <limits.h>
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
35
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
36 #include "llimits.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
37
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
38
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
39 #define ALPHABIT 0
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
40 #define DIGITBIT 1
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
41 #define PRINTBIT 2
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
42 #define SPACEBIT 3
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
43 #define XDIGITBIT 4
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
44
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
45
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
46 #define MASK(B) (1 << (B))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
47
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
48
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
49 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
50 ** add 1 to char to allow index -1 (EOZ)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
51 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
52 #define testprop(c,p) (luai_ctype_[(c)+1] & (p))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
53
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
54 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
55 ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_'
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
56 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
57 #define lislalpha(c) testprop(c, MASK(ALPHABIT))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
58 #define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT)))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
59 #define lisdigit(c) testprop(c, MASK(DIGITBIT))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
60 #define lisspace(c) testprop(c, MASK(SPACEBIT))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
61 #define lisprint(c) testprop(c, MASK(PRINTBIT))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
62 #define lisxdigit(c) testprop(c, MASK(XDIGITBIT))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
63
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
64 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
65 ** this 'ltolower' only works for alphabetic characters
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
66 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
67 #define ltolower(c) ((c) | ('A' ^ 'a'))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
68
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
69
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
70 /* two more entries for 0 and -1 (EOZ) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
71 LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2];
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
72
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
73
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
74 #else /* }{ */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
75
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
76 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
77 ** use standard C ctypes
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
78 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
79
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
80 #include <ctype.h>
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
81
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
82
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
83 #define lislalpha(c) (isalpha(c) || (c) == '_')
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
84 #define lislalnum(c) (isalnum(c) || (c) == '_')
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
85 #define lisdigit(c) (isdigit(c))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
86 #define lisspace(c) (isspace(c))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
87 #define lisprint(c) (isprint(c))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
88 #define lisxdigit(c) (isxdigit(c))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
89
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
90 #define ltolower(c) (tolower(c))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
91
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
92 #endif /* } */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
93
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
94 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
95