ucol_data.h 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. * Copyright (C) 2000-2011, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. *******************************************************************************
  8. * file name: ucol_data.h
  9. * encoding: UTF-8
  10. * tab size: 8 (not used)
  11. * indentation:4
  12. *
  13. * created on: 2011jul02
  14. * created by: Markus Scherer
  15. *
  16. * Private implementation header for C/C++ collation.
  17. * Some file data structure definitions were moved here from i18n/ucol_imp.h
  18. * so that the common library (via ucol_swp.cpp) need not depend on the i18n library at all.
  19. *
  20. * We do not want to move the collation swapper to the i18n library because
  21. * a) the resource bundle swapper depends on it and would have to move too, and
  22. * b) we might want to eventually implement runtime data swapping,
  23. * which might (or might not) be easier if all swappers are in the common library.
  24. */
  25. #ifndef __UCOL_DATA_H__
  26. #define __UCOL_DATA_H__
  27. #include "unicode/utypes.h"
  28. #if !UCONFIG_NO_COLLATION
  29. /* let us know whether reserved fields are reset to zero or junked */
  30. #define UCOL_HEADER_MAGIC 0x20030618
  31. typedef struct {
  32. int32_t size;
  33. /* all the offsets are in bytes */
  34. /* to get the address add to the header address and cast properly */
  35. uint32_t options; /* these are the default options for the collator */
  36. uint32_t UCAConsts; /* structure which holds values for indirect positioning and implicit ranges */
  37. uint32_t contractionUCACombos; /* this one is needed only for UCA, to copy the appropriate contractions */
  38. uint32_t magic; /* magic number - lets us know whether reserved data is reset or junked */
  39. uint32_t mappingPosition; /* const uint8_t *mappingPosition; */
  40. uint32_t expansion; /* uint32_t *expansion; */
  41. uint32_t contractionIndex; /* char16_t *contractionIndex; */
  42. uint32_t contractionCEs; /* uint32_t *contractionCEs; */
  43. uint32_t contractionSize; /* needed for various closures */
  44. /*int32_t latinOneMapping;*/ /* this is now handled in the trie itself *//* fast track to latin1 chars */
  45. uint32_t endExpansionCE; /* array of last collation element in
  46. expansion */
  47. uint32_t expansionCESize; /* array of maximum expansion size
  48. corresponding to the expansion
  49. collation elements with last element
  50. in endExpansionCE*/
  51. int32_t endExpansionCECount; /* size of endExpansionCE */
  52. uint32_t unsafeCP; /* hash table of unsafe code points */
  53. uint32_t contrEndCP; /* hash table of final code points */
  54. /* in contractions. */
  55. int32_t contractionUCACombosSize; /* number of UCA contraction items. */
  56. /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(char16_t) */
  57. UBool jamoSpecial; /* is jamoSpecial */
  58. UBool isBigEndian; /* is this data big endian? from the UDataInfo header*/
  59. uint8_t charSetFamily; /* what is the charset family of this data from the UDataInfo header*/
  60. uint8_t contractionUCACombosWidth; /* width of UCA combos field */
  61. UVersionInfo version;
  62. UVersionInfo UCAVersion; /* version of the UCA, read from file */
  63. UVersionInfo UCDVersion; /* UCD version, obtained by u_getUnicodeVersion */
  64. UVersionInfo formatVersion; /* format version from the UDataInfo header */
  65. uint32_t scriptToLeadByte; /* offset to script to lead collation byte mapping data */
  66. uint32_t leadByteToScript; /* offset to lead collation byte to script mapping data */
  67. uint8_t reserved[76]; /* for future use */
  68. } UCATableHeader;
  69. typedef struct {
  70. uint32_t byteSize;
  71. uint32_t tableSize;
  72. uint32_t contsSize;
  73. uint32_t table;
  74. uint32_t conts;
  75. UVersionInfo UCAVersion; /* version of the UCA, read from file */
  76. uint8_t padding[8];
  77. } InverseUCATableHeader;
  78. #endif /* !UCONFIG_NO_COLLATION */
  79. #endif /* __UCOL_DATA_H__ */