From ada82930fd9f81b7da96ea11faec9f5b79df3bca Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 19 Feb 2009 14:18:25 -0300 Subject: "homemade" version of ctype.h --- lctype.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lctype.h (limited to 'lctype.h') diff --git a/lctype.h b/lctype.h new file mode 100644 index 00000000..21ef8fd1 --- /dev/null +++ b/lctype.h @@ -0,0 +1,34 @@ +/* +** $Id: $ +** 'ctype' functions for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lctype_h +#define lctype_h + + +#include + +#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 + -- cgit v1.2.3-55-g6feb