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