2001-02-26 10:28:56 +00:00
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
2005-10-12 16:06:54 +00:00
* Copyright ( C ) 2001 - 2005 , International Business Machines
2001-02-26 10:28:56 +00:00
* Corporation and others . All Rights Reserved .
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2001-03-17 00:46:46 +00:00
* file name : ucol_tok . cpp
2001-02-26 10:28:56 +00:00
* encoding : US - ASCII
* tab size : 8 ( not used )
* indentation : 4
*
2001-03-17 00:46:46 +00:00
* created 02 / 22 / 2001
* created by : Vladimir Weinstein
2001-02-26 10:28:56 +00:00
*
2001-03-17 00:46:46 +00:00
* This module maintains a contraction table structure in expanded form
* and provides means to flatten this structure
*
2001-02-26 10:28:56 +00:00
*/
# ifndef UCOL_CNTTABLE_H
# define UCOL_CNTTABLE_H
2002-09-20 01:54:48 +00:00
# include "unicode/utypes.h"
# if !UCONFIG_NO_COLLATION
2001-12-19 07:00:45 +00:00
/*#include "ucmpe32.h"*/
# include "utrie.h"
2001-02-26 10:28:56 +00:00
# include "uhash.h"
2001-03-08 17:40:42 +00:00
# include "ucol_elm.h"
2001-09-27 23:18:14 +00:00
# include "ucol_imp.h"
2001-02-26 10:28:56 +00:00
2005-10-12 16:06:54 +00:00
U_CDECL_BEGIN
2001-10-20 01:09:31 +00:00
2001-02-28 19:01:23 +00:00
# define UPRV_CNTTAB_NEWELEMENT 0xFFFFFF
2001-09-27 23:18:14 +00:00
# define isCntTableElement(CE) (isSpecial((CE)) && \
( ( getCETag ( ( CE ) ) = = CONTRACTION_TAG ) | | ( getCETag ( ( CE ) ) = = SPEC_PROC_TAG ) ) )
2001-02-26 10:28:56 +00:00
typedef struct ContractionTable ContractionTable ;
struct ContractionTable {
UChar * codePoints ;
uint32_t * CEs ;
2001-03-22 21:16:20 +00:00
uint32_t position ;
uint32_t size ;
2001-02-26 10:28:56 +00:00
} ;
struct CntTable {
2002-02-28 01:42:40 +00:00
ContractionTable * * elements ;
2001-12-19 07:00:45 +00:00
/*CompactEIntArray *mapping;*/
UNewTrie * mapping ;
2001-02-26 10:28:56 +00:00
UChar * codePoints ;
uint32_t * CEs ;
int32_t * offsets ;
int32_t position ;
int32_t size ;
int32_t capacity ;
2001-09-27 23:18:14 +00:00
UColCETags currentTag ;
2001-02-26 10:28:56 +00:00
} ;
2001-11-21 01:08:55 +00:00
U_CAPI CntTable * U_EXPORT2
2001-12-19 07:00:45 +00:00
/*uprv_cnttab_open(CompactEIntArray *mapping, UErrorCode *status);*/
uprv_cnttab_open ( UNewTrie * mapping , UErrorCode * status ) ;
2001-11-21 01:08:55 +00:00
U_CAPI CntTable * U_EXPORT2
2001-12-28 20:53:44 +00:00
uprv_cnttab_clone ( CntTable * table , UErrorCode * status ) ;
2001-11-21 01:08:55 +00:00
U_CAPI void U_EXPORT2
uprv_cnttab_close ( CntTable * table ) ;
2001-02-26 10:28:56 +00:00
/* construct the table for output */
2001-11-21 01:08:55 +00:00
U_CAPI int32_t U_EXPORT2
uprv_cnttab_constructTable ( CntTable * table , uint32_t mainOffset , UErrorCode * status ) ;
2001-02-26 10:28:56 +00:00
/* adds more contractions in table. If element is non existant, it creates on. Returns element handle */
2001-11-21 01:08:55 +00:00
U_CAPI uint32_t U_EXPORT2
uprv_cnttab_addContraction ( CntTable * table , uint32_t element , UChar codePoint , uint32_t value , UErrorCode * status ) ;
2001-02-26 10:28:56 +00:00
/* sets a part of contraction sequence in table. If element is non existant, it creates on. Returns element handle */
2001-11-21 01:08:55 +00:00
U_CAPI uint32_t U_EXPORT2
uprv_cnttab_setContraction ( CntTable * table , uint32_t element , uint32_t offset , UChar codePoint , uint32_t value , UErrorCode * status ) ;
2001-02-26 10:28:56 +00:00
/* 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 */
2001-11-21 01:08:55 +00:00
U_CAPI uint32_t U_EXPORT2
uprv_cnttab_insertContraction ( CntTable * table , uint32_t element , UChar codePoint , uint32_t value , UErrorCode * status ) ;
2001-02-26 10:28:56 +00:00
/* this is for adding non contractions */
2001-11-21 01:08:55 +00:00
U_CAPI uint32_t U_EXPORT2
uprv_cnttab_changeLastCE ( CntTable * table , uint32_t element , uint32_t value , UErrorCode * status ) ;
2001-02-26 10:28:56 +00:00
2001-11-21 01:08:55 +00:00
U_CAPI int32_t U_EXPORT2
uprv_cnttab_findCP ( CntTable * table , uint32_t element , UChar codePoint , UErrorCode * status ) ;
2001-02-26 10:28:56 +00:00
2001-11-21 01:08:55 +00:00
U_CAPI uint32_t U_EXPORT2
uprv_cnttab_getCE ( CntTable * table , uint32_t element , uint32_t position , UErrorCode * status ) ;
2001-11-13 19:44:32 +00:00
2001-11-21 01:08:55 +00:00
U_CAPI uint32_t U_EXPORT2
uprv_cnttab_changeContraction ( CntTable * table , uint32_t element , UChar codePoint , uint32_t newCE , UErrorCode * status ) ;
2001-11-13 19:44:32 +00:00
2001-11-21 01:08:55 +00:00
U_CAPI uint32_t U_EXPORT2
uprv_cnttab_findCE ( CntTable * table , uint32_t element , UChar codePoint , UErrorCode * status ) ;
2001-11-13 19:44:32 +00:00
2001-11-21 01:08:55 +00:00
U_CAPI UBool U_EXPORT2
uprv_cnttab_isTailored ( CntTable * table , uint32_t element , UChar * ztString , UErrorCode * status ) ;
2001-02-26 10:28:56 +00:00
2005-10-12 16:06:54 +00:00
U_CDECL_END
2001-10-20 01:09:31 +00:00
2002-09-20 01:54:48 +00:00
# endif /* #if !UCONFIG_NO_COLLATION */
2001-02-26 10:28:56 +00:00
# endif