Subversion Repositories Kolibri OS

Rev

Rev 3584 | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
  3.  *
  4.  * This file is part of NetSurf, http://www.netsurf-browser.org/
  5.  *
  6.  * NetSurf is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; version 2 of the License.
  9.  *
  10.  * NetSurf is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  */
  18.  
  19. /** \file
  20.  * Locale-specific variants of various routines (implementation)
  21.  */
  22.  
  23. #include <ctype.h>
  24. #include <locale.h>
  25.  
  26. #include "utils/locale.h"
  27.  
  28. /* <ctype.h> functions */
  29. #define MAKELSCTYPE(x) int ls_##x(int c)                                \
  30. {                                                                       \
  31.         int ret;                                                        \
  32.         setlocale(LC_ALL, "");                                          \
  33.         ret = x(c);                                                     \
  34.         setlocale(LC_ALL, "C");                                         \
  35.         return ret;                                                     \
  36. }
  37.  
  38. MAKELSCTYPE(isalpha)
  39. MAKELSCTYPE(isalnum)
  40. MAKELSCTYPE(iscntrl)
  41. MAKELSCTYPE(isdigit)
  42. MAKELSCTYPE(isgraph)
  43. MAKELSCTYPE(islower)
  44. MAKELSCTYPE(isprint)
  45. MAKELSCTYPE(ispunct)
  46. MAKELSCTYPE(isspace)
  47. MAKELSCTYPE(isupper)
  48. MAKELSCTYPE(isxdigit)
  49. MAKELSCTYPE(tolower)
  50. MAKELSCTYPE(toupper)
  51.  
  52. #undef MAKELSCTYPE
  53.  
  54.