index.go 995 Bytes
Newer Older
Jeromy's avatar
Jeromy committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package collate

// tableIndex holds information for constructing a table
// for a certain locale based on the main table.
type tableIndex struct {
	lookupOffset uint32
	valuesOffset uint32
}

func (t tableIndex) TrieIndex() []uint16 {
	return mainLookup[:]
}

func (t tableIndex) TrieValues() []uint32 {
	return mainValues[:]
}

func (t tableIndex) FirstBlockOffsets() (lookup, value uint16) {
	return uint16(t.lookupOffset), uint16(t.valuesOffset)
}

func (t tableIndex) ExpandElems() []uint32 {
	return mainExpandElem[:]
}

func (t tableIndex) ContractTries() []struct{ l, h, n, i uint8 } {
	return mainCTEntries[:]
}

func (t tableIndex) ContractElems() []uint32 {
	return mainContractElem[:]
}

func (t tableIndex) MaxContractLen() int {
	return 18 // TODO: generate
}

func (t tableIndex) VariableTop() uint32 {
	return varTop
}