lctype.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. ** $Id: lctype.c $
  3. ** 'ctype' functions for Lua
  4. ** See Copyright Notice in lua.h
  5. */
  6. #define lctype_c
  7. #define LUA_CORE
  8. #include "lprefix.h"
  9. #include "lctype.h"
  10. #if !LUA_USE_CTYPE /* { */
  11. #include <limits.h>
  12. #if defined (LUA_UCID) /* accept UniCode IDentifiers? */
  13. /* consider all non-ascii codepoints to be alphabetic */
  14. #define NONA 0x01
  15. #else
  16. #define NONA 0x00 /* default */
  17. #endif
  18. LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = {
  19. 0x00, /* EOZ */
  20. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */
  21. 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
  22. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */
  23. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  24. 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */
  25. 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
  26. 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */
  27. 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
  28. 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */
  29. 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
  30. 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */
  31. 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05,
  32. 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */
  33. 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
  34. 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */
  35. 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00,
  36. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 8. */
  37. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
  38. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 9. */
  39. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
  40. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* a. */
  41. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
  42. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* b. */
  43. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
  44. 0x00, 0x00, NONA, NONA, NONA, NONA, NONA, NONA, /* c. */
  45. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
  46. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* d. */
  47. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
  48. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* e. */
  49. NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
  50. NONA, NONA, NONA, NONA, NONA, 0x00, 0x00, 0x00, /* f. */
  51. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  52. };
  53. #endif /* } */