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