sl@0: /* sl@0: ******************************************************************************* sl@0: * sl@0: * Copyright (C) 2003-2005, International Business Machines sl@0: * Corporation and others. All Rights Reserved. sl@0: * sl@0: ******************************************************************************* sl@0: * file name: sprpimpl.h sl@0: * encoding: US-ASCII sl@0: * tab size: 8 (not used) sl@0: * indentation:4 sl@0: * sl@0: * created on: 2003feb1 sl@0: * created by: Ram Viswanadha sl@0: */ sl@0: sl@0: #ifndef SPRPIMPL_H sl@0: #define SPRPIMPL_H sl@0: sl@0: #include "unicode/utypes.h" sl@0: sl@0: #if !UCONFIG_NO_IDNA sl@0: sl@0: #include "unicode/ustring.h" sl@0: #include "unicode/parseerr.h" sl@0: #include "unicode/usprep.h" sl@0: #include "unicode/udata.h" sl@0: #include "utrie.h" sl@0: #include "udataswp.h" sl@0: #include "ubidi_props.h" sl@0: sl@0: #define _SPREP_DATA_TYPE "spp" sl@0: sl@0: enum UStringPrepType{ sl@0: USPREP_UNASSIGNED = 0x0000 , sl@0: USPREP_MAP = 0x0001 , sl@0: USPREP_PROHIBITED = 0x0002 , sl@0: USPREP_DELETE = 0x0003 , sl@0: USPREP_TYPE_LIMIT = 0x0004 sl@0: }; sl@0: sl@0: typedef enum UStringPrepType UStringPrepType; sl@0: sl@0: #ifdef USPREP_TYPE_NAMES_ARRAY sl@0: static const char* usprepTypeNames[] ={ sl@0: "UNASSIGNED" , sl@0: "MAP" , sl@0: "PROHIBITED" , sl@0: "DELETE", sl@0: "TYPE_LIMIT" sl@0: }; sl@0: #endif sl@0: sl@0: enum{ sl@0: _SPREP_NORMALIZATION_ON = 0x0001, sl@0: _SPREP_CHECK_BIDI_ON = 0x0002 sl@0: }; sl@0: sl@0: enum{ sl@0: _SPREP_TYPE_THRESHOLD = 0xFFF0, sl@0: _SPREP_MAX_INDEX_VALUE = 0x3FBF, /*16139*/ sl@0: _SPREP_MAX_INDEX_TOP_LENGTH = 0x0003 sl@0: }; sl@0: sl@0: /* indexes[] value names */ sl@0: enum { sl@0: _SPREP_INDEX_TRIE_SIZE = 0, /* number of bytes in StringPrep trie */ sl@0: _SPREP_INDEX_MAPPING_DATA_SIZE = 1, /* The array that contains the mapping */ sl@0: _SPREP_NORM_CORRECTNS_LAST_UNI_VERSION = 2, /* The index of Unicode version of last entry in NormalizationCorrections.txt */ sl@0: _SPREP_ONE_UCHAR_MAPPING_INDEX_START = 3, /* The starting index of 1 UChar mapping index in the mapping data array */ sl@0: _SPREP_TWO_UCHARS_MAPPING_INDEX_START = 4, /* The starting index of 2 UChars mapping index in the mapping data array */ sl@0: _SPREP_THREE_UCHARS_MAPPING_INDEX_START = 5, /* The starting index of 3 UChars mapping index in the mapping data array */ sl@0: _SPREP_FOUR_UCHARS_MAPPING_INDEX_START = 6, /* The starting index of 4 UChars mapping index in the mapping data array */ sl@0: _SPREP_OPTIONS = 7, /* Bit set of options to turn on in the profile */ sl@0: _SPREP_INDEX_TOP=16 /* changing this requires a new formatVersion */ sl@0: }; sl@0: sl@0: typedef struct UStringPrepKey UStringPrepKey; sl@0: sl@0: sl@0: struct UStringPrepKey{ sl@0: char* name; sl@0: char* path; sl@0: }; sl@0: sl@0: struct UStringPrepProfile{ sl@0: int32_t indexes[_SPREP_INDEX_TOP]; sl@0: UTrie sprepTrie; sl@0: const uint16_t* mappingData; sl@0: UDataMemory* sprepData; sl@0: const UBiDiProps *bdp; /* used only if checkBiDi is set */ sl@0: UBool isDataLoaded; sl@0: int32_t refCount; sl@0: UBool doNFKC; sl@0: UBool checkBiDi; sl@0: }; sl@0: sl@0: /** sl@0: * Helper function for populating the UParseError struct sl@0: * @internal sl@0: */ sl@0: U_CAPI void U_EXPORT2 sl@0: uprv_syntaxError(const UChar* rules, sl@0: int32_t pos, sl@0: int32_t rulesLen, sl@0: UParseError* parseError); sl@0: sl@0: sl@0: /** sl@0: * Swap StringPrep .spp profile data. See udataswp.h. sl@0: * @internal sl@0: */ sl@0: U_CAPI int32_t U_EXPORT2 sl@0: usprep_swap(const UDataSwapper *ds, sl@0: const void *inData, int32_t length, void *outData, sl@0: UErrorCode *pErrorCode); sl@0: sl@0: #endif /* #if !UCONFIG_NO_IDNA */ sl@0: sl@0: #endif sl@0: sl@0: /* sl@0: * Hey, Emacs, please set the following: sl@0: * sl@0: * Local Variables: sl@0: * indent-tabs-mode: nil sl@0: * End: sl@0: * sl@0: */