ctype.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice, this
  9. * list of conditions and the following disclaimer.
  10. *
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  19. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  21. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  22. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  23. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #include <ctype.h>
  27. extern "C" {
  28. const char _ctype_[256] = {
  29. _C, _C, _C, _C, _C, _C, _C, _C,
  30. _C, _C | _S, _C | _S, _C | _S, _C | _S, _C | _S, _C, _C,
  31. _C, _C, _C, _C, _C, _C, _C, _C,
  32. _C, _C, _C, _C, _C, _C, _C, _C,
  33. (char)(_S | _B), _P, _P, _P, _P, _P, _P, _P,
  34. _P, _P, _P, _P, _P, _P, _P, _P,
  35. _N, _N, _N, _N, _N, _N, _N, _N,
  36. _N, _N, _P, _P, _P, _P, _P, _P,
  37. _P, _U | _X, _U | _X, _U | _X, _U | _X, _U | _X, _U | _X, _U,
  38. _U, _U, _U, _U, _U, _U, _U, _U,
  39. _U, _U, _U, _U, _U, _U, _U, _U,
  40. _U, _U, _U, _P, _P, _P, _P, _P,
  41. _P, _L | _X, _L | _X, _L | _X, _L | _X, _L | _X, _L | _X, _L,
  42. _L, _L, _L, _L, _L, _L, _L, _L,
  43. _L, _L, _L, _L, _L, _L, _L, _L,
  44. _L, _L, _L, _P, _P, _P, _P, _C
  45. };
  46. #undef isalnum
  47. int isalnum(int c)
  48. {
  49. return __inline_isalnum(c);
  50. }
  51. #undef isalpha
  52. int isalpha(int c)
  53. {
  54. return __inline_isalpha(c);
  55. }
  56. #undef iscntrl
  57. int iscntrl(int c)
  58. {
  59. return __inline_iscntrl(c);
  60. }
  61. #undef isdigit
  62. int isdigit(int c)
  63. {
  64. return __inline_isdigit(c);
  65. }
  66. #undef isxdigit
  67. int isxdigit(int c)
  68. {
  69. return __inline_isxdigit(c);
  70. }
  71. #undef isspace
  72. int isspace(int c)
  73. {
  74. return __inline_isspace(c);
  75. }
  76. #undef ispunct
  77. int ispunct(int c)
  78. {
  79. return __inline_ispunct(c);
  80. }
  81. #undef isprint
  82. int isprint(int c)
  83. {
  84. return __inline_isprint(c);
  85. }
  86. #undef isgraph
  87. int isgraph(int c)
  88. {
  89. return __inline_isgraph(c);
  90. }
  91. #undef isupper
  92. int isupper(int c)
  93. {
  94. return __inline_isupper(c);
  95. }
  96. #undef islower
  97. int islower(int c)
  98. {
  99. return __inline_islower(c);
  100. }
  101. #undef isascii
  102. int isascii(int c)
  103. {
  104. return __inline_isascii(c);
  105. }
  106. #undef isblank
  107. int isblank(int c)
  108. {
  109. return __inline_isblank(c);
  110. }
  111. #undef toascii
  112. int toascii(int c)
  113. {
  114. return __inline_toascii(c);
  115. }
  116. #undef tolower
  117. int tolower(int c)
  118. {
  119. return __inline_tolower(c);
  120. }
  121. #undef toupper
  122. int toupper(int c)
  123. {
  124. return __inline_toupper(c);
  125. }
  126. }