root/maint/gnulib/lib/unictype/combiningclass_longname.c

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

DEFINITIONS

This source file includes following definitions.
  1. uc_combining_class_long_name

   1 /* Canonical combining classes of Unicode characters.
   2    Copyright (C) 2002, 2006-2007, 2011-2021 Free Software Foundation, Inc.
   3    Written by Bruno Haible <bruno@clisp.org>, 2011.
   4 
   5    This file is free software.
   6    It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
   7    You can redistribute it and/or modify it under either
   8      - the terms of the GNU Lesser General Public License as published
   9        by the Free Software Foundation; either version 3, or (at your
  10        option) any later version, or
  11      - the terms of the GNU General Public License as published by the
  12        Free Software Foundation; either version 2, or (at your option)
  13        any later version, or
  14      - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
  15 
  16    This file is distributed in the hope that it will be useful,
  17    but WITHOUT ANY WARRANTY; without even the implied warranty of
  18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  19    Lesser General Public License and the GNU General Public License
  20    for more details.
  21 
  22    You should have received a copy of the GNU Lesser General Public
  23    License and of the GNU General Public License along with this
  24    program.  If not, see <https://www.gnu.org/licenses/>.  */
  25 
  26 #include <config.h>
  27 
  28 /* Specification.  */
  29 #include "unictype.h"
  30 
  31 #include <stdlib.h>
  32 
  33 static const signed char u_combining_class_index_part1[10] =
  34 {
  35    0, /* Not Reordered */
  36    1, /* Overlay */
  37   -1,
  38   -1,
  39   -1,
  40   -1,
  41   -1,
  42    2, /* Nukta */
  43    3, /* Kana Voicing */
  44    4  /* Virama */
  45 };
  46 static const signed char u_combining_class_index_part2[241 - 200] =
  47 {
  48    5, /* Attached Below Left */
  49   -1,
  50    6, /* Attached Below */
  51   -1,
  52   -1,
  53   -1,
  54   -1,
  55   -1,
  56   -1,
  57   -1,
  58   -1,
  59   -1,
  60   -1,
  61   -1,
  62    7, /* Attached Above */
  63   -1,
  64    8, /* Attached Above Right */
  65   -1,
  66    9, /* Below Left */
  67   -1,
  68   10, /* Below */
  69   -1,
  70   11, /* Below Right */
  71   -1,
  72   12, /* Left */
  73   -1,
  74   13, /* Right */
  75   -1,
  76   14, /* Above Left */
  77   -1,
  78   15, /* Above */
  79   -1,
  80   16, /* Above Right */
  81   17, /* Double Below */
  82   18, /* Double Above */
  83   -1,
  84   -1,
  85   -1,
  86   -1,
  87   -1,
  88   19  /* Iota Subscript */
  89 };
  90 
  91 static const char u_combining_class_long_name[20][21] =
  92 {
  93   "Not Reordered",
  94   "Overlay",
  95   "Nukta",
  96   "Kana Voicing",
  97   "Virama",
  98   "Attached Below Left",
  99   "Attached Below",
 100   "Attached Above",
 101   "Attached Above Right",
 102   "Below Left",
 103   "Below",
 104   "Below Right",
 105   "Left",
 106   "Right",
 107   "Above Left",
 108   "Above",
 109   "Above Right",
 110   "Double Below",
 111   "Double Above",
 112   "Iota Subscript"
 113 };
 114 
 115 const char *
 116 uc_combining_class_long_name (int ccc)
     /* [previous][next][first][last][top][bottom][index][help] */
 117 {
 118   if (ccc >= 0)
 119     {
 120       int index;
 121 
 122       if (ccc < 10)
 123         index = u_combining_class_index_part1[ccc];
 124       else if (ccc >= 200 && ccc < 241)
 125         index = u_combining_class_index_part2[ccc - 200];
 126       else
 127         return NULL;
 128 
 129       if (index >= 0)
 130         {
 131           if (index < sizeof (u_combining_class_long_name) / sizeof (u_combining_class_long_name[0]))
 132             return u_combining_class_long_name[index];
 133           else
 134             abort ();
 135         }
 136     }
 137   return NULL;
 138 }

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