Blame gllib/unictype/categ_and_not.c

rpm-build 858c0f
/* Categories of Unicode characters.
rpm-build 858c0f
   Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc.
rpm-build 858c0f
   Written by Bruno Haible <bruno@clisp.org>, 2007.
rpm-build 858c0f
rpm-build 858c0f
   This program is free software: you can redistribute it and/or modify it
rpm-build 858c0f
   under the terms of the GNU General Public License as published
rpm-build 858c0f
   by the Free Software Foundation; either version 3 of the License, or
rpm-build 858c0f
   (at your option) any later version.
rpm-build 858c0f
rpm-build 858c0f
   This program is distributed in the hope that it will be useful,
rpm-build 858c0f
   but WITHOUT ANY WARRANTY; without even the implied warranty of
rpm-build 858c0f
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rpm-build 858c0f
   General Public License for more details.
rpm-build 858c0f
rpm-build 858c0f
   You should have received a copy of the GNU General Public License
rpm-build 858c0f
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
rpm-build 858c0f
rpm-build 858c0f
#include <config.h>
rpm-build 858c0f
rpm-build 858c0f
/* Specification.  */
rpm-build 858c0f
#include "unictype.h"
rpm-build 858c0f
rpm-build 858c0f
uc_general_category_t
rpm-build 858c0f
uc_general_category_and_not (uc_general_category_t category1,
rpm-build 858c0f
                             uc_general_category_t category2)
rpm-build 858c0f
{
rpm-build 858c0f
  uint32_t bitmask;
rpm-build 858c0f
  uc_general_category_t result;
rpm-build 858c0f
rpm-build 858c0f
  bitmask = category1.bitmask & ~category2.bitmask;
rpm-build 858c0f
rpm-build 858c0f
  if (bitmask == category1.bitmask)
rpm-build 858c0f
    return category1;
rpm-build 858c0f
rpm-build 858c0f
  if (bitmask == 0)
rpm-build 858c0f
    return _UC_CATEGORY_NONE;
rpm-build 858c0f
rpm-build 858c0f
  result.bitmask = bitmask;
rpm-build 858c0f
  result.generic = 1;
rpm-build 858c0f
  result.lookup.lookup_fn = &uc_is_general_category_withtable;
rpm-build 858c0f
  return result;
rpm-build 858c0f
}