scuffed-code/icu4c/source/common/uprops.c
Markus Scherer 2a992add12 ICU-1721 get UScriptCode from uprops.dat
X-SVN-Rev: 7827
2002-03-01 01:59:59 +00:00

47 lines
1.3 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);
}