?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*-------------------------------------------------------------------------
  2.    ctype.h
  3.  
  4.    Philipp Klaus Krause, philipp@informatik.uni-frankfurt.de 2013
  5.  
  6.    (c) 2013 Goethe-Universität Frankfurt
  7.  
  8.    This library is free software; you can redistribute it and/or modify it
  9.    under the terms of the GNU General Public License as published by the
  10.    Free Software Foundation; either version 2, or (at your option) any
  11.    later version.
  12.  
  13.    This library is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.    GNU General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with this library; see the file COPYING. If not, write to the
  20.    Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
  21.    MA 02110-1301, USA.
  22.  
  23.    As a special exception, if you link this library with other files,
  24.    some of which are compiled with SDCC, to produce an executable,
  25.    this library does not by itself cause the resulting executable to
  26.    be covered by the GNU General Public License. This exception does
  27.    not however invalidate any other reasons why the executable file
  28.    might be covered by the GNU General Public License.
  29. -------------------------------------------------------------------------*/
  30.  
  31. #ifndef __SDCC_CTYPE_H
  32. #define __SDCC_CTYPE_H 1
  33.  
  34. extern int isalnum (int c);
  35. extern int isalpha (int c);
  36. extern int iscntrl (int c);
  37. extern int isgraph (int c);
  38. extern int isprint (int c);
  39. extern int ispunct (int c);
  40. extern int isspace (int c);
  41. extern int isalnum (int c);
  42. extern int isalnum (int c);
  43. extern int isxdigit (int c);
  44.  
  45. extern int tolower (int c);
  46. extern int toupper (int c);
  47.  
  48. /* Provide inline versions for the most used functions for efficiency */
  49. #if __STDC_VERSION__ >= 199901L
  50.  
  51. inline int isblank (int c)
  52. {
  53.   return ((unsigned char)c == ' ' || (unsigned char)c == '\t');
  54. }
  55.  
  56. #ifdef EOF
  57. _Static_assert(!((unsigned char)EOF == ' ' || (unsigned char)EOF == '\t'), "EOF out of range - ");
  58. #endif
  59.  
  60. inline int isdigit (int c)
  61. {
  62.   return ((unsigned char)c >= '0' && (unsigned char)c <= '9');
  63. }
  64.  
  65. #ifdef EOF
  66. _Static_assert(!((unsigned char)EOF >= '0' && (unsigned char)EOF <= '9'), "EOF out of range - ");
  67. #endif
  68.  
  69. inline int islower (int c)
  70. {
  71.   return ((unsigned char)c >= 'a' && (unsigned char)c <= 'z');
  72. }
  73.  
  74. #ifdef EOF
  75. _Static_assert(!((unsigned char)EOF >= 'a' && (unsigned char)EOF <= 'z'), "EOF out of range - ");
  76. #endif
  77.  
  78. inline int isupper (int c)
  79. {
  80.   return ((unsigned char)c >= 'A' && (unsigned char)c <= 'Z');
  81. }
  82.  
  83. #ifdef EOF
  84. _Static_assert(!((unsigned char)EOF >= 'A' && (unsigned char)EOF <= 'Z'), "EOF out of range - ");
  85. #endif
  86.  
  87. #else
  88.  
  89. extern int isblank (int c);
  90. extern int isdigit (int c);
  91. extern int islower (int c);
  92. extern int isupper (int c);
  93.  
  94. #endif
  95.  
  96. #endif
  97.