Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
c633f85f
Commit
c633f85f
authored
May 30, 2012
by
Marcel van Lohuizen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exp/locale/collate: avoid double building in maketables.go. Also added check.
R=r CC=golang-dev
https://golang.org/cl/6202063
parent
cb9759d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
builder.go
src/pkg/exp/locale/collate/build/builder.go
+15
-8
No files found.
src/pkg/exp/locale/collate/build/builder.go
View file @
c633f85f
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
// - trie valueBlocks are currently 100K. There are a lot of sparse blocks
// - trie valueBlocks are currently 100K. There are a lot of sparse blocks
// and many consecutive values with the same stride. This can be further
// and many consecutive values with the same stride. This can be further
// compacted.
// compacted.
// - compress secondary weights into 8 bits.
// entry is used to keep track of a single entry in the collation element table
// entry is used to keep track of a single entry in the collation element table
// during building. Examples of entries can be found in the Default Unicode
// during building. Examples of entries can be found in the Default Unicode
...
@@ -69,6 +70,7 @@ type Builder struct {
...
@@ -69,6 +70,7 @@ type Builder struct {
entry
[]
*
entry
entry
[]
*
entry
t
*
table
t
*
table
err
error
err
error
built
bool
}
}
// NewBuilder returns a new Builder.
// NewBuilder returns a new Builder.
...
@@ -178,14 +180,16 @@ func (b *Builder) error(e error) {
...
@@ -178,14 +180,16 @@ func (b *Builder) error(e error) {
}
}
func
(
b
*
Builder
)
build
()
(
*
table
,
error
)
{
func
(
b
*
Builder
)
build
()
(
*
table
,
error
)
{
b
.
t
=
&
table
{}
if
!
b
.
built
{
b
.
built
=
true
b
.
contractCJK
()
b
.
t
=
&
table
{}
b
.
simplify
()
// requires contractCJK
b
.
processExpansions
()
// requires simplify
b
.
contractCJK
()
b
.
processContractions
()
// requires simplify
b
.
simplify
()
// requires contractCJK
b
.
buildTrie
()
// requires process*
b
.
processExpansions
()
// requires simplify
b
.
processContractions
()
// requires simplify
b
.
buildTrie
()
// requires process*
}
if
b
.
err
!=
nil
{
if
b
.
err
!=
nil
{
return
nil
,
b
.
err
return
nil
,
b
.
err
}
}
...
@@ -334,6 +338,9 @@ func convertLargeWeights(elems [][]int) (res [][]int, err error) {
...
@@ -334,6 +338,9 @@ func convertLargeWeights(elems [][]int) (res [][]int, err error) {
if
p
<
firstLargePrimary
{
if
p
<
firstLargePrimary
{
continue
continue
}
}
if
p
>
0xFFFF
{
return
elems
,
fmt
.
Errorf
(
"found primary weight %X; should be <= 0xFFFF"
,
p
)
}
if
p
>=
illegalPrimary
{
if
p
>=
illegalPrimary
{
ce
[
0
]
=
illegalOffset
+
p
-
illegalPrimary
ce
[
0
]
=
illegalOffset
+
p
-
illegalPrimary
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment