ICU-1022 quick fix to Solaris / Workshop 6 build problem

X-SVN-Rev: 5112
This commit is contained in:
Vladimir Weinstein 2001-06-27 21:53:31 +00:00
parent 7c92dbd460
commit 8c07252eda
6 changed files with 108 additions and 60 deletions

View File

@ -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 \

View File

@ -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));

View File

@ -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<limit) {
hash = (hash * 37) + *p;
p += inc;
}
}
return hash;
}
UBool uhash_compareTokens(const void *key1, const void *key2) {
uint32_t p1 = (uint32_t) key1;
uint32_t p2 = (uint32_t) key2;
const UChar *s1 = (p1 & 0x00FFFFFF) + rulesToParse;
const UChar *s2 = (p2 & 0x00FFFFFF) + rulesToParse;
uint32_t s1L = ((p1 & 0xFF000000) >> 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;
}
}

View File

@ -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

View File

@ -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<limit) {
hash = (hash * 37) + *p;
p += inc;
}
}
return hash;
}
UBool uhash_compareTokens(const void *key1, const void *key2) {
const uint32_t p1 = (const uint32_t) key1;
const uint32_t p2 = (const uint32_t) key2;
const UChar *s1 = (p1 & 0x00FFFFFF) + rulesToParse;
const UChar *s2 = (p2 & 0x00FFFFFF) + rulesToParse;
uint32_t s1L = ((p1 & 0xFF000000) >> 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;

View File

@ -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