root/maint/gnulib/lib/wctype-impl.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. wctype

   1 /* Get descriptor for a wide character property.
   2    Copyright (C) 2011-2021 Free Software Foundation, Inc.
   3    Written by Bruno Haible <bruno@clisp.org>, 2011.
   4 
   5    This file is free software: you can redistribute it and/or modify
   6    it under the terms of the GNU Lesser General Public License as
   7    published by the Free Software Foundation; either version 3 of the
   8    License, or (at your option) any later version.
   9 
  10    This file 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 Lesser General Public License for more details.
  14 
  15    You should have received a copy of the GNU Lesser General Public License
  16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  17 
  18 wctype_t
  19 wctype (const char* name)
     /* [previous][next][first][last][top][bottom][index][help] */
  20 {
  21   switch (name[0])
  22     {
  23     case 'a':
  24       switch (name[1])
  25         {
  26         case 'l':
  27           switch (name[2])
  28             {
  29             case 'n':
  30               if (strcmp (name + 3, "um") == 0)
  31                 return (wctype_t) iswalnum;
  32               break;
  33             case 'p':
  34               if (strcmp (name + 3, "ha") == 0)
  35                 return (wctype_t) iswalpha;
  36               break;
  37             default:
  38               break;
  39             }
  40           break;
  41         default:
  42           break;
  43         }
  44       break;
  45     case 'b':
  46       if (strcmp (name + 1, "lank") == 0)
  47         return (wctype_t) iswblank;
  48       break;
  49     case 'c':
  50       if (strcmp (name + 1, "ntrl") == 0)
  51         return (wctype_t) iswcntrl;
  52       break;
  53     case 'd':
  54       if (strcmp (name + 1, "igit") == 0)
  55         return (wctype_t) iswdigit;
  56       break;
  57     case 'g':
  58       if (strcmp (name + 1, "raph") == 0)
  59         return (wctype_t) iswgraph;
  60       break;
  61     case 'l':
  62       if (strcmp (name + 1, "ower") == 0)
  63         return (wctype_t) iswlower;
  64       break;
  65     case 'p':
  66       switch (name[1])
  67         {
  68         case 'r':
  69           if (strcmp (name + 2, "int") == 0)
  70             return (wctype_t) iswprint;
  71           break;
  72         case 'u':
  73           if (strcmp (name + 2, "nct") == 0)
  74             return (wctype_t) iswpunct;
  75           break;
  76         default:
  77           break;
  78         }
  79       break;
  80     case 's':
  81       if (strcmp (name + 1, "pace") == 0)
  82         return (wctype_t) iswspace;
  83       break;
  84     case 'u':
  85       if (strcmp (name + 1, "pper") == 0)
  86         return (wctype_t) iswupper;
  87       break;
  88     case 'x':
  89       if (strcmp (name + 1, "digit") == 0)
  90         return (wctype_t) iswxdigit;
  91       break;
  92     default:
  93       break;
  94     }
  95   return NULL;
  96 }

/* [previous][next][first][last][top][bottom][index][help] */