summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/text/unicode/norm/maketables.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-06-16 23:33:25 +0200
committerGitHub <noreply@github.com>2019-06-16 23:33:25 +0200
commitcb712ff37d3c20a21695e00c52fff213a6fd40b4 (patch)
tree0ba0ee4f55bf6ace2656562465cc82d807e741b9 /vendor/golang.org/x/text/unicode/norm/maketables.go
parentf4ae61044888f591830e6c1be9a2bdb14f88943e (diff)
downloadmatterbridge-msglm-cb712ff37d3c20a21695e00c52fff213a6fd40b4.tar.gz
matterbridge-msglm-cb712ff37d3c20a21695e00c52fff213a6fd40b4.tar.bz2
matterbridge-msglm-cb712ff37d3c20a21695e00c52fff213a6fd40b4.zip
Update vendor (#852)
Diffstat (limited to 'vendor/golang.org/x/text/unicode/norm/maketables.go')
-rw-r--r--vendor/golang.org/x/text/unicode/norm/maketables.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/vendor/golang.org/x/text/unicode/norm/maketables.go b/vendor/golang.org/x/text/unicode/norm/maketables.go
index 338c395e..30a3aa93 100644
--- a/vendor/golang.org/x/text/unicode/norm/maketables.go
+++ b/vendor/golang.org/x/text/unicode/norm/maketables.go
@@ -12,6 +12,7 @@ package main
import (
"bytes"
+ "encoding/binary"
"flag"
"fmt"
"io"
@@ -261,7 +262,7 @@ func compactCCC() {
// CompositionExclusions.txt has form:
// 0958 # ...
-// See http://unicode.org/reports/tr44/ for full explanation
+// See https://unicode.org/reports/tr44/ for full explanation
func loadCompositionExclusions() {
f := gen.OpenUCDFile("CompositionExclusions.txt")
defer f.Close()
@@ -735,6 +736,8 @@ func makeTables() {
max = n
}
}
+ fmt.Fprintln(w, `import "sync"`)
+ fmt.Fprintln(w)
fmt.Fprintln(w, "const (")
fmt.Fprintln(w, "\t// Version is the Unicode edition from which the tables are derived.")
@@ -782,16 +785,23 @@ func makeTables() {
sz := nrentries * 8
size += sz
fmt.Fprintf(w, "// recompMap: %d bytes (entries only)\n", sz)
- fmt.Fprintln(w, "var recompMap = map[uint32]rune{")
+ fmt.Fprintln(w, "var recompMap map[uint32]rune")
+ fmt.Fprintln(w, "var recompMapOnce sync.Once\n")
+ fmt.Fprintln(w, `const recompMapPacked = "" +`)
+ var buf [8]byte
for i, c := range chars {
f := c.forms[FCanonical]
d := f.decomp
if !f.isOneWay && len(d) > 0 {
key := uint32(uint16(d[0]))<<16 + uint32(uint16(d[1]))
- fmt.Fprintf(w, "0x%.8X: 0x%.4X,\n", key, i)
+ binary.BigEndian.PutUint32(buf[:4], key)
+ binary.BigEndian.PutUint32(buf[4:], uint32(i))
+ fmt.Fprintf(w, "\t\t%q + // 0x%.8X: 0x%.8X\n", string(buf[:]), key, uint32(i))
}
}
- fmt.Fprintf(w, "}\n\n")
+ // hack so we don't have to special case the trailing plus sign
+ fmt.Fprintf(w, ` ""`)
+ fmt.Fprintln(w)
}
fmt.Fprintf(w, "// Total size of tables: %dKB (%d bytes)\n", (size+512)/1024, size)
@@ -857,7 +867,7 @@ func verifyComputed() {
// DerivedNormalizationProps.txt has form:
// 00C0..00C5 ; NFD_QC; N # ...
// 0374 ; NFD_QC; N # ...
-// See http://unicode.org/reports/tr44/ for full explanation
+// See https://unicode.org/reports/tr44/ for full explanation
func testDerived() {
f := gen.OpenUCDFile("DerivedNormalizationProps.txt")
defer f.Close()