2004-09-14 16:58:51 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
2010-07-28 16:08:12 +00:00
|
|
|
* Copyright (C) 1999-2010, International Business Machines
|
2004-09-14 16:58:51 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
* file name: uinvchar.h
|
|
|
|
* encoding: US-ASCII
|
|
|
|
* tab size: 8 (not used)
|
|
|
|
* indentation:2
|
|
|
|
*
|
|
|
|
* created on: 2004sep14
|
|
|
|
* created by: Markus W. Scherer
|
|
|
|
*
|
|
|
|
* Definitions for handling invariant characters, moved here from putil.c
|
|
|
|
* for better modularization.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UINVCHAR_H__
|
|
|
|
#define __UINVCHAR_H__
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if a char string only contains invariant characters.
|
|
|
|
* See utypes.h for details.
|
|
|
|
*
|
|
|
|
* @param s Input string pointer.
|
|
|
|
* @param length Length of the string, can be -1 if NUL-terminated.
|
|
|
|
* @return TRUE if s contains only invariant characters.
|
|
|
|
*
|
|
|
|
* @internal (ICU 2.8)
|
|
|
|
*/
|
|
|
|
U_INTERNAL UBool U_EXPORT2
|
|
|
|
uprv_isInvariantString(const char *s, int32_t length);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if a Unicode string only contains invariant characters.
|
|
|
|
* See utypes.h for details.
|
|
|
|
*
|
|
|
|
* @param s Input string pointer.
|
|
|
|
* @param length Length of the string, can be -1 if NUL-terminated.
|
|
|
|
* @return TRUE if s contains only invariant characters.
|
|
|
|
*
|
|
|
|
* @internal (ICU 2.8)
|
|
|
|
*/
|
|
|
|
U_INTERNAL UBool U_EXPORT2
|
|
|
|
uprv_isInvariantUString(const UChar *s, int32_t length);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \def U_UPPER_ORDINAL
|
|
|
|
* Get the ordinal number of an uppercase invariant character
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
|
|
|
# define U_UPPER_ORDINAL(x) ((x)-'A')
|
|
|
|
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
|
|
|
# define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \
|
|
|
|
(((x) < 'S') ? ((x)-'J'+9) : \
|
|
|
|
((x)-'S'+18)))
|
|
|
|
#else
|
|
|
|
# error Unknown charset family!
|
|
|
|
#endif
|
|
|
|
|
2009-07-17 22:57:26 +00:00
|
|
|
/**
|
|
|
|
* Compare two EBCDIC invariant-character strings in ASCII order.
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
U_INTERNAL int32_t U_EXPORT2
|
|
|
|
uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \def uprv_compareInvCharsAsAscii
|
|
|
|
* Compare two invariant-character strings in ASCII order.
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
|
|
|
# define uprv_compareInvCharsAsAscii(s1, s2) uprv_strcmp(s1, s2)
|
|
|
|
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
|
|
|
# define uprv_compareInvCharsAsAscii(s1, s2) uprv_compareInvEbcdicAsAscii(s1, s2)
|
|
|
|
#else
|
|
|
|
# error Unknown charset family!
|
|
|
|
#endif
|
|
|
|
|
2010-07-28 16:08:12 +00:00
|
|
|
/**
|
|
|
|
* Copy EBCDIC to ASCII
|
|
|
|
* @internal
|
|
|
|
* @see uprv_strncpy
|
|
|
|
*/
|
|
|
|
U_INTERNAL uint8_t* U_EXPORT2
|
|
|
|
uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy ASCII to EBCDIC
|
|
|
|
* @internal
|
|
|
|
* @see uprv_strncpy
|
|
|
|
*/
|
|
|
|
U_INTERNAL uint8_t* U_EXPORT2
|
|
|
|
uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-09-14 16:58:51 +00:00
|
|
|
#endif
|