aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-10-29 01:05:01 +0800
committerFelix Lange <fjl@twurst.com>2016-10-29 01:05:01 +0800
commit289b30715d097edafd5562f66cb3567a70b2d330 (patch)
tree7eaaa6da97c84727469303b986e364606ece57ce /Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go
parent77703045765343c489ded2f43e3ed0f332c5f148 (diff)
downloaddexon-289b30715d097edafd5562f66cb3567a70b2d330.tar
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.gz
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.bz2
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.lz
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.xz
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.zst
dexon-289b30715d097edafd5562f66cb3567a70b2d330.zip
Godeps, vendor: convert dependency management to trash (#3198)
This commit converts the dependency management from Godeps to the vendor folder, also switching the tool from godep to trash. Since the upstream tool lacks a few features proposed via a few PRs, until those PRs are merged in (if), use github.com/karalabe/trash. You can update dependencies via trash --update. All dependencies have been updated to their latest version. Parts of the build system are reworked to drop old notions of Godeps and invocation of the go vet command so that it doesn't run against the vendor folder, as that will just blow up during vetting. The conversion drops OpenCL (and hence GPU mining support) from ethash and our codebase. The short reasoning is that there's noone to maintain and having opencl libs in our deps messes up builds as go install ./... tries to build them, failing with unsatisfied link errors for the C OpenCL deps. golang.org/x/net/context is not vendored in. We expect it to be fetched by the user (i.e. using go get). To keep ci.go builds reproducible the package is "vendored" in build/_vendor.
Diffstat (limited to 'Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go')
-rw-r--r--Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go209
1 files changed, 0 insertions, 209 deletions
diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go b/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go
deleted file mode 100644
index 2a953075d..000000000
--- a/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// 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.
-
-//go:generate go run maketables.go
-
-// Package charmap provides simple character encodings such as IBM Code Page 437
-// and Windows 1252.
-package charmap
-
-import (
- "unicode/utf8"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal"
- "golang.org/x/text/encoding/internal/identifier"
- "golang.org/x/text/transform"
-)
-
-// These encodings vary only in the way clients should interpret them. Their
-// coded character set is identical and a single implementation can be shared.
-var (
- // ISO8859_6E is the ISO 8859-6E encoding.
- ISO8859_6E encoding.Encoding = &iso8859_6E
-
- // ISO8859_6I is the ISO 8859-6I encoding.
- ISO8859_6I encoding.Encoding = &iso8859_6I
-
- // ISO8859_8E is the ISO 8859-8E encoding.
- ISO8859_8E encoding.Encoding = &iso8859_8E
-
- // ISO8859_8I is the ISO 8859-8I encoding.
- ISO8859_8I encoding.Encoding = &iso8859_8I
-
- iso8859_6E = internal.Encoding{
- ISO8859_6,
- "ISO-8859-6E",
- identifier.ISO88596E,
- }
-
- iso8859_6I = internal.Encoding{
- ISO8859_6,
- "ISO-8859-6I",
- identifier.ISO88596I,
- }
-
- iso8859_8E = internal.Encoding{
- ISO8859_8,
- "ISO-8859-8E",
- identifier.ISO88598E,
- }
-
- iso8859_8I = internal.Encoding{
- ISO8859_8,
- "ISO-8859-8I",
- identifier.ISO88598I,
- }
-)
-
-// All is a list of all defined encodings in this package.
-var All = listAll
-
-// TODO: implement these encodings, in order of importance.
-// ASCII, ISO8859_1: Rather common. Close to Windows 1252.
-// ISO8859_9: Close to Windows 1254.
-
-// utf8Enc holds a rune's UTF-8 encoding in data[:len].
-type utf8Enc struct {
- len uint8
- data [3]byte
-}
-
-// charmap describes an 8-bit character set encoding.
-type charmap struct {
- // name is the encoding's name.
- name string
- // mib is the encoding type of this encoder.
- mib identifier.MIB
- // asciiSuperset states whether the encoding is a superset of ASCII.
- asciiSuperset bool
- // low is the lower bound of the encoded byte for a non-ASCII rune. If
- // charmap.asciiSuperset is true then this will be 0x80, otherwise 0x00.
- low uint8
- // replacement is the encoded replacement character.
- replacement byte
- // decode is the map from encoded byte to UTF-8.
- decode [256]utf8Enc
- // encoding is the map from runes to encoded bytes. Each entry is a
- // uint32: the high 8 bits are the encoded byte and the low 24 bits are
- // the rune. The table entries are sorted by ascending rune.
- encode [256]uint32
-}
-
-func (m *charmap) NewDecoder() *encoding.Decoder {
- return &encoding.Decoder{Transformer: charmapDecoder{charmap: m}}
-}
-
-func (m *charmap) NewEncoder() *encoding.Encoder {
- return &encoding.Encoder{Transformer: charmapEncoder{charmap: m}}
-}
-
-func (m *charmap) String() string {
- return m.name
-}
-
-func (m *charmap) ID() (mib identifier.MIB, other string) {
- return m.mib, ""
-}
-
-// charmapDecoder implements transform.Transformer by decoding to UTF-8.
-type charmapDecoder struct {
- transform.NopResetter
- charmap *charmap
-}
-
-func (m charmapDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- for i, c := range src {
- if m.charmap.asciiSuperset && c < utf8.RuneSelf {
- if nDst >= len(dst) {
- err = transform.ErrShortDst
- break
- }
- dst[nDst] = c
- nDst++
- nSrc = i + 1
- continue
- }
-
- decode := &m.charmap.decode[c]
- n := int(decode.len)
- if nDst+n > len(dst) {
- err = transform.ErrShortDst
- break
- }
- // It's 15% faster to avoid calling copy for these tiny slices.
- for j := 0; j < n; j++ {
- dst[nDst] = decode.data[j]
- nDst++
- }
- nSrc = i + 1
- }
- return nDst, nSrc, err
-}
-
-// charmapEncoder implements transform.Transformer by encoding from UTF-8.
-type charmapEncoder struct {
- transform.NopResetter
- charmap *charmap
-}
-
-func (m charmapEncoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- r, size := rune(0), 0
-loop:
- for nSrc < len(src) {
- if nDst >= len(dst) {
- err = transform.ErrShortDst
- break
- }
- r = rune(src[nSrc])
-
- // Decode a 1-byte rune.
- if r < utf8.RuneSelf {
- if m.charmap.asciiSuperset {
- nSrc++
- dst[nDst] = uint8(r)
- nDst++
- continue
- }
- size = 1
-
- } else {
- // Decode a multi-byte rune.
- r, size = utf8.DecodeRune(src[nSrc:])
- if size == 1 {
- // All valid runes of size 1 (those below utf8.RuneSelf) were
- // handled above. We have invalid UTF-8 or we haven't seen the
- // full character yet.
- if !atEOF && !utf8.FullRune(src[nSrc:]) {
- err = transform.ErrShortSrc
- } else {
- err = internal.RepertoireError(m.charmap.replacement)
- }
- break
- }
- }
-
- // Binary search in [low, high) for that rune in the m.charmap.encode table.
- for low, high := int(m.charmap.low), 0x100; ; {
- if low >= high {
- err = internal.RepertoireError(m.charmap.replacement)
- break loop
- }
- mid := (low + high) / 2
- got := m.charmap.encode[mid]
- gotRune := rune(got & (1<<24 - 1))
- if gotRune < r {
- low = mid + 1
- } else if gotRune > r {
- high = mid
- } else {
- dst[nDst] = byte(got >> 24)
- nDst++
- break
- }
- }
- nSrc += size
- }
- return nDst, nSrc, err
-}