/*
********************************************************************************
-* Copyright (C) 1996-2012, International Business Machines
+* Copyright (C) 1996-2014, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
#include "unicode/uscript.h"
#include "unicode/udata.h"
#include "uassert.h"
-#include "umutex.h"
#include "cmemory.h"
#include "ucln_cmn.h"
#include "utrie2.h"
#include "uprops.h"
#include "ustr_imp.h"
-#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
-
/* uchar_props_data.h is machine-generated by genprops --csource */
#define INCLUDED_FROM_UCHAR_C
#include "uchar_props_data.h"
int32_t numerator=(ntv>>4)-12;
int32_t denominator=(ntv&0xf)+1;
return (double)numerator/denominator;
- } else if(ntv<UPROPS_NTV_RESERVED_START) {
+ } else if(ntv<UPROPS_NTV_BASE60_START) {
/* large, single-significant-digit integer */
double numValue;
int32_t mant=(ntv>>5)-14;
break;
}
+ return numValue;
+ } else if(ntv<UPROPS_NTV_RESERVED_START) {
+ /* sexagesimal (base 60) integer */
+ int32_t numValue=(ntv>>2)-0xbf;
+ int32_t exp=(ntv&3)+1;
+
+ switch(exp) {
+ case 4:
+ numValue*=60*60*60*60;
+ break;
+ case 3:
+ numValue*=60*60*60;
+ break;
+ case 2:
+ numValue*=60*60;
+ break;
+ case 1:
+ numValue*=60;
+ break;
+ case 0:
+ default:
+ break;
+ }
+
return numValue;
} else {
/* reserved */
}
}
-U_DRAFT UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
uscript_hasScript(UChar32 c, UScriptCode sc) {
const uint16_t *scx;
uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
if(scriptX>=UPROPS_SCRIPT_X_WITH_OTHER) {
scx=scriptExtensions+scx[1];
}
- if(sc>0x7fff) {
+ if(sc>=USCRIPT_CODE_LIMIT) {
/* Guard against bogus input that would make us go past the Script_Extensions terminator. */
return FALSE;
}
return sc==(*scx&0x7fff);
}
-U_DRAFT int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uscript_getScriptExtensions(UChar32 c,
UScriptCode *scripts, int32_t capacity,
UErrorCode *pErrorCode) {
do {
sx=*scx++;
if(length<capacity) {
- scripts[length]=sx&0x7fff;
+ scripts[length]=(UScriptCode)(sx&0x7fff);
}
++length;
} while(sx<0x8000);