michael@0: /* michael@0: ******************************************************************************* michael@0: * michael@0: * Copyright (C) 2001-2008, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: * michael@0: ******************************************************************************* michael@0: * file name: ucol_tok.cpp michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * created 02/22/2001 michael@0: * created by: Vladimir Weinstein michael@0: * michael@0: * This module maintains a contraction table structure in expanded form michael@0: * and provides means to flatten this structure michael@0: * michael@0: */ michael@0: michael@0: #ifndef UCOL_CNTTABLE_H michael@0: #define UCOL_CNTTABLE_H michael@0: michael@0: #include "unicode/utypes.h" michael@0: michael@0: #if !UCONFIG_NO_COLLATION michael@0: michael@0: #include "utrie.h" michael@0: #include "ucol_imp.h" michael@0: michael@0: U_CDECL_BEGIN michael@0: michael@0: #define UPRV_CNTTAB_NEWELEMENT 0xFFFFFF michael@0: michael@0: #define isCntTableElement(CE) (isSpecial((CE)) && \ michael@0: ((getCETag((CE)) == CONTRACTION_TAG)||(getCETag((CE)) == SPEC_PROC_TAG))) michael@0: michael@0: typedef struct ContractionTable ContractionTable; michael@0: struct ContractionTable { michael@0: UChar *codePoints; michael@0: uint32_t *CEs; michael@0: uint32_t position; michael@0: uint32_t size; michael@0: }; michael@0: michael@0: struct CntTable { michael@0: ContractionTable **elements; michael@0: /*CompactEIntArray *mapping;*/ michael@0: UNewTrie *mapping; michael@0: UChar *codePoints; michael@0: uint32_t *CEs; michael@0: int32_t *offsets; michael@0: int32_t position; michael@0: int32_t size; michael@0: int32_t capacity; michael@0: UColCETags currentTag; michael@0: }; michael@0: michael@0: U_CAPI CntTable* U_EXPORT2 michael@0: /*uprv_cnttab_open(CompactEIntArray *mapping, UErrorCode *status);*/ michael@0: uprv_cnttab_open(UNewTrie *mapping, UErrorCode *status); michael@0: U_CAPI CntTable* U_EXPORT2 michael@0: uprv_cnttab_clone(CntTable *table, UErrorCode *status); michael@0: U_CAPI void U_EXPORT2 michael@0: uprv_cnttab_close(CntTable *table); michael@0: michael@0: /* construct the table for output */ michael@0: U_CAPI int32_t U_EXPORT2 michael@0: uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *status); michael@0: /* adds more contractions in table. If element is non existant, it creates on. Returns element handle */ michael@0: U_CAPI uint32_t U_EXPORT2 michael@0: uprv_cnttab_addContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UErrorCode *status); michael@0: /* sets a part of contraction sequence in table. If element is non existant, it creates on. Returns element handle */ michael@0: U_CAPI uint32_t U_EXPORT2 michael@0: uprv_cnttab_setContraction(CntTable *table, uint32_t element, uint32_t offset, UChar codePoint, uint32_t value, UErrorCode *status); michael@0: /* inserts a part of contraction sequence in table. Sequences behind the offset are moved back. If element is non existant, it creates on. Returns element handle */ michael@0: U_CAPI uint32_t U_EXPORT2 michael@0: uprv_cnttab_insertContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UErrorCode *status); michael@0: /* this is for adding non contractions */ michael@0: U_CAPI uint32_t U_EXPORT2 michael@0: uprv_cnttab_changeLastCE(CntTable *table, uint32_t element, uint32_t value, UErrorCode *status); michael@0: michael@0: U_CAPI int32_t U_EXPORT2 michael@0: uprv_cnttab_findCP(CntTable *table, uint32_t element, UChar codePoint, UErrorCode *status); michael@0: michael@0: U_CAPI uint32_t U_EXPORT2 michael@0: uprv_cnttab_getCE(CntTable *table, uint32_t element, uint32_t position, UErrorCode *status); michael@0: michael@0: U_CAPI uint32_t U_EXPORT2 michael@0: uprv_cnttab_changeContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t newCE, UErrorCode *status); michael@0: michael@0: U_CAPI uint32_t U_EXPORT2 michael@0: uprv_cnttab_findCE(CntTable *table, uint32_t element, UChar codePoint, UErrorCode *status); michael@0: michael@0: U_CAPI UBool U_EXPORT2 michael@0: uprv_cnttab_isTailored(CntTable *table, uint32_t element, UChar *ztString, UErrorCode *status); michael@0: michael@0: U_CDECL_END michael@0: michael@0: #endif /* #if !UCONFIG_NO_COLLATION */ michael@0: michael@0: #endif