aboutsummaryrefslogtreecommitdiff
path: root/lctype.h
blob: 21ef8fd1b81bbc8bdf38437e3b579cf5af2327d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
** $Id: $
** 'ctype' functions for Lua
** See Copyright Notice in lua.h
*/

#ifndef lctype_h
#define lctype_h


#include <limits.h>

#include "lua.h"


#define ALPHABIT	0
#define DIGITBIT	1
#define PRINTBIT	2
#define SPACEBIT	3


#define MASK(B)		(1 << (B))


#define lisalpha(x)	(lctypecode[x] & MASK(ALPHABIT))
#define lisalnum(x)	(lctypecode[x] & (MASK(ALPHABIT) | MASK(DIGITBIT)))
#define lisdigit(x)	(lctypecode[x] & MASK(DIGITBIT))
#define lisspace(x)	(lctypecode[x] & MASK(SPACEBIT))
#define lisprint(x)	(lctypecode[x] & MASK(PRINTBIT))

LUAI_DATA const char lctypecode[UCHAR_MAX + 1];

#endif