mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-2860 add UCONFIG_NO_NORMALIZATION and UCONFIG_NO_IDNA
X-SVN-Rev: 11809
This commit is contained in:
parent
9a4e0e4af2
commit
e5383df00f
26 changed files with 318 additions and 33 deletions
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002, International Business Machines
|
||||
* Copyright (C) 2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: strprep.cpp
|
||||
* file name: nameprep.cpp
|
||||
* encoding: US-ASCII
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
|
@ -14,6 +14,10 @@
|
|||
* created by: Ram Viswanadha
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#include "nameprep.h"
|
||||
// *****************************************************************************
|
||||
// class NamePrep
|
||||
|
@ -37,5 +41,4 @@ UBool NamePrep::isNotProhibited(UChar32 ch){
|
|||
|
||||
U_NAMESPACE_END
|
||||
|
||||
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002, International Business Machines
|
||||
* Copyright (C) 2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -18,6 +18,9 @@
|
|||
#define NAMEPREP_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#include "strprep.h"
|
||||
#include "unicode/uniset.h"
|
||||
|
||||
|
@ -83,6 +86,8 @@ private:
|
|||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -93,5 +98,3 @@ U_NAMESPACE_END
|
|||
* End:
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@ http://www.nicemice.net/amc/
|
|||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#include "ustr_imp.h"
|
||||
#include "cstring.h"
|
||||
#include "cmemory.h"
|
||||
|
@ -561,3 +564,5 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
|
|||
}
|
||||
|
||||
/* ### check notes on overflow handling - only necessary if not IDNA? are these Punycode functions to be public? */
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
|
|
@ -27,6 +27,8 @@ http://www.nicemice.net/amc/
|
|||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
/**
|
||||
* u_strToPunycode() converts Unicode to Punycode.
|
||||
*
|
||||
|
@ -102,6 +104,8 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
|
|||
UBool *caseFlags,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -112,4 +116,3 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
|
|||
* End:
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002, International Business Machines
|
||||
* Copyright (C) 2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: strprep.h
|
||||
* file name: sprpimpl.h
|
||||
* encoding: US-ASCII
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
|
@ -17,6 +17,10 @@
|
|||
#ifndef SPRPIMPL_H
|
||||
#define SPRPIMPL_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
enum{
|
||||
UIDNA_NO_VALUE = 0x0000 ,
|
||||
UIDNA_UNASSIGNED = 0x0001 ,
|
||||
|
@ -51,6 +55,9 @@ enum {
|
|||
#define U_IDNA_VERIFICATION_ERROR ((UErrorCode)(U_IDNA_ERROR_START + 6))
|
||||
#define U_IDNA_LABEL_TOO_LONG_ERROR ((UErrorCode)(U_IDNA_ERROR_START + 8))
|
||||
*/
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -61,4 +68,3 @@ enum {
|
|||
* End:
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002, International Business Machines
|
||||
* Copyright (C) 2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -14,6 +14,10 @@
|
|||
* created by: Ram Viswanadha
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#include "strprep.h"
|
||||
#include "utrie.h"
|
||||
#include "umutex.h"
|
||||
|
@ -532,3 +536,4 @@ UBool StringPrep::isLabelSeparator(UChar32 ch, UErrorCode& status){
|
|||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
#ifndef STRPREP_H
|
||||
#define STRPREP_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#include "unicode/uobject.h"
|
||||
#include "unicode/uniset.h"
|
||||
#include "unicode/parseerr.h"
|
||||
|
@ -347,6 +351,8 @@ inline UBool StringPrep::isLDHChar(UChar32 ch){
|
|||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -357,4 +363,3 @@ U_NAMESPACE_END
|
|||
* End:
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -1012,6 +1012,14 @@ uchar_addPropertyStarts(USet *set, UErrorCode *pErrorCode) {
|
|||
* zero or more case-ignorable characters.
|
||||
*/
|
||||
|
||||
#if UCONFIG_NO_NORMALIZATION
|
||||
/* no normalization - no combining classes */
|
||||
static U_INLINE uint8_t
|
||||
u_getCombiningClass(UChar32 c) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
enum {
|
||||
LOC_ROOT,
|
||||
LOC_TURKISH,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2001-2001, International Business Machines *
|
||||
* Copyright (C) 2001-2003, International Business Machines *
|
||||
* Corporation and others. All Rights Reserved. *
|
||||
* *
|
||||
******************************************************************************
|
||||
|
@ -14,10 +14,12 @@
|
|||
* created by: George Rhoten
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/uclean.h"
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/uloc.h"
|
||||
#include "unicode/uidna.h"
|
||||
#include "ustr_imp.h"
|
||||
#include "unormimp.h"
|
||||
#include "ucln_cmn.h"
|
||||
#include "umutex.h"
|
||||
|
@ -58,7 +60,9 @@ u_cleanup(void)
|
|||
}
|
||||
|
||||
}
|
||||
#if !UCONFIG_NO_IDNA
|
||||
ustrprep_cleanup();
|
||||
#endif
|
||||
#if !UCONFIG_NO_BREAK_ITERATION
|
||||
breakiterator_cleanup();
|
||||
#endif
|
||||
|
@ -68,7 +72,9 @@ u_cleanup(void)
|
|||
ures_cleanup();
|
||||
locale_cleanup();
|
||||
uloc_cleanup();
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
unorm_cleanup();
|
||||
#endif
|
||||
uset_cleanup();
|
||||
unames_cleanup();
|
||||
pname_cleanup();
|
||||
|
@ -123,6 +129,7 @@ u_init(UErrorCode *status) {
|
|||
uloc_countAvailable();
|
||||
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
/* IDNA. */
|
||||
{
|
||||
UChar nameSrc[] = {0x41, 0x42, 0x43, 0x00};
|
||||
|
@ -132,6 +139,7 @@ u_init(UErrorCode *status) {
|
|||
NULL, /* UParseError pointer */
|
||||
status);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Char Properties */
|
||||
|
@ -144,8 +152,11 @@ u_init(UErrorCode *status) {
|
|||
}
|
||||
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
/* Normalization */
|
||||
unorm_haveData(status);
|
||||
#endif
|
||||
|
||||
|
||||
/* Time Zone. TODO: move data loading from I18n lib to common, so we don't */
|
||||
/* have a dependency? */
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002, International Business Machines
|
||||
* Copyright (C) 2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: strprep.cpp
|
||||
* file name: uidna.cpp
|
||||
* encoding: US-ASCII
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
|
@ -13,6 +13,11 @@
|
|||
* created on: 2003feb1
|
||||
* created by: Ram Viswanadha
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#include "unicode/uidna.h"
|
||||
#include "unicode/ustring.h"
|
||||
#include "strprep.h"
|
||||
|
@ -739,3 +744,4 @@ CLEANUP:
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
|
|
@ -2029,6 +2029,8 @@ UCharEnumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCateg
|
|||
U_CAPI void U_EXPORT2
|
||||
u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context);
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
/**
|
||||
* Returns the combining class of the code point as specified in UnicodeData.txt.
|
||||
*
|
||||
|
@ -2039,6 +2041,8 @@ u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context);
|
|||
U_CAPI uint8_t U_EXPORT2
|
||||
u_getCombiningClass(UChar32 c);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the decimal digit value of a decimal digit character.
|
||||
* Such characters have the general category "Nd" (decimal digit numbers)
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#define __UIDNA_H__
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#include "unicode/parseerr.h"
|
||||
|
||||
/**
|
||||
|
@ -279,4 +282,6 @@ uidna_compare( const UChar *s1, int32_t length1,
|
|||
int32_t options,
|
||||
UErrorCode* status);
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#define UNORM_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/uiter.h"
|
||||
|
||||
/**
|
||||
|
@ -567,4 +570,6 @@ unorm_compare(const UChar *s1, int32_t length1,
|
|||
uint32_t options,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2706,6 +2706,34 @@ UnicodeSet::applyIntPropertyValue(UProperty prop, int32_t value, UErrorCode& ec)
|
|||
|
||||
if (prop == UCHAR_GENERAL_CATEGORY_MASK) {
|
||||
applyFilter(generalCategoryMaskFilter, &value, ec);
|
||||
#if UCONFIG_NO_NORMALIZATION
|
||||
} else if(prop == UCHAR_HANGUL_SYLLABLE_TYPE) {
|
||||
/*
|
||||
* Special code for when normalization is off.
|
||||
* HST is still available because it is hardcoded in uprops.c, but
|
||||
* the inclusions set does not have the necessary code points
|
||||
* for normalization properties.
|
||||
* I am hardcoding HST in this case because it is the only property
|
||||
* that prevents genbrk from compiling char.txt when normalization is off.
|
||||
* This saves me from turning off break iteration or making more
|
||||
* complicated changes in genbrk.
|
||||
*
|
||||
* This code is not efficient. For efficiency turn on normalization.
|
||||
*
|
||||
* markus 20030505
|
||||
*/
|
||||
UChar32 c;
|
||||
|
||||
clear();
|
||||
for(c=0x1100; c<=0xd7a3; ++c) {
|
||||
if(c==0x1200) {
|
||||
c=0xac00;
|
||||
}
|
||||
if(value == u_getIntPropertyValue(c, UCHAR_HANGUL_SYLLABLE_TYPE)) {
|
||||
add(c);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
IntPropertyContext c = {prop, value};
|
||||
applyFilter(intPropertyFilter, &c, ec);
|
||||
|
|
|
@ -23,7 +23,14 @@
|
|||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
// moved up to make unorm_cmpEquivFold work without normalization
|
||||
#include "unicode/ustring.h"
|
||||
#include "unormimp.h"
|
||||
#include "ustr_imp.h"
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/udata.h"
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/uiter.h"
|
||||
|
@ -31,11 +38,9 @@
|
|||
#include "unicode/usetiter.h"
|
||||
#include "unicode/unorm.h"
|
||||
#include "cmemory.h"
|
||||
#include "ustr_imp.h"
|
||||
#include "umutex.h"
|
||||
#include "utrie.h"
|
||||
#include "unicode/uset.h"
|
||||
#include "unormimp.h"
|
||||
|
||||
/*
|
||||
* Status of tailored normalization
|
||||
|
@ -3834,6 +3839,29 @@ unorm_concatenate(const UChar *left, int32_t leftLength,
|
|||
|
||||
/* compare canonically equivalent ------------------------------------------- */
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Normalization is not built into the ICU library, but case-insensitive
|
||||
* comparisons are possible using unorm_cmpEquivFold().
|
||||
* The following simply disables the decomposition part.
|
||||
*/
|
||||
|
||||
static inline UBool
|
||||
_haveData(UErrorCode &errorCode) {
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
errorCode=U_INTERNAL_PROGRAM_ERROR;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline const UChar *
|
||||
_decompose(UChar32 /*c*/, UChar /*buffer*/[4], int32_t &/*length*/) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
||||
/*
|
||||
* Compare two strings for canonical equivalence.
|
||||
* Further options include case-insensitive comparison and
|
||||
|
@ -4281,6 +4309,8 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
|
|||
}
|
||||
}
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
unorm_compare(const UChar *s1, int32_t length1,
|
||||
const UChar *s2, int32_t length2,
|
||||
|
@ -4436,3 +4466,5 @@ cleanup:
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_COLLATION
|
||||
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/uiter.h"
|
||||
#include "unicode/unorm.h"
|
||||
|
@ -637,4 +637,4 @@ unorm_setIter(UNormIterator *uni, UCharIterator *iter, UNormalizationMode mode,
|
|||
return &uni->api;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* uconfig.h switches */
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_COLLATION
|
||||
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/uiter.h"
|
||||
#include "unicode/unorm.h"
|
||||
|
@ -143,5 +143,6 @@ unorm_closeIter(UNormIterator *uni);
|
|||
U_CAPI UCharIterator * U_EXPORT2
|
||||
unorm_setIter(UNormIterator *uni, UCharIterator *iter, UNormalizationMode mode, UErrorCode *pErrorCode);
|
||||
|
||||
#endif
|
||||
#endif /* uconfig.h switches */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001-2002, International Business Machines
|
||||
* Copyright (C) 2001-2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -18,6 +18,9 @@
|
|||
#define __UNORMIMP_H__
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
#include "unicode/uiter.h"
|
||||
#include "unicode/unorm.h"
|
||||
#include "unicode/uset.h"
|
||||
|
@ -147,6 +150,8 @@ enum {
|
|||
_NORM_DECOMP_LENGTH_MASK=0x7f
|
||||
};
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
||||
/* Korean Hangul and Jamo constants */
|
||||
enum {
|
||||
JAMO_L_BASE=0x1100, /* "lead" jamo */
|
||||
|
@ -162,6 +167,8 @@ enum {
|
|||
HANGUL_COUNT=JAMO_L_COUNT*JAMO_V_COUNT*JAMO_T_COUNT
|
||||
};
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
/* Constants for options flags for normalization. @draft ICU 2.6 */
|
||||
enum {
|
||||
/** Options bit 0, do not decompose Hangul syllables. @draft ICU 2.6 */
|
||||
|
@ -216,6 +223,8 @@ unorm_compose(UChar *dest, int32_t destCapacity,
|
|||
UBool compat, int32_t options,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
||||
/**
|
||||
* Internal option for unorm_cmpEquivFold() for decomposing.
|
||||
* If not set, just do strcasecmp().
|
||||
|
@ -223,6 +232,16 @@ unorm_compose(UChar *dest, int32_t destCapacity,
|
|||
*/
|
||||
#define _COMPARE_EQUIV 0x80000
|
||||
|
||||
#ifndef U_COMPARE_IGNORE_CASE
|
||||
/* see also unorm.h */
|
||||
/**
|
||||
* Option bit for unorm_compare:
|
||||
* Perform case-insensitive comparison.
|
||||
* @draft ICU 2.2
|
||||
*/
|
||||
#define U_COMPARE_IGNORE_CASE 0x10000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Internal option for unorm_cmpEquivFold() for strncmp style.
|
||||
* If set, checks for both string length and terminating NUL.
|
||||
|
@ -243,6 +262,8 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
|
|||
uint32_t options,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
/**
|
||||
* Internal API, used by collation code.
|
||||
* Get access to the internal FCD trie table to be able to perform
|
||||
|
@ -643,4 +664,6 @@ unorm_addPropertyStarts(USet *set, UErrorCode *pErrorCode);
|
|||
* else there is a USerializedSet at canonStartSets+result
|
||||
*/
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -157,7 +157,11 @@ u_hasBinaryProperty(UChar32 c, UProperty which) {
|
|||
/* not a known binary property */
|
||||
return FALSE;
|
||||
} else if(which==UCHAR_FULL_COMPOSITION_EXCLUSION) {
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
return unorm_internalIsFullCompositionExclusion(c);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
} else {
|
||||
/* systematic, directly stored properties */
|
||||
return (u_getUnicodeProperties(c, binProps[which].column)&binProps[which].mask)!=0;
|
||||
|
@ -221,7 +225,11 @@ u_getIntPropertyValue(UChar32 c, UProperty which) {
|
|||
case UCHAR_BLOCK:
|
||||
return (int32_t)ublock_getCode(c);
|
||||
case UCHAR_CANONICAL_COMBINING_CLASS:
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
return u_getCombiningClass(c);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
case UCHAR_DECOMPOSITION_TYPE:
|
||||
return (int32_t)(u_getUnicodeProperties(c, 2)&UPROPS_DT_MASK);
|
||||
case UCHAR_EAST_ASIAN_WIDTH:
|
||||
|
@ -429,6 +437,8 @@ uprv_getInclusions(USet* set, UErrorCode *pErrorCode) {
|
|||
|
||||
uset_clear(set);
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
unorm_addPropertyStarts(set, pErrorCode);
|
||||
#endif
|
||||
uchar_addPropertyStarts(set, pErrorCode);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_COLLATION
|
||||
|
||||
#include "svccoll.h"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001-2002, International Business Machines
|
||||
* Copyright (C) 2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: testidn.c
|
||||
* file name: testidn.cpp
|
||||
* encoding: US-ASCII
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
|
@ -22,6 +22,9 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "cmemory.h"
|
||||
|
@ -495,6 +498,8 @@ loadIDNData(UErrorCode &errorCode) {
|
|||
return isDataLoaded;
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
*
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001-2002, International Business Machines
|
||||
* Copyright (C) 2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: genidn.c
|
||||
* file name: genidna.c
|
||||
* encoding: US-ASCII
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
|
@ -88,7 +88,9 @@ static UOption options[]={
|
|||
|
||||
extern int
|
||||
main(int argc, char* argv[]) {
|
||||
#if !UCONFIG_NO_IDNA
|
||||
char* filename = NULL;
|
||||
#endif
|
||||
const char *srcDir=NULL, *destDir=NULL, *suffix=NULL;
|
||||
char *basename=NULL;
|
||||
char *saveBasename = NULL;
|
||||
|
@ -146,6 +148,16 @@ main(int argc, char* argv[]) {
|
|||
suffix=NULL;
|
||||
}
|
||||
|
||||
#if UCONFIG_NO_IDNA
|
||||
|
||||
fprintf(stderr,
|
||||
"genidna writes dummy " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE
|
||||
" because UCONFIG_NO_IDNA is set, \n"
|
||||
"see icu/source/common/unicode/uconfig.h\n");
|
||||
generateData(destDir);
|
||||
|
||||
#else
|
||||
|
||||
setUnicodeVersion(options[6].value);
|
||||
filename = (char* ) uprv_malloc(uprv_strlen(srcDir) + 300); /* hopefully this should be enough */
|
||||
/* prepare the filename beginning with the source dir */
|
||||
|
@ -242,9 +254,14 @@ main(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
uprv_free(filename);
|
||||
|
||||
#endif
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
static void U_CALLCONV
|
||||
normalizationCorrectionsLineFn(void *context,
|
||||
char *fields[][2], int32_t fieldCount,
|
||||
|
@ -519,6 +536,8 @@ setLabelSeperators(UErrorCode *pErrorCode){
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
*
|
||||
|
|
|
@ -60,6 +60,25 @@ Each 16-bit IDN word contains:
|
|||
/* file data ---------------------------------------------------------------- */
|
||||
/* indexes[] value names */
|
||||
|
||||
#if UCONFIG_NO_IDNA
|
||||
|
||||
/* dummy UDataInfo cf. udata.h */
|
||||
static UDataInfo dataInfo = {
|
||||
sizeof(UDataInfo),
|
||||
0,
|
||||
|
||||
U_IS_BIG_ENDIAN,
|
||||
U_CHARSET_FAMILY,
|
||||
U_SIZEOF_UCHAR,
|
||||
0,
|
||||
|
||||
{ 0, 0, 0, 0 }, /* dummy dataFormat */
|
||||
{ 0, 0, 0, 0 }, /* dummy formatVersion */
|
||||
{ 0, 0, 0, 0 } /* dummy dataVersion */
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
static int32_t indexes[_IDNA_INDEX_TOP]={ 0 };
|
||||
|
||||
static uint16_t mappingData[_IDNA_MAPPING_DATA_SIZE]={0};
|
||||
|
@ -264,13 +283,23 @@ getFoldedValue(UNewTrie *trie, UChar32 start, int32_t offset) {
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
extern void
|
||||
generateData(const char *dataDir) {
|
||||
static uint8_t idnTrieBlock[100000];
|
||||
|
||||
UNewDataMemory *pData;
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
int32_t size, idnTrieSize, dataLength;
|
||||
int32_t size, dataLength;
|
||||
|
||||
#if UCONFIG_NO_IDNA
|
||||
|
||||
size=0;
|
||||
|
||||
#else
|
||||
|
||||
int32_t idnTrieSize;
|
||||
|
||||
idnTrieSize=utrie_serialize(&idnTrie, idnTrieBlock, sizeof(idnTrieBlock), getFoldedValue, TRUE, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
|
@ -286,6 +315,7 @@ generateData(const char *dataDir) {
|
|||
printf("Maximum length of the mapping string is : %i \n", maxLength);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* write the data */
|
||||
pData=udata_create(dataDir, DATA_TYPE, U_ICUDATA_NAME "_" DATA_NAME, &dataInfo,
|
||||
|
@ -294,6 +324,9 @@ generateData(const char *dataDir) {
|
|||
fprintf(stderr, "gennorm: unable to create the output file, error %d\n", errorCode);
|
||||
exit(errorCode);
|
||||
}
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
indexes[_IDNA_INDEX_TRIE_SIZE]=idnTrieSize;
|
||||
indexes[_IDNA_INDEX_MAPPING_DATA_SIZE]=sizeof(mappingData);
|
||||
|
||||
|
@ -301,6 +334,8 @@ generateData(const char *dataDir) {
|
|||
udata_writeBlock(pData, idnTrieBlock, idnTrieSize);
|
||||
udata_writeBlock(pData, mappingData, sizeof(mappingData));
|
||||
|
||||
#endif
|
||||
|
||||
/* finish up */
|
||||
dataLength=udata_finish(pData, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
|
@ -314,6 +349,9 @@ generateData(const char *dataDir) {
|
|||
exit(U_INTERNAL_PROGRAM_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
extern void
|
||||
cleanUpData(void) {
|
||||
|
||||
|
@ -321,6 +359,7 @@ cleanUpData(void) {
|
|||
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_IDNA */
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001-2002, International Business Machines
|
||||
* Copyright (C) 2001-2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -64,7 +64,9 @@ static UOption options[]={
|
|||
|
||||
extern int
|
||||
main(int argc, char* argv[]) {
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
char filename[300];
|
||||
#endif
|
||||
const char *srcDir=NULL, *destDir=NULL, *suffix=NULL;
|
||||
char *basename=NULL;
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
|
@ -122,6 +124,16 @@ main(int argc, char* argv[]) {
|
|||
suffix=NULL;
|
||||
}
|
||||
|
||||
#if UCONFIG_NO_NORMALIZATION
|
||||
|
||||
fprintf(stderr,
|
||||
"gennorm writes a dummy " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE
|
||||
" because UCONFIG_NO_NORMALIZATION is set, \n"
|
||||
"see icu/source/common/unicode/uconfig.h\n");
|
||||
generateData(destDir);
|
||||
|
||||
#else
|
||||
|
||||
setUnicodeVersion(options[6].value);
|
||||
|
||||
/* prepare the filename beginning with the source dir */
|
||||
|
@ -178,9 +190,13 @@ main(int argc, char* argv[]) {
|
|||
cleanUpData();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
/* parser for DerivedNormalizationProperties.txt ---------------------------- */
|
||||
|
||||
static void U_CALLCONV
|
||||
|
@ -405,6 +421,8 @@ parseDB(const char *filename, UErrorCode *pErrorCode) {
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2002, International Business Machines
|
||||
* Copyright (C) 1999-2003, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -29,7 +29,6 @@
|
|||
#include "unewdata.h"
|
||||
#include "unormimp.h"
|
||||
#include "gennorm.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# pragma warning(disable: 4100)
|
||||
#endif
|
||||
|
@ -44,6 +43,25 @@
|
|||
|
||||
/* file data ---------------------------------------------------------------- */
|
||||
|
||||
#if UCONFIG_NO_NORMALIZATION
|
||||
|
||||
/* dummy UDataInfo cf. udata.h */
|
||||
static UDataInfo dataInfo = {
|
||||
sizeof(UDataInfo),
|
||||
0,
|
||||
|
||||
U_IS_BIG_ENDIAN,
|
||||
U_CHARSET_FAMILY,
|
||||
U_SIZEOF_UCHAR,
|
||||
0,
|
||||
|
||||
{ 0, 0, 0, 0 }, /* dummy dataFormat */
|
||||
{ 0, 0, 0, 0 }, /* dummy formatVersion */
|
||||
{ 0, 0, 0, 0 } /* dummy dataVersion */
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
/* UDataInfo cf. udata.h */
|
||||
static UDataInfo dataInfo={
|
||||
sizeof(UDataInfo),
|
||||
|
@ -1759,13 +1777,23 @@ processData() {
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
||||
extern void
|
||||
generateData(const char *dataDir) {
|
||||
static uint8_t normTrieBlock[100000], fcdTrieBlock[100000], auxTrieBlock[100000];
|
||||
|
||||
UNewDataMemory *pData;
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
int32_t size, normTrieSize, fcdTrieSize, auxTrieSize, dataLength;
|
||||
int32_t size, dataLength;
|
||||
|
||||
#if UCONFIG_NO_NORMALIZATION
|
||||
|
||||
size=0;
|
||||
|
||||
#else
|
||||
|
||||
int32_t normTrieSize, fcdTrieSize, auxTrieSize;
|
||||
|
||||
normTrieSize=utrie_serialize(&norm32Trie, normTrieBlock, sizeof(normTrieBlock), getFoldedNormValue, FALSE, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
|
@ -1849,6 +1877,8 @@ generateData(const char *dataDir) {
|
|||
indexes[_NORM_INDEX_AUX_TRIE_SIZE]=auxTrieSize;
|
||||
indexes[_NORM_INDEX_CANON_SET_COUNT]=canonStartSetsTop;
|
||||
|
||||
#endif
|
||||
|
||||
/* write the data */
|
||||
pData=udata_create(dataDir, DATA_TYPE, U_ICUDATA_NAME "_" DATA_NAME, &dataInfo,
|
||||
haveCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
|
||||
|
@ -1857,6 +1887,8 @@ generateData(const char *dataDir) {
|
|||
exit(errorCode);
|
||||
}
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
udata_writeBlock(pData, indexes, sizeof(indexes));
|
||||
udata_writeBlock(pData, normTrieBlock, normTrieSize);
|
||||
udata_writeBlock(pData, utm_getStart(extraMem), extraMem->index*2);
|
||||
|
@ -1865,6 +1897,8 @@ generateData(const char *dataDir) {
|
|||
udata_writeBlock(pData, auxTrieBlock, auxTrieSize);
|
||||
udata_writeBlock(pData, canonStartSets, canonStartSetsTop*2);
|
||||
|
||||
#endif
|
||||
|
||||
/* finish up */
|
||||
dataLength=udata_finish(pData, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
|
@ -1879,6 +1913,8 @@ generateData(const char *dataDir) {
|
|||
}
|
||||
}
|
||||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
extern void
|
||||
cleanUpData(void) {
|
||||
int32_t i, count;
|
||||
|
@ -1898,6 +1934,8 @@ cleanUpData(void) {
|
|||
utrie_close(&auxTrie);
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
*
|
||||
|
|
|
@ -56,6 +56,8 @@ static UDataInfo dummyDataInfo = {
|
|||
{ 0, 0, 0, 0 } /* dummy dataVersion */
|
||||
};
|
||||
|
||||
static UVersionInfo UCAVersion;
|
||||
|
||||
#else
|
||||
|
||||
UCAElements le;
|
||||
|
@ -130,7 +132,6 @@ static uint32_t inverseTable[0xFFFF][3];
|
|||
static uint32_t inversePos = 0;
|
||||
static UChar stringContinue[0xFFFF];
|
||||
static uint32_t sContPos = 0;
|
||||
static UVersionInfo UCAVersion;
|
||||
|
||||
static void addNewInverse(UCAElements *element, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue