1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
8 // TODO: no longer necessary. Remove at some point.
13 "golang.org/x/text/internal/colltab"
17 defaultSecondary = 0x20
22 Primary, Secondary, Tertiary, Quaternary int
25 func W(ce ...int) Weights {
26 w := Weights{ce[0], defaultSecondary, defaultTertiary, 0}
38 func (w Weights) String() string {
39 return fmt.Sprintf("[%X.%X.%X.%X]", w.Primary, w.Secondary, w.Tertiary, w.Quaternary)
42 func convertFromWeights(ws []Weights) []colltab.Elem {
43 out := make([]colltab.Elem, len(ws))
44 for i, w := range ws {
45 out[i], _ = colltab.MakeElem(w.Primary, w.Secondary, w.Tertiary, 0)
46 if out[i] == colltab.Ignore && w.Quaternary > 0 {
47 out[i] = colltab.MakeQuaternary(w.Quaternary)