From 8c07252eda55b07dea9461b39258aa6f30a2651f Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Wed, 27 Jun 2001 21:53:31 +0000 Subject: [PATCH] ICU-1022 quick fix to Solaris / Workshop 6 build problem X-SVN-Rev: 5112 --- icu4c/source/i18n/Makefile.in | 2 +- icu4c/source/i18n/ucol_bld.cpp | 2 - icu4c/source/i18n/ucol_sol.c | 72 ++++++++++++++++++++++++++++++++++ icu4c/source/i18n/ucol_sol.h | 30 ++++++++++++++ icu4c/source/i18n/ucol_tok.cpp | 56 +------------------------- icu4c/source/i18n/ucol_tok.h | 6 +-- 6 files changed, 108 insertions(+), 60 deletions(-) create mode 100644 icu4c/source/i18n/ucol_sol.c create mode 100644 icu4c/source/i18n/ucol_sol.h diff --git a/icu4c/source/i18n/Makefile.in b/icu4c/source/i18n/Makefile.in index 5af531b2eb..49c4c7a629 100644 --- a/icu4c/source/i18n/Makefile.in +++ b/icu4c/source/i18n/Makefile.in @@ -66,7 +66,7 @@ msgfmt.o numfmt.o rbt.o rbt_data.o rbt_pars.o \ rbt_rule.o rbt_set.o simpletz.o smpdtfmt.o \ sortkey.o tblcoll.o timezone.o translit.o \ ubrk.o ucal.o \ -ucol.o ucol_bld.o ucol_elm.o ucol_cnt.o ucol_tok.o ucol_wgt.o ucoleitr.o \ +ucol.o ucol_bld.o ucol_elm.o ucol_cnt.o ucol_sol.o ucol_tok.o ucol_wgt.o ucoleitr.o \ udat.o umsg.o \ unifltlg.o unirange.o uniset.o unitohex.o unum.o \ dbbi.o dbbi_tbl.o rbbi.o rbbi_tbl.o brkdict.o nultrans.o jamohang.o hangjamo.o \ diff --git a/icu4c/source/i18n/ucol_bld.cpp b/icu4c/source/i18n/ucol_bld.cpp index 9d65ac05b0..7a7c1767cc 100644 --- a/icu4c/source/i18n/ucol_bld.cpp +++ b/icu4c/source/i18n/ucol_bld.cpp @@ -19,7 +19,6 @@ #include "ucol_bld.h" -static const UChar *rulesToParse = 0; static const InverseTableHeader* invUCA = NULL; static UBool U_CALLCONV @@ -854,7 +853,6 @@ UCATableHeader *ucol_assembleTailoringTable(UColTokenParser *src, UErrorCode *st boundaries except where there is only a single-byte primary. That is to ensure that the script reordering will continue to work. */ - rulesToParse = src->source; UCATableHeader *image = (UCATableHeader *)uprv_malloc(sizeof(UCATableHeader)); uprv_memcpy(image, src->UCA->image, sizeof(UCATableHeader)); diff --git a/icu4c/source/i18n/ucol_sol.c b/icu4c/source/i18n/ucol_sol.c new file mode 100644 index 0000000000..48ec7133c8 --- /dev/null +++ b/icu4c/source/i18n/ucol_sol.c @@ -0,0 +1,72 @@ +/* +******************************************************************************* +* +* Copyright (C) 2001, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: ucol_sol.c +* encoding: US-ASCII +* tab size: 8 (not used) +* indentation:4 +* +* created 06/27/2001 +* created by: Vladimir Weinstein +* +* Just trying to help Paul Grinberg compile on Solaris 8 using Workshop 6 compiler +* +*/ + +#include "ucol_sol.h" +#include "ucol_tok.h" + +int32_t +uhash_hashTokens(const void *k) { + int32_t hash = 0; + if (k != NULL) { + uint32_t key = (uint32_t)k; + int32_t len = (key & 0xFF000000)>>24; + int32_t inc = ((len - 32) / 32) + 1; + + const UChar *p = (key & 0x00FFFFFF) + rulesToParse; + const UChar *limit = p + len; + + while (p> 24); + uint32_t s2L = ((p2 & 0xFF000000) >> 24); + const UChar *end = s1+s1L-1; + + if (p1 == p2) { + return TRUE; + } + if (p1 == 0 || p2 == 0) { + return FALSE; + } + if(s1L != s2L) { + return FALSE; + } + if(p1 == p2) { + return TRUE; + } + while((s1 < end) && *s1 == *s2) { + ++s1; + ++s2; + } + if(*s1 == *s2) { + return TRUE; + } else { + return FALSE; + } +} diff --git a/icu4c/source/i18n/ucol_sol.h b/icu4c/source/i18n/ucol_sol.h new file mode 100644 index 0000000000..66261d4852 --- /dev/null +++ b/icu4c/source/i18n/ucol_sol.h @@ -0,0 +1,30 @@ +/* +******************************************************************************* +* +* Copyright (C) 2001, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: ucol_sol.h +* encoding: US-ASCII +* tab size: 8 (not used) +* indentation:4 +* +* created 06/27/2001 +* created by: Vladimir Weinstein +* +* Just trying to help Paul Grinberg compile on Solaris 8 using Workshop 6 compiler +* +*/ + +#ifndef UCOL_SOL_H +#define UCOL_SOL_H + +#include "unicode/utypes.h" + +U_CFUNC int32_t uhash_hashTokens(const void *k); +U_CFUNC UBool uhash_compareTokens(const void *key1, const void *key2); + +#endif + + diff --git a/icu4c/source/i18n/ucol_tok.cpp b/icu4c/source/i18n/ucol_tok.cpp index 0d2d4cb6f5..66b7af1717 100644 --- a/icu4c/source/i18n/ucol_tok.cpp +++ b/icu4c/source/i18n/ucol_tok.cpp @@ -24,61 +24,9 @@ #include "cmemory.h" #include "ucol_tok.h" #include "ucmp32.h" +#include "ucol_sol.h" +extern const UChar *rulesToParse = 0; -static const UChar *rulesToParse = 0; - -/* will use a small structure, tokHash */ - -int32_t -uhash_hashTokens(const void *k) { - int32_t hash = 0; - if (k != NULL) { - const uint32_t key = (const uint32_t)k; - int32_t len = (key & 0xFF000000)>>24; - int32_t inc = ((len - 32) / 32) + 1; - - const UChar *p = (key & 0x00FFFFFF) + rulesToParse; - const UChar *limit = p + len; - - while (p> 24); - uint32_t s2L = ((p2 & 0xFF000000) >> 24); - - if (p1 == p2) { - return TRUE; - } - if (p1 == 0 || p2 == 0) { - return FALSE; - } - if(s1L != s2L) { - return FALSE; - } - if(p1 == p2) { - return TRUE; - } - const UChar *end = s1+s1L-1; - while((s1 < end) && *s1 == *s2) { - ++s1; - ++s2; - } - if(*s1 == *s2) { - return TRUE; - } else { - return FALSE; - } -} void deleteToken(void *token) { UColToken *tok = (UColToken *)token; diff --git a/icu4c/source/i18n/ucol_tok.h b/icu4c/source/i18n/ucol_tok.h index 2a76064e1b..115a8d2b1a 100644 --- a/icu4c/source/i18n/ucol_tok.h +++ b/icu4c/source/i18n/ucol_tok.h @@ -119,8 +119,6 @@ void deleteToken(void *token); void ucol_uprv_tok_setOptionInImage(UColOptionSet *opts, UColAttribute attrib, UColAttributeValue value); UBool ucol_uprv_tok_readAndSetOption(UColOptionSet *opts, const UChar* start, const UChar *end, UBool *variableTop, UBool *top, UErrorCode *status); -int32_t uhash_hashTokens(const void *k); -UBool uhash_compareTokens(const void *key1, const void *key2); void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint32_t rulesLength, UCollator *UCA, UErrorCode *status); uint32_t ucol_uprv_tok_assembleTokenList(UColTokenParser *src, UErrorCode *status); U_CAPI const UChar U_EXPORT2 *ucol_tok_parseNextToken(UColTokenParser *src, @@ -130,8 +128,10 @@ U_CAPI const UChar U_EXPORT2 *ucol_tok_parseNextToken(UColTokenParser *src, uint8_t *specs, UBool startOfRules, UErrorCode *status); - +extern const UChar* rulesToParse; #endif + +