mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Issue #1971 - Part 2: Update ICU source to 63.2.
This commit is contained in:
parent
8df84683be
commit
1e69214382
3160 changed files with 275815 additions and 234203 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* file name: stringtriebuilder.h
|
||||
* encoding: US-ASCII
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
|
|
@ -26,8 +26,10 @@
|
|||
*/
|
||||
|
||||
// Forward declaration.
|
||||
/// \cond
|
||||
struct UHashtable;
|
||||
typedef struct UHashtable UHashtable;
|
||||
/// \endcond
|
||||
|
||||
/**
|
||||
* Build options for BytesTrieBuilder and CharsTrieBuilder.
|
||||
|
|
@ -64,7 +66,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
|
|||
public:
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/** @internal */
|
||||
static UBool hashNode(const void *node);
|
||||
static int32_t hashNode(const void *node);
|
||||
/** @internal */
|
||||
static UBool equalNodes(const void *left, const void *right);
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
|
@ -105,7 +107,7 @@ protected:
|
|||
/** @internal */
|
||||
virtual int32_t getElementStringLength(int32_t i) const = 0;
|
||||
/** @internal */
|
||||
virtual UChar getElementUnit(int32_t i, int32_t unitIndex) const = 0;
|
||||
virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const = 0;
|
||||
/** @internal */
|
||||
virtual int32_t getElementValue(int32_t i) const = 0;
|
||||
|
||||
|
|
@ -120,7 +122,7 @@ protected:
|
|||
/** @internal */
|
||||
virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const = 0;
|
||||
/** @internal */
|
||||
virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, UChar unit) const = 0;
|
||||
virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const = 0;
|
||||
|
||||
/** @internal */
|
||||
virtual UBool matchNodesCanHaveValues() const = 0;
|
||||
|
|
@ -137,7 +139,7 @@ protected:
|
|||
/** @internal */
|
||||
static const int32_t kMaxBranchLinearSubNodeLength=5;
|
||||
|
||||
// Maximum number of nested split-branch levels for a branch on all 2^16 possible UChar units.
|
||||
// Maximum number of nested split-branch levels for a branch on all 2^16 possible char16_t units.
|
||||
// log2(2^16/kMaxBranchLinearSubNodeLength) rounded up.
|
||||
/** @internal */
|
||||
static const int32_t kMaxSplitBranchLevels=14;
|
||||
|
|
@ -188,7 +190,10 @@ protected:
|
|||
|
||||
// Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
|
||||
// it is needed for layout of other objects.
|
||||
/** @internal */
|
||||
/**
|
||||
* @internal
|
||||
* \cond
|
||||
*/
|
||||
class Node : public UObject {
|
||||
public:
|
||||
Node(int32_t initialHash) : hash(initialHash), offset(0) {}
|
||||
|
|
@ -256,7 +261,7 @@ protected:
|
|||
/** @internal */
|
||||
class FinalValueNode : public Node {
|
||||
public:
|
||||
FinalValueNode(int32_t v) : Node(0x111111*37+v), value(v) {}
|
||||
FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {}
|
||||
virtual UBool operator==(const Node &other) const;
|
||||
virtual void write(StringTrieBuilder &builder);
|
||||
protected:
|
||||
|
|
@ -276,7 +281,7 @@ protected:
|
|||
void setValue(int32_t v) {
|
||||
hasValue=TRUE;
|
||||
value=v;
|
||||
hash=hash*37+v;
|
||||
hash=hash*37u+v;
|
||||
}
|
||||
protected:
|
||||
UBool hasValue;
|
||||
|
|
@ -290,7 +295,7 @@ protected:
|
|||
class IntermediateValueNode : public ValueNode {
|
||||
public:
|
||||
IntermediateValueNode(int32_t v, Node *nextNode)
|
||||
: ValueNode(0x222222*37+hashCode(nextNode)), next(nextNode) { setValue(v); }
|
||||
: ValueNode(0x222222u*37u+hashCode(nextNode)), next(nextNode) { setValue(v); }
|
||||
virtual UBool operator==(const Node &other) const;
|
||||
virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
|
||||
virtual void write(StringTrieBuilder &builder);
|
||||
|
|
@ -307,7 +312,7 @@ protected:
|
|||
class LinearMatchNode : public ValueNode {
|
||||
public:
|
||||
LinearMatchNode(int32_t len, Node *nextNode)
|
||||
: ValueNode((0x333333*37+len)*37+hashCode(nextNode)),
|
||||
: ValueNode((0x333333u*37u+len)*37u+hashCode(nextNode)),
|
||||
length(len), next(nextNode) {}
|
||||
virtual UBool operator==(const Node &other) const;
|
||||
virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
|
||||
|
|
@ -338,25 +343,25 @@ protected:
|
|||
virtual void write(StringTrieBuilder &builder);
|
||||
// Adds a unit with a final value.
|
||||
void add(int32_t c, int32_t value) {
|
||||
units[length]=(UChar)c;
|
||||
units[length]=(char16_t)c;
|
||||
equal[length]=NULL;
|
||||
values[length]=value;
|
||||
++length;
|
||||
hash=(hash*37+c)*37+value;
|
||||
hash=(hash*37u+c)*37u+value;
|
||||
}
|
||||
// Adds a unit which leads to another match node.
|
||||
void add(int32_t c, Node *node) {
|
||||
units[length]=(UChar)c;
|
||||
units[length]=(char16_t)c;
|
||||
equal[length]=node;
|
||||
values[length]=0;
|
||||
++length;
|
||||
hash=(hash*37+c)*37+hashCode(node);
|
||||
hash=(hash*37u+c)*37u+hashCode(node);
|
||||
}
|
||||
protected:
|
||||
Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value".
|
||||
int32_t length;
|
||||
int32_t values[kMaxBranchLinearSubNodeLength];
|
||||
UChar units[kMaxBranchLinearSubNodeLength];
|
||||
char16_t units[kMaxBranchLinearSubNodeLength];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -364,15 +369,15 @@ protected:
|
|||
*/
|
||||
class SplitBranchNode : public BranchNode {
|
||||
public:
|
||||
SplitBranchNode(UChar middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
|
||||
: BranchNode(((0x555555*37+middleUnit)*37+
|
||||
hashCode(lessThanNode))*37+hashCode(greaterOrEqualNode)),
|
||||
SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
|
||||
: BranchNode(((0x555555u*37u+middleUnit)*37u+
|
||||
hashCode(lessThanNode))*37u+hashCode(greaterOrEqualNode)),
|
||||
unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {}
|
||||
virtual UBool operator==(const Node &other) const;
|
||||
virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
|
||||
virtual void write(StringTrieBuilder &builder);
|
||||
protected:
|
||||
UChar unit;
|
||||
char16_t unit;
|
||||
Node *lessThan;
|
||||
Node *greaterOrEqual;
|
||||
};
|
||||
|
|
@ -382,7 +387,7 @@ protected:
|
|||
class BranchHeadNode : public ValueNode {
|
||||
public:
|
||||
BranchHeadNode(int32_t len, Node *subNode)
|
||||
: ValueNode((0x666666*37+len)*37+hashCode(subNode)),
|
||||
: ValueNode((0x666666u*37u+len)*37u+hashCode(subNode)),
|
||||
length(len), next(subNode) {}
|
||||
virtual UBool operator==(const Node &other) const;
|
||||
virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
|
||||
|
|
@ -391,7 +396,9 @@ protected:
|
|||
int32_t length;
|
||||
Node *next; // A branch sub-node.
|
||||
};
|
||||
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
/// \endcond
|
||||
|
||||
/** @internal */
|
||||
virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue