071d83c3cc
X-SVN-Rev: 7862
63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
/*
|
|
*******************************************************************************
|
|
*
|
|
* Copyright (C) 2002, International Business Machines
|
|
* Corporation and others. All Rights Reserved.
|
|
*
|
|
*******************************************************************************
|
|
* file name: uprops.h
|
|
* encoding: US-ASCII
|
|
* tab size: 8 (not used)
|
|
* indentation:4
|
|
*
|
|
* created on: 2002feb24
|
|
* created by: Markus W. Scherer
|
|
*
|
|
* Implementations for mostly non-core Unicode character properties
|
|
* stored in uprops.dat.
|
|
*/
|
|
|
|
#include "unicode/utypes.h"
|
|
#include "unicode/uchar.h"
|
|
#include "unicode/uscript.h"
|
|
#include "uprops.h"
|
|
|
|
U_CAPI void U_EXPORT2
|
|
u_charAge(UChar32 c, UVersionInfo versionArray) {
|
|
if(versionArray!=NULL) {
|
|
uint32_t version=u_getUnicodeProperties(c, 0)>>UPROPS_AGE_SHIFT;
|
|
versionArray[0]=(uint8_t)(version>>4);
|
|
versionArray[1]=(uint8_t)(version&0xf);
|
|
versionArray[2]=versionArray[3]=0;
|
|
}
|
|
}
|
|
|
|
U_CAPI UScriptCode U_EXPORT2
|
|
uscript_getScript(UChar32 c, UErrorCode *pErrorCode) {
|
|
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
|
return USCRIPT_INVALID_CODE;
|
|
}
|
|
if((uint32_t)c>0x10ffff) {
|
|
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
|
return USCRIPT_INVALID_CODE;
|
|
}
|
|
|
|
return (UScriptCode)(u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_MASK);
|
|
}
|
|
|
|
U_CAPI UBlockCode U_EXPORT2
|
|
ublock_getCode(UChar32 c) {
|
|
uint32_t b;
|
|
|
|
if((uint32_t)c>0x10ffff) {
|
|
return UBLOCK_INVALID_CODE;
|
|
}
|
|
|
|
b=(u_getUnicodeProperties(c, 0)&UPROPS_BLOCK_MASK)>>UPROPS_BLOCK_SHIFT;
|
|
if(b==0) {
|
|
return UBLOCK_INVALID_CODE;
|
|
} else {
|
|
return (UBlockCode)b;
|
|
}
|
|
}
|