2N/A/* $OpenLDAP: pkg/ldap/libraries/liblunicode/ure/urestubs.c,v 1.16 2008/01/07 23:20:05 kurt Exp $ */
2N/A/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
2N/A *
2N/A * Copyright 1998-2008 The OpenLDAP Foundation.
2N/A * All rights reserved.
2N/A *
2N/A * Redistribution and use in source and binary forms, with or without
2N/A * modification, are permitted only as authorized by the OpenLDAP
2N/A * Public License.
2N/A *
2N/A * A copy of this license is available in file LICENSE in the
2N/A * top-level directory of the distribution or, alternatively, at
2N/A * <http://www.OpenLDAP.org/license.html>.
2N/A */
2N/A/*
2N/A * Copyright 1997, 1998, 1999 Computing Research Labs,
2N/A * New Mexico State University
2N/A *
2N/A * Permission is hereby granted, free of charge, to any person obtaining a
2N/A * copy of this software and associated documentation files (the "Software"),
2N/A * to deal in the Software without restriction, including without limitation
2N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
2N/A * and/or sell copies of the Software, and to permit persons to whom the
2N/A * Software is furnished to do so, subject to the following conditions:
2N/A *
2N/A * The above copyright notice and this permission notice shall be included in
2N/A * all copies or substantial portions of the Software.
2N/A *
2N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
2N/A * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
2N/A * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
2N/A * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
2N/A * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2N/A */
2N/A/* $Id: urestubs.c,v 1.2 1999/09/21 15:47:44 mleisher Exp $" */
2N/A
2N/A#include "k5-int.h"
2N/A
2N/A#include "ure.h"
2N/A
2N/A#include "ucdata.h"
2N/A
2N/A/*
2N/A * This file contains stub routines needed by the URE package to test
2N/A * character properties and other Unicode implementation specific details.
2N/A */
2N/A
2N/A/*
2N/A * This routine should return the lower case equivalent for the character or,
2N/A * if there is no lower case quivalent, the character itself.
2N/A */
2N/Aucs4_t _ure_tolower(ucs4_t c)
2N/A{
2N/A return uctoupper(c);
2N/A}
2N/A
2N/Astatic struct ucmaskmap {
2N/A unsigned long mask1;
2N/A unsigned long mask2;
2N/A} masks[32] = {
2N/A { UC_MN, 0 }, /* _URE_NONSPACING */
2N/A { UC_MC, 0 }, /* _URE_COMBINING */
2N/A { UC_ND, 0 }, /* _URE_NUMDIGIT */
2N/A { UC_NL|UC_NO, 0 }, /* _URE_NUMOTHER */
2N/A { UC_ZS, 0 }, /* _URE_SPACESEP */
2N/A { UC_ZL, 0 }, /* _URE_LINESEP */
2N/A { UC_ZP, 0 }, /* _URE_PARASEP */
2N/A { UC_CC, 0 }, /* _URE_CNTRL */
2N/A { UC_CO, 0 }, /* _URE_PUA */
2N/A
2N/A { UC_LU, 0 }, /* _URE_UPPER */
2N/A { UC_LL, 0 }, /* _URE_LOWER */
2N/A { UC_LT, 0 }, /* _URE_TITLE */
2N/A { UC_LM, 0 }, /* _URE_MODIFIER */
2N/A { UC_LO, 0 }, /* _URE_OTHERLETTER */
2N/A { UC_PD, 0 }, /* _URE_DASHPUNCT */
2N/A { UC_PS, 0 }, /* _URE_OPENPUNCT */
2N/A { UC_PC, 0 }, /* _URE_CLOSEPUNCT */
2N/A { UC_PO, 0 }, /* _URE_OTHERPUNCT */
2N/A { UC_SM, 0 }, /* _URE_MATHSYM */
2N/A { UC_SC, 0 }, /* _URE_CURRENCYSYM */
2N/A { UC_SO, 0 }, /* _URE_OTHERSYM */
2N/A
2N/A { UC_L, 0 }, /* _URE_LTR */
2N/A { UC_R, 0 }, /* _URE_RTL */
2N/A
2N/A { 0, UC_EN }, /* _URE_EURONUM */
2N/A { 0, UC_ES }, /* _URE_EURONUMSEP */
2N/A { 0, UC_ET }, /* _URE_EURONUMTERM */
2N/A { 0, UC_AN }, /* _URE_ARABNUM */
2N/A { 0, UC_CS }, /* _URE_COMMONSEP */
2N/A
2N/A { 0, UC_B }, /* _URE_BLOCKSEP */
2N/A { 0, UC_S }, /* _URE_SEGMENTSEP */
2N/A
2N/A { 0, UC_WS }, /* _URE_WHITESPACE */
2N/A { 0, UC_ON } /* _URE_OTHERNEUT */
2N/A};
2N/A
2N/A
2N/A/*
2N/A * This routine takes a set of URE character property flags (see ure.h) along
2N/A * with a character and tests to see if the character has one or more of those
2N/A * properties.
2N/A */
2N/Aint
2N/A_ure_matches_properties(unsigned long props, ucs4_t c)
2N/A{
2N/A int i;
2N/A unsigned long mask1=0, mask2=0;
2N/A
2N/A for( i=0; i<32; i++ ) {
2N/A if( props & (1 << i) ) {
2N/A mask1 |= masks[i].mask1;
2N/A mask2 |= masks[i].mask2;
2N/A }
2N/A }
2N/A
2N/A return ucisprop( mask1, mask2, c );
2N/A}