]> granicus.if.org Git - icu/commitdiff
ICU-8619 move some collation file data structure definitions from i18n/ucol_imp.h...
authorMarkus Scherer <markus.icu@gmail.com>
Sun, 3 Jul 2011 04:07:02 +0000 (04:07 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Sun, 3 Jul 2011 04:07:02 +0000 (04:07 +0000)
X-SVN-Rev: 30271

icu4c/source/common/Makefile.in
icu4c/source/common/common.vcxproj
icu4c/source/common/common.vcxproj.filters
icu4c/source/common/ucol_data.h [new file with mode: 0644]
icu4c/source/common/ucol_swp.cpp
icu4c/source/i18n/ucol_imp.h

index 998a18922f842a206032904e56d2f2272a7967d4..9e8d81facbd85594c073e4dcbeda020db5610a9e 100644 (file)
@@ -60,7 +60,7 @@ CXXFLAGS += $(LIBCXXFLAGS)
 ifneq ($(top_builddir),$(top_srcdir))
 CPPFLAGS += -I$(top_builddir)/common
 endif
-CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/i18n $(LIBCPPFLAGS) $(CPPFLAGSICUUC)
+CPPFLAGS += -I$(srcdir) $(LIBCPPFLAGS) $(CPPFLAGSICUUC)
 # we want DEFS here, because we want icucfg.h
 DEFS += -DU_COMMON_IMPLEMENTATION -DU_HAVE_ICUCFG 
 LDFLAGS += $(LDFLAGSICUUC)
index e0484bd9867efc8b86607345efbdb695c71d75ee..fc22849a95bc2236ac40774996da3846e136ce7b 100644 (file)
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\include\unicode\%(Filename)%(Extension);%(Outputs)</Outputs>\r
     </CustomBuild>\r
     <ClInclude Include="ubrkimpl.h" />\r
+    <ClInclude Include="ucol_data.h" />\r
     <ClInclude Include="ucol_swp.h" />\r
     <ClInclude Include="hash.h" />\r
     <ClInclude Include="propsvec.h" />\r
index 292b171183c70fe27bfe0594ed9e3398eadd329d..fa30c48de2aac6be438cf9b7c01027c92e574279 100644 (file)
     <ClInclude Include="ubrkimpl.h">\r
       <Filter>break iteration</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="ucol_data.h">\r
+      <Filter>collation</Filter>\r
+    </ClInclude>\r
     <ClInclude Include="ucol_swp.h">\r
       <Filter>collation</Filter>\r
     </ClInclude>\r
diff --git a/icu4c/source/common/ucol_data.h b/icu4c/source/common/ucol_data.h
new file mode 100644 (file)
index 0000000..0230646
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+*******************************************************************************
+*   Copyright (C) 2000-2011, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*******************************************************************************
+*   file name:  ucol_data.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2011jul02
+*   created by: Markus Scherer
+*
+* Private implementation header for C/C++ collation.
+* Some file data structure definitions were moved here from i18n/ucol_imp.h
+* so that the common library (via ucol_swp.cpp) need not depend on the i18n library at all.
+*
+* We do not want to move the collation swapper to the i18n library because
+* a) the resource bundle swapper depends on it and would have to move too, and
+* b) we might want to eventually implement runtime data swapping,
+*    which might (or might not) be easier if all swappers are in the common library.
+*/
+
+#ifndef __UCOL_DATA_H__
+#define __UCOL_DATA_H__
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_COLLATION
+
+/* let us know whether reserved fields are reset to zero or junked */
+#define UCOL_HEADER_MAGIC 0x20030618
+
+typedef struct {
+      int32_t size;
+      /* all the offsets are in bytes */
+      /* to get the address add to the header address and cast properly */
+      uint32_t options; /* these are the default options for the collator */
+      uint32_t UCAConsts; /* structure which holds values for indirect positioning and implicit ranges */
+      uint32_t contractionUCACombos;        /* this one is needed only for UCA, to copy the appropriate contractions */
+      uint32_t magic;            /* magic number - lets us know whether reserved data is reset or junked */
+      uint32_t mappingPosition;  /* const uint8_t *mappingPosition; */
+      uint32_t expansion;        /* uint32_t *expansion;            */
+      uint32_t contractionIndex; /* UChar *contractionIndex;        */
+      uint32_t contractionCEs;   /* uint32_t *contractionCEs;       */
+      uint32_t contractionSize;  /* needed for various closures */
+      /*int32_t latinOneMapping;*/ /* this is now handled in the trie itself *//* fast track to latin1 chars      */
+
+      uint32_t endExpansionCE;      /* array of last collation element in
+                                       expansion */
+      uint32_t expansionCESize;     /* array of maximum expansion size
+                                       corresponding to the expansion
+                                       collation elements with last element
+                                       in endExpansionCE*/
+      int32_t  endExpansionCECount; /* size of endExpansionCE */
+      uint32_t unsafeCP;            /* hash table of unsafe code points */
+      uint32_t contrEndCP;          /* hash table of final code points  */
+                                    /*   in contractions.               */
+
+      int32_t contractionUCACombosSize;     /* number of UCA contraction items. */
+                                            /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(UChar) */
+      UBool jamoSpecial;                    /* is jamoSpecial */
+      UBool isBigEndian;                    /* is this data big endian? from the UDataInfo header*/
+      uint8_t charSetFamily;                /* what is the charset family of this data from the UDataInfo header*/
+      uint8_t contractionUCACombosWidth;    /* width of UCA combos field */
+      UVersionInfo version;
+      UVersionInfo UCAVersion;              /* version of the UCA, read from file */
+      UVersionInfo UCDVersion;              /* UCD version, obtained by u_getUnicodeVersion */
+      UVersionInfo formatVersion;           /* format version from the UDataInfo header */
+      uint32_t scriptToLeadByte;            /* offset to script to lead collation byte mapping data */
+      uint32_t leadByteToScript;            /* offset to lead collation byte to script mapping data */
+      uint8_t reserved[76];                 /* for future use */
+} UCATableHeader;
+
+typedef struct {
+  uint32_t byteSize;
+  uint32_t tableSize;
+  uint32_t contsSize;
+  uint32_t table;
+  uint32_t conts;
+  UVersionInfo UCAVersion;              /* version of the UCA, read from file */
+  uint8_t padding[8];
+} InverseUCATableHeader;
+
+#endif  /* !UCONFIG_NO_COLLATION */
+
+#endif  /* __UCOL_DATA_H__ */
index c59a610ba50f5f056535b6e6e6ff247f633648cb..b4ced0ea9291ed0b9729e8c67dffc97c1fe1073c 100644 (file)
@@ -1,11 +1,11 @@
 /*
 *******************************************************************************
 *
-*   Copyright (C) 2003-2010, International Business Machines
+*   Copyright (C) 2003-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
-*   file name:  ucol_swp.c
+*   file name:  ucol_swp.cpp
 *   encoding:   US-ASCII
 *   tab size:   8 (not used)
 *   indentation:4
@@ -20,7 +20,7 @@
 #include "utrie.h"
 #include "udataswp.h"
 #include "cmemory.h"
-#include "ucol_imp.h"
+#include "ucol_data.h"
 #include "ucol_swp.h"
 
 /* swapping ----------------------------------------------------------------- */
index 6637be8efa85f843039cb9b9c3570e97eac9fd4b..5249021bd3641d56df7069ca6201f172e1a3f252 100644 (file)
@@ -46,6 +46,7 @@
 #include "unicode/unistr.h"
 #endif
 #include "unicode/ucol.h"
+#include "ucol_data.h"
 #include "utrie.h"
 #include "cmemory.h"
 
  * Header is followed by the table and continuation table.
 */
 
-/* let us know whether reserved fields are reset to zero or junked */
-#define UCOL_HEADER_MAGIC 0x20030618
+/* definition of UCOL_HEADER_MAGIC moved to common/ucol_data.h */
 
 /* UDataInfo for UCA mapping table */
 /* dataFormat="UCol"            */
@@ -855,46 +855,7 @@ typedef struct {
   uint32_t UCA_PRIMARY_SPECIAL_MAX; /*0xF0000000*/
 } UCAConstants;
 
-typedef struct {
-      int32_t size;
-      /* all the offsets are in bytes */
-      /* to get the address add to the header address and cast properly */
-      uint32_t options; /* these are the default options for the collator */
-      uint32_t UCAConsts; /* structure which holds values for indirect positioning and implicit ranges */
-      uint32_t contractionUCACombos;        /* this one is needed only for UCA, to copy the appropriate contractions */
-      uint32_t magic;            /* magic number - lets us know whether reserved data is reset or junked */
-      uint32_t mappingPosition;  /* const uint8_t *mappingPosition; */
-      uint32_t expansion;        /* uint32_t *expansion;            */
-      uint32_t contractionIndex; /* UChar *contractionIndex;        */
-      uint32_t contractionCEs;   /* uint32_t *contractionCEs;       */
-      uint32_t contractionSize;  /* needed for various closures */
-      /*int32_t latinOneMapping;*/ /* this is now handled in the trie itself *//* fast track to latin1 chars      */
-
-      uint32_t endExpansionCE;      /* array of last collation element in
-                                       expansion */
-      uint32_t expansionCESize;     /* array of maximum expansion size
-                                       corresponding to the expansion
-                                       collation elements with last element
-                                       in endExpansionCE*/
-      int32_t  endExpansionCECount; /* size of endExpansionCE */
-      uint32_t unsafeCP;            /* hash table of unsafe code points */
-      uint32_t contrEndCP;          /* hash table of final code points  */
-                                    /*   in contractions.               */
-
-      int32_t contractionUCACombosSize;     /* number of UCA contraction items. */
-                                            /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(UChar) */
-      UBool jamoSpecial;                    /* is jamoSpecial */
-      UBool isBigEndian;                    /* is this data big endian? from the UDataInfo header*/
-      uint8_t charSetFamily;                /* what is the charset family of this data from the UDataInfo header*/
-      uint8_t contractionUCACombosWidth;    /* width of UCA combos field */
-      UVersionInfo version;
-      UVersionInfo UCAVersion;              /* version of the UCA, read from file */
-      UVersionInfo UCDVersion;              /* UCD version, obtained by u_getUnicodeVersion */
-      UVersionInfo formatVersion;           /* format version from the UDataInfo header */
-      uint32_t scriptToLeadByte;            /* offset to script to lead collation byte mapping data */
-      uint32_t leadByteToScript;            /* offset to lead collation byte to script mapping data */
-      uint8_t reserved[76];                 /* for future use */
-} UCATableHeader;
+/* definition of UCATableHeader moved to common/ucol_data.h */
 
 #define U_UNKNOWN_STATE 0
 #define U_COLLATOR_STATE 0x01
@@ -965,15 +926,7 @@ typedef struct {
 
 U_CDECL_BEGIN
 
-typedef struct {
-  uint32_t byteSize;
-  uint32_t tableSize;
-  uint32_t contsSize;
-  uint32_t table;
-  uint32_t conts;
-  UVersionInfo UCAVersion;              /* version of the UCA, read from file */
-  uint8_t padding[8];
-} InverseUCATableHeader;
+/* definition of InverseUCATableHeader moved to common/ucol_data.h */
 
 typedef void U_CALLCONV
 ResourceCleaner(UCollator *coll);