home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / tools / chardir / ucmp8.h < prev   
Encoding:
C/C++ Source or Header  |  1999-10-19  |  2.8 KB  |  91 lines

  1.  
  2. /*
  3.  ********************************************************************
  4.  * COPYRIGHT: 
  5.  * (C) Copyright Taligent, Inc., 1996
  6.  * (C) Copyright International Business Machines Corporation, 1996 - 1998
  7.  * Licensed Material - Program-Property of IBM - All Rights Reserved. 
  8.  * US Government Users Restricted Rights - Use, duplication, or disclosure 
  9.  * restricted by GSA ADP Schedule Contract with IBM Corp. 
  10.  *
  11.  ********************************************************************
  12.  */
  13.  
  14.  
  15.  
  16. #ifndef UCMP8_H
  17. #define UCMP8_H
  18.  
  19.  
  20. #include "utypes.h"
  21.  
  22. /*====================================*/
  23. /* class CompactByteArray
  24.  * Provides a compact way to store information that is indexed by Unicode values,
  25.  * such as character properties, types, keyboard values, etc.
  26.  * The ATypes are used by value, so should be small, integers or pointers.
  27.  *====================================
  28.  */
  29.  
  30. U_CAPI  const int32_t UCMP8_kUnicodeCount;
  31. U_CAPI  const int32_t UCMP8_kBlockShift;
  32. U_CAPI  const int32_t UCMP8_kBlockCount;
  33. U_CAPI  const int32_t UCMP8_kIndexShift;
  34. U_CAPI  const int32_t UCMP8_kIndexCount;
  35. U_CAPI  const uint32_t UCMP8_kBlockMask;
  36.  
  37. U_CAPI int32_t ucmp8_getkUnicodeCount(void);
  38. U_CAPI int32_t ucmp8_getkBlockCount(void);
  39. U_CAPI int32_t ucmp8_getkIndexCount(void);
  40. typedef struct{
  41.   int8_t* fArray;
  42.   uint16_t* fIndex;
  43.   int32_t fCount;
  44.   bool_t fCompact; 
  45.   bool_t fBogus;
  46. } CompactByteArray;
  47.  
  48. U_CAPI  CompactByteArray* ucmp8_open(int8_t defaultValue);
  49. U_CAPI  CompactByteArray* ucmp8_openAdopt(uint16_t* indexArray, 
  50.                                int8_t* newValues,
  51.                                int32_t count);
  52. U_CAPI  void ucmp8_close(CompactByteArray* array);
  53. U_CAPI  bool_t isBogus(const CompactByteArray* array);
  54.  
  55.  
  56. U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index); 
  57. U_CAPI uint8_t ucmp8_getu(CompactByteArray* array, uint16_t index);
  58.  
  59. U_CAPI  void ucmp8_set(CompactByteArray* array,
  60.                  UChar index,
  61.                  int8_t value);
  62.  
  63. U_CAPI  void ucmp8_setRange(CompactByteArray* array, 
  64.                   UChar start,
  65.                   UChar end, 
  66.                   int8_t value);
  67.  
  68. U_CAPI  int32_t ucmp8_getCount(const CompactByteArray* array);
  69. U_CAPI  const int8_t* ucmp8_getArray(const CompactByteArray* array);
  70. U_CAPI  const uint16_t* ucmp8_getIndex(const CompactByteArray* array);
  71.  
  72. /* Compact the array.
  73.    The value of cycle determines how large the overlap can be.
  74.    A cycle of 1 is the most compacted, but takes the most time to do.
  75.    If values stored in the array tend to repeat in cycles of, say, 16,
  76.    then using that will be faster than cycle = 1, and get almost the
  77.    same compression.
  78. */
  79. U_CAPI  void ucmp8_compact(CompactByteArray* array, 
  80.                  uint32_t cycle);
  81.  
  82. /* Expanded takes the array back to a 65536 element array*/
  83. U_CAPI  void ucmp8_expand(CompactByteArray* array);
  84.  
  85.  
  86.  
  87. #endif
  88.  
  89.  
  90.  
  91.