intl/icu/source/common/sprpimpl.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 *******************************************************************************
michael@0 3 *
michael@0 4 * Copyright (C) 2003-2006, International Business Machines
michael@0 5 * Corporation and others. All Rights Reserved.
michael@0 6 *
michael@0 7 *******************************************************************************
michael@0 8 * file name: sprpimpl.h
michael@0 9 * encoding: US-ASCII
michael@0 10 * tab size: 8 (not used)
michael@0 11 * indentation:4
michael@0 12 *
michael@0 13 * created on: 2003feb1
michael@0 14 * created by: Ram Viswanadha
michael@0 15 */
michael@0 16
michael@0 17 #ifndef SPRPIMPL_H
michael@0 18 #define SPRPIMPL_H
michael@0 19
michael@0 20 #include "unicode/utypes.h"
michael@0 21
michael@0 22 #if !UCONFIG_NO_IDNA
michael@0 23
michael@0 24 #include "unicode/ustring.h"
michael@0 25 #include "unicode/parseerr.h"
michael@0 26 #include "unicode/usprep.h"
michael@0 27 #include "unicode/udata.h"
michael@0 28 #include "utrie.h"
michael@0 29 #include "udataswp.h"
michael@0 30 #include "ubidi_props.h"
michael@0 31
michael@0 32 #define _SPREP_DATA_TYPE "spp"
michael@0 33
michael@0 34 enum UStringPrepType{
michael@0 35 USPREP_UNASSIGNED = 0x0000 ,
michael@0 36 USPREP_MAP = 0x0001 ,
michael@0 37 USPREP_PROHIBITED = 0x0002 ,
michael@0 38 USPREP_DELETE = 0x0003 ,
michael@0 39 USPREP_TYPE_LIMIT = 0x0004
michael@0 40 };
michael@0 41
michael@0 42 typedef enum UStringPrepType UStringPrepType;
michael@0 43
michael@0 44 #ifdef USPREP_TYPE_NAMES_ARRAY
michael@0 45 static const char* usprepTypeNames[] ={
michael@0 46 "UNASSIGNED" ,
michael@0 47 "MAP" ,
michael@0 48 "PROHIBITED" ,
michael@0 49 "DELETE",
michael@0 50 "TYPE_LIMIT"
michael@0 51 };
michael@0 52 #endif
michael@0 53
michael@0 54 enum{
michael@0 55 _SPREP_NORMALIZATION_ON = 0x0001,
michael@0 56 _SPREP_CHECK_BIDI_ON = 0x0002
michael@0 57 };
michael@0 58
michael@0 59 enum{
michael@0 60 _SPREP_TYPE_THRESHOLD = 0xFFF0,
michael@0 61 _SPREP_MAX_INDEX_VALUE = 0x3FBF, /*16139*/
michael@0 62 _SPREP_MAX_INDEX_TOP_LENGTH = 0x0003
michael@0 63 };
michael@0 64
michael@0 65 /* indexes[] value names */
michael@0 66 enum {
michael@0 67 _SPREP_INDEX_TRIE_SIZE = 0, /* number of bytes in StringPrep trie */
michael@0 68 _SPREP_INDEX_MAPPING_DATA_SIZE = 1, /* The array that contains the mapping */
michael@0 69 _SPREP_NORM_CORRECTNS_LAST_UNI_VERSION = 2, /* The index of Unicode version of last entry in NormalizationCorrections.txt */
michael@0 70 _SPREP_ONE_UCHAR_MAPPING_INDEX_START = 3, /* The starting index of 1 UChar mapping index in the mapping data array */
michael@0 71 _SPREP_TWO_UCHARS_MAPPING_INDEX_START = 4, /* The starting index of 2 UChars mapping index in the mapping data array */
michael@0 72 _SPREP_THREE_UCHARS_MAPPING_INDEX_START = 5, /* The starting index of 3 UChars mapping index in the mapping data array */
michael@0 73 _SPREP_FOUR_UCHARS_MAPPING_INDEX_START = 6, /* The starting index of 4 UChars mapping index in the mapping data array */
michael@0 74 _SPREP_OPTIONS = 7, /* Bit set of options to turn on in the profile */
michael@0 75 _SPREP_INDEX_TOP=16 /* changing this requires a new formatVersion */
michael@0 76 };
michael@0 77
michael@0 78 typedef struct UStringPrepKey UStringPrepKey;
michael@0 79
michael@0 80
michael@0 81 struct UStringPrepKey{
michael@0 82 char* name;
michael@0 83 char* path;
michael@0 84 };
michael@0 85
michael@0 86 struct UStringPrepProfile{
michael@0 87 int32_t indexes[_SPREP_INDEX_TOP];
michael@0 88 UTrie sprepTrie;
michael@0 89 const uint16_t* mappingData;
michael@0 90 UDataMemory* sprepData;
michael@0 91 const UBiDiProps *bdp; /* used only if checkBiDi is set */
michael@0 92 int32_t refCount;
michael@0 93 UBool isDataLoaded;
michael@0 94 UBool doNFKC;
michael@0 95 UBool checkBiDi;
michael@0 96 };
michael@0 97
michael@0 98 /**
michael@0 99 * Helper function for populating the UParseError struct
michael@0 100 * @internal
michael@0 101 */
michael@0 102 U_CAPI void U_EXPORT2
michael@0 103 uprv_syntaxError(const UChar* rules,
michael@0 104 int32_t pos,
michael@0 105 int32_t rulesLen,
michael@0 106 UParseError* parseError);
michael@0 107
michael@0 108
michael@0 109 /**
michael@0 110 * Swap StringPrep .spp profile data. See udataswp.h.
michael@0 111 * @internal
michael@0 112 */
michael@0 113 U_CAPI int32_t U_EXPORT2
michael@0 114 usprep_swap(const UDataSwapper *ds,
michael@0 115 const void *inData, int32_t length, void *outData,
michael@0 116 UErrorCode *pErrorCode);
michael@0 117
michael@0 118 #endif /* #if !UCONFIG_NO_IDNA */
michael@0 119
michael@0 120 #endif
michael@0 121
michael@0 122 /*
michael@0 123 * Hey, Emacs, please set the following:
michael@0 124 *
michael@0 125 * Local Variables:
michael@0 126 * indent-tabs-mode: nil
michael@0 127 * End:
michael@0 128 *
michael@0 129 */

mercurial