diff --git a/.gitignore b/.gitignore index 21dbd28c56..e53e461dc6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,7 @@ .ethtest */**/*tx_database* */**/*dapps* -Godeps/_workspace/pkg -Godeps/_workspace/bin +build/_vendor/pkg #* .#* diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index 0fc91e8775..0000000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "ImportPath": "github.com/ethereum/go-ethereum", - "GoVersion": "go1.7", - "GodepVersion": "v74", - "Packages": [ - "./..." - ], - "Deps": [ - { - "ImportPath": "github.com/Gustav-Simonsson/go-opencl/cl", - "Rev": "593e01cfc4f3353585015321e01951d4a907d3ef" - }, - { - "ImportPath": "github.com/cespare/cp", - "Rev": "165db2f241fd235aec29ba6d9b1ccd5f1c14637c" - }, - { - "ImportPath": "github.com/davecgh/go-spew/spew", - "Rev": "5215b55f46b2b919f50a1df0eaa5886afe4e3b3d" - }, - { - "ImportPath": "github.com/ethereum/ethash", - "Comment": "v23.1-247-g2e80de5", - "Rev": "2e80de5022370cfe632195b1720db52d07ff8a77" - }, - { - "ImportPath": "github.com/fatih/color", - "Comment": "v0.1-12-g9aae6aa", - "Rev": "9aae6aaa22315390f03959adca2c4d395b02fcef" - }, - { - "ImportPath": "github.com/gizak/termui", - "Rev": "08a5d3f67b7d9ec87830ea39c48e570a1f18531f" - }, - { - "ImportPath": "github.com/golang/snappy", - "Rev": "799c780093d646c1b79d30894e22512c319fa137" - }, - { - "ImportPath": "github.com/hashicorp/golang-lru", - "Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4" - }, - { - "ImportPath": "github.com/hashicorp/golang-lru/simplelru", - "Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4" - }, - { - "ImportPath": "github.com/huin/goupnp", - "Rev": "46bde78b11f3f021f2a511df138be9e2fc7506e8" - }, - { - "ImportPath": "github.com/huin/goupnp/dcps/internetgateway1", - "Rev": "46bde78b11f3f021f2a511df138be9e2fc7506e8" - }, - { - "ImportPath": "github.com/huin/goupnp/dcps/internetgateway2", - "Rev": "46bde78b11f3f021f2a511df138be9e2fc7506e8" - }, - { - "ImportPath": "github.com/huin/goupnp/httpu", - "Rev": "46bde78b11f3f021f2a511df138be9e2fc7506e8" - }, - { - "ImportPath": "github.com/huin/goupnp/scpd", - "Rev": "46bde78b11f3f021f2a511df138be9e2fc7506e8" - }, - { - "ImportPath": "github.com/huin/goupnp/soap", - "Rev": "46bde78b11f3f021f2a511df138be9e2fc7506e8" - }, - { - "ImportPath": "github.com/huin/goupnp/ssdp", - "Rev": "46bde78b11f3f021f2a511df138be9e2fc7506e8" - }, - { - "ImportPath": "github.com/jackpal/gateway", - "Rev": "192609c58b8985e645cbe82ddcb28a4362ca0fdc" - }, - { - "ImportPath": "github.com/jackpal/go-nat-pmp", - "Rev": "46523a463303c6ede3ddfe45bde1c7ed52ebaacd" - }, - { - "ImportPath": "github.com/mattn/go-colorable", - "Rev": "9fdad7c47650b7d2e1da50644c1f4ba7f172f252" - }, - { - "ImportPath": "github.com/mattn/go-isatty", - "Rev": "56b76bdf51f7708750eac80fa38b952bb9f32639" - }, - { - "ImportPath": "github.com/mattn/go-runewidth", - "Comment": "travisish-44-ge882a96", - "Rev": "e882a96ec18dd43fa283187b66af74497c9101c0" - }, - { - "ImportPath": "github.com/nsf/termbox-go", - "Rev": "362329b0aa6447eadd52edd8d660ec1dff470295" - }, - { - "ImportPath": "github.com/pborman/uuid", - "Comment": "v1.0-6-g0f1a469", - "Rev": "0f1a46960a86dcdf5dd30d3e6568a497a997909f" - }, - { - "ImportPath": "github.com/peterh/liner", - "Rev": "ad1edfd30321d8f006ccf05f1e0524adeb943060" - }, - { - "ImportPath": "github.com/rcrowley/go-metrics", - "Rev": "51425a2415d21afadfd55cd93432c0bc69e9598d" - }, - { - "ImportPath": "github.com/rcrowley/go-metrics/exp", - "Rev": "51425a2415d21afadfd55cd93432c0bc69e9598d" - }, - { - "ImportPath": "github.com/rjeczalik/notify", - "Rev": "f627deca7a510d96f0ef9388f2d0e8b16d21f87f" - }, - { - "ImportPath": "github.com/robertkrimen/otto", - "Rev": "53221230c215611a90762720c9042ac782ef74ee" - }, - { - "ImportPath": "github.com/robertkrimen/otto/ast", - "Rev": "53221230c215611a90762720c9042ac782ef74ee" - }, - { - "ImportPath": "github.com/robertkrimen/otto/dbg", - "Rev": "53221230c215611a90762720c9042ac782ef74ee" - }, - { - "ImportPath": "github.com/robertkrimen/otto/file", - "Rev": "53221230c215611a90762720c9042ac782ef74ee" - }, - { - "ImportPath": "github.com/robertkrimen/otto/parser", - "Rev": "53221230c215611a90762720c9042ac782ef74ee" - }, - { - "ImportPath": "github.com/robertkrimen/otto/registry", - "Rev": "53221230c215611a90762720c9042ac782ef74ee" - }, - { - "ImportPath": "github.com/robertkrimen/otto/token", - "Rev": "53221230c215611a90762720c9042ac782ef74ee" - }, - { - "ImportPath": "github.com/rs/cors", - "Rev": "5950cf11d77f8a61b432a25dd4d444b4ced01379" - }, - { - "ImportPath": "github.com/rs/xhandler", - "Rev": "d9d9599b6aaf6a058cb7b1f48291ded2cbd13390" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/cache", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/comparer", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/errors", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/filter", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/iterator", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/journal", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/memdb", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/opt", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/storage", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/table", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "github.com/syndtr/goleveldb/leveldb/util", - "Rev": "6b4daa5362b502898ddf367c5c11deb9e7a5c727" - }, - { - "ImportPath": "golang.org/x/crypto/pbkdf2", - "Rev": "351dc6a5bf92a5f2ae22fadeee08eb6a45aa2d93" - }, - { - "ImportPath": "golang.org/x/crypto/ripemd160", - "Rev": "351dc6a5bf92a5f2ae22fadeee08eb6a45aa2d93" - }, - { - "ImportPath": "golang.org/x/crypto/scrypt", - "Rev": "351dc6a5bf92a5f2ae22fadeee08eb6a45aa2d93" - }, - { - "ImportPath": "golang.org/x/net/context", - "Rev": "6250b412798208e6c90b03b7c4f226de5aa299e2" - }, - { - "ImportPath": "golang.org/x/net/html", - "Rev": "6250b412798208e6c90b03b7c4f226de5aa299e2" - }, - { - "ImportPath": "golang.org/x/net/html/atom", - "Rev": "6250b412798208e6c90b03b7c4f226de5aa299e2" - }, - { - "ImportPath": "golang.org/x/net/html/charset", - "Rev": "6250b412798208e6c90b03b7c4f226de5aa299e2" - }, - { - "ImportPath": "golang.org/x/net/websocket", - "Rev": "6250b412798208e6c90b03b7c4f226de5aa299e2" - }, - { - "ImportPath": "golang.org/x/sys/unix", - "Rev": "a646d33e2ee3172a661fc09bca23bb4889a41bc8" - }, - { - "ImportPath": "golang.org/x/text/encoding", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/charmap", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/htmlindex", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/internal", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/internal/identifier", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/japanese", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/korean", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/simplifiedchinese", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/traditionalchinese", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/encoding/unicode", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/internal/tag", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/internal/utf8internal", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/language", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/runes", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/text/transform", - "Rev": "d69c40b4be55797923cec7457fac7a244d91a9b6" - }, - { - "ImportPath": "golang.org/x/tools/go/ast/astutil", - "Rev": "9deed8c6c1c89e0b6d68d727f215de8e851d1064" - }, - { - "ImportPath": "golang.org/x/tools/imports", - "Rev": "9deed8c6c1c89e0b6d68d727f215de8e851d1064" - }, - { - "ImportPath": "gopkg.in/check.v1", - "Rev": "4f90aeace3a26ad7021961c297b22c42160c7b25" - }, - { - "ImportPath": "gopkg.in/fatih/set.v0", - "Comment": "v0.1.0-3-g27c4092", - "Rev": "27c40922c40b43fe04554d8223a402af3ea333f3" - }, - { - "ImportPath": "gopkg.in/karalabe/cookiejar.v2/collections/prque", - "Rev": "8dcd6a7f4951f6ff3ee9cbb919a06d8925822e57" - }, - { - "ImportPath": "gopkg.in/natefinch/npipe.v2", - "Rev": "c1b8fa8bdccecb0b8db834ee0b92fdbcfa606dd6" - }, - { - "ImportPath": "gopkg.in/urfave/cli.v1", - "Comment": "v1.17.0", - "Rev": "01857ac33766ce0c93856370626f9799281c14f4" - } - ] -} diff --git a/Godeps/Readme b/Godeps/Readme deleted file mode 100644 index 4cdaa53d56..0000000000 --- a/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. diff --git a/Godeps/_workspace/.gitignore b/Godeps/_workspace/.gitignore deleted file mode 100644 index f037d684ef..0000000000 --- a/Godeps/_workspace/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/pkg -/bin diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/cl.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/cl.go deleted file mode 100644 index 3d577b2b6f..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/cl.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -Package cl provides a binding to the OpenCL api. It's mostly a low-level -wrapper that avoids adding functionality while still making the interface -a little more friendly and easy to use. - -Resource life-cycle management: - -For any CL object that gets created (buffer, queue, kernel, etc..) you should -call object.Release() when finished with it to free the CL resources. This -explicitely calls the related clXXXRelease method for the type. However, -as a fallback there is a finalizer set for every resource item that takes -care of it (eventually) if Release isn't called. In this way you can have -better control over the life cycle of resources while having a fall back -to avoid leaks. This is similar to how file handles and such are handled -in the Go standard packages. -*/ -package cl - -// #include "headers/1.2/opencl.h" -// #cgo CFLAGS: -Iheaders/1.2 -// #cgo darwin LDFLAGS: -framework OpenCL -// #cgo linux LDFLAGS: -lOpenCL -import "C" -import "errors" - -var ErrUnsupported = errors.New("cl: unsupported") diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/context.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/context.go deleted file mode 100644 index 67441bb5f7..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/context.go +++ /dev/null @@ -1,161 +0,0 @@ -package cl - -// #include -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" - -import ( - "runtime" - "unsafe" -) - -const maxImageFormats = 256 - -type Context struct { - clContext C.cl_context - devices []*Device -} - -type MemObject struct { - clMem C.cl_mem - size int -} - -func releaseContext(c *Context) { - if c.clContext != nil { - C.clReleaseContext(c.clContext) - c.clContext = nil - } -} - -func releaseMemObject(b *MemObject) { - if b.clMem != nil { - C.clReleaseMemObject(b.clMem) - b.clMem = nil - } -} - -func newMemObject(mo C.cl_mem, size int) *MemObject { - memObject := &MemObject{clMem: mo, size: size} - runtime.SetFinalizer(memObject, releaseMemObject) - return memObject -} - -func (b *MemObject) Release() { - releaseMemObject(b) -} - -// TODO: properties -func CreateContext(devices []*Device) (*Context, error) { - deviceIds := buildDeviceIdList(devices) - var err C.cl_int - clContext := C.clCreateContext(nil, C.cl_uint(len(devices)), &deviceIds[0], nil, nil, &err) - if err != C.CL_SUCCESS { - return nil, toError(err) - } - if clContext == nil { - return nil, ErrUnknown - } - context := &Context{clContext: clContext, devices: devices} - runtime.SetFinalizer(context, releaseContext) - return context, nil -} - -func (ctx *Context) GetSupportedImageFormats(flags MemFlag, imageType MemObjectType) ([]ImageFormat, error) { - var formats [maxImageFormats]C.cl_image_format - var nFormats C.cl_uint - if err := C.clGetSupportedImageFormats(ctx.clContext, C.cl_mem_flags(flags), C.cl_mem_object_type(imageType), maxImageFormats, &formats[0], &nFormats); err != C.CL_SUCCESS { - return nil, toError(err) - } - fmts := make([]ImageFormat, nFormats) - for i, f := range formats[:nFormats] { - fmts[i] = ImageFormat{ - ChannelOrder: ChannelOrder(f.image_channel_order), - ChannelDataType: ChannelDataType(f.image_channel_data_type), - } - } - return fmts, nil -} - -func (ctx *Context) CreateCommandQueue(device *Device, properties CommandQueueProperty) (*CommandQueue, error) { - var err C.cl_int - clQueue := C.clCreateCommandQueue(ctx.clContext, device.id, C.cl_command_queue_properties(properties), &err) - if err != C.CL_SUCCESS { - return nil, toError(err) - } - if clQueue == nil { - return nil, ErrUnknown - } - commandQueue := &CommandQueue{clQueue: clQueue, device: device} - runtime.SetFinalizer(commandQueue, releaseCommandQueue) - return commandQueue, nil -} - -func (ctx *Context) CreateProgramWithSource(sources []string) (*Program, error) { - cSources := make([]*C.char, len(sources)) - for i, s := range sources { - cs := C.CString(s) - cSources[i] = cs - defer C.free(unsafe.Pointer(cs)) - } - var err C.cl_int - clProgram := C.clCreateProgramWithSource(ctx.clContext, C.cl_uint(len(sources)), &cSources[0], nil, &err) - if err != C.CL_SUCCESS { - return nil, toError(err) - } - if clProgram == nil { - return nil, ErrUnknown - } - program := &Program{clProgram: clProgram, devices: ctx.devices} - runtime.SetFinalizer(program, releaseProgram) - return program, nil -} - -func (ctx *Context) CreateBufferUnsafe(flags MemFlag, size int, dataPtr unsafe.Pointer) (*MemObject, error) { - var err C.cl_int - clBuffer := C.clCreateBuffer(ctx.clContext, C.cl_mem_flags(flags), C.size_t(size), dataPtr, &err) - if err != C.CL_SUCCESS { - return nil, toError(err) - } - if clBuffer == nil { - return nil, ErrUnknown - } - return newMemObject(clBuffer, size), nil -} - -func (ctx *Context) CreateEmptyBuffer(flags MemFlag, size int) (*MemObject, error) { - return ctx.CreateBufferUnsafe(flags, size, nil) -} - -func (ctx *Context) CreateEmptyBufferFloat32(flags MemFlag, size int) (*MemObject, error) { - return ctx.CreateBufferUnsafe(flags, 4*size, nil) -} - -func (ctx *Context) CreateBuffer(flags MemFlag, data []byte) (*MemObject, error) { - return ctx.CreateBufferUnsafe(flags, len(data), unsafe.Pointer(&data[0])) -} - -//float64 -func (ctx *Context) CreateBufferFloat32(flags MemFlag, data []float32) (*MemObject, error) { - return ctx.CreateBufferUnsafe(flags, 4*len(data), unsafe.Pointer(&data[0])) -} - -func (ctx *Context) CreateUserEvent() (*Event, error) { - var err C.cl_int - clEvent := C.clCreateUserEvent(ctx.clContext, &err) - if err != C.CL_SUCCESS { - return nil, toError(err) - } - return newEvent(clEvent), nil -} - -func (ctx *Context) Release() { - releaseContext(ctx) -} - -// http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateSubBuffer.html -// func (memObject *MemObject) CreateSubBuffer(flags MemFlag, bufferCreateType BufferCreateType, ) diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/device.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/device.go deleted file mode 100644 index d62a6fb71f..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/device.go +++ /dev/null @@ -1,510 +0,0 @@ -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #include "cl_ext.h" -// #endif -import "C" - -import ( - "strings" - "unsafe" -) - -const maxDeviceCount = 64 - -type DeviceType uint - -const ( - DeviceTypeCPU DeviceType = C.CL_DEVICE_TYPE_CPU - DeviceTypeGPU DeviceType = C.CL_DEVICE_TYPE_GPU - DeviceTypeAccelerator DeviceType = C.CL_DEVICE_TYPE_ACCELERATOR - DeviceTypeDefault DeviceType = C.CL_DEVICE_TYPE_DEFAULT - DeviceTypeAll DeviceType = C.CL_DEVICE_TYPE_ALL -) - -type FPConfig int - -const ( - FPConfigDenorm FPConfig = C.CL_FP_DENORM // denorms are supported - FPConfigInfNaN FPConfig = C.CL_FP_INF_NAN // INF and NaNs are supported - FPConfigRoundToNearest FPConfig = C.CL_FP_ROUND_TO_NEAREST // round to nearest even rounding mode supported - FPConfigRoundToZero FPConfig = C.CL_FP_ROUND_TO_ZERO // round to zero rounding mode supported - FPConfigRoundToInf FPConfig = C.CL_FP_ROUND_TO_INF // round to positive and negative infinity rounding modes supported - FPConfigFMA FPConfig = C.CL_FP_FMA // IEEE754-2008 fused multiply-add is supported - FPConfigSoftFloat FPConfig = C.CL_FP_SOFT_FLOAT // Basic floating-point operations (such as addition, subtraction, multiplication) are implemented in software -) - -var fpConfigNameMap = map[FPConfig]string{ - FPConfigDenorm: "Denorm", - FPConfigInfNaN: "InfNaN", - FPConfigRoundToNearest: "RoundToNearest", - FPConfigRoundToZero: "RoundToZero", - FPConfigRoundToInf: "RoundToInf", - FPConfigFMA: "FMA", - FPConfigSoftFloat: "SoftFloat", -} - -func (c FPConfig) String() string { - var parts []string - for bit, name := range fpConfigNameMap { - if c&bit != 0 { - parts = append(parts, name) - } - } - if parts == nil { - return "" - } - return strings.Join(parts, "|") -} - -func (dt DeviceType) String() string { - var parts []string - if dt&DeviceTypeCPU != 0 { - parts = append(parts, "CPU") - } - if dt&DeviceTypeGPU != 0 { - parts = append(parts, "GPU") - } - if dt&DeviceTypeAccelerator != 0 { - parts = append(parts, "Accelerator") - } - if dt&DeviceTypeDefault != 0 { - parts = append(parts, "Default") - } - if parts == nil { - parts = append(parts, "None") - } - return strings.Join(parts, "|") -} - -type Device struct { - id C.cl_device_id -} - -func buildDeviceIdList(devices []*Device) []C.cl_device_id { - deviceIds := make([]C.cl_device_id, len(devices)) - for i, d := range devices { - deviceIds[i] = d.id - } - return deviceIds -} - -// Obtain the list of devices available on a platform. 'platform' refers -// to the platform returned by GetPlatforms or can be nil. If platform -// is nil, the behavior is implementation-defined. -func GetDevices(platform *Platform, deviceType DeviceType) ([]*Device, error) { - var deviceIds [maxDeviceCount]C.cl_device_id - var numDevices C.cl_uint - var platformId C.cl_platform_id - if platform != nil { - platformId = platform.id - } - if err := C.clGetDeviceIDs(platformId, C.cl_device_type(deviceType), C.cl_uint(maxDeviceCount), &deviceIds[0], &numDevices); err != C.CL_SUCCESS { - return nil, toError(err) - } - if numDevices > maxDeviceCount { - numDevices = maxDeviceCount - } - devices := make([]*Device, numDevices) - for i := 0; i < int(numDevices); i++ { - devices[i] = &Device{id: deviceIds[i]} - } - return devices, nil -} - -func (d *Device) nullableId() C.cl_device_id { - if d == nil { - return nil - } - return d.id -} - -func (d *Device) GetInfoString(param C.cl_device_info, panicOnError bool) (string, error) { - var strC [1024]C.char - var strN C.size_t - if err := C.clGetDeviceInfo(d.id, param, 1024, unsafe.Pointer(&strC), &strN); err != C.CL_SUCCESS { - if panicOnError { - panic("Should never fail") - } - return "", toError(err) - } - - // OpenCL strings are NUL-terminated, and the terminator is included in strN - // Go strings aren't NUL-terminated, so subtract 1 from the length - return C.GoStringN((*C.char)(unsafe.Pointer(&strC)), C.int(strN-1)), nil -} - -func (d *Device) getInfoUint(param C.cl_device_info, panicOnError bool) (uint, error) { - var val C.cl_uint - if err := C.clGetDeviceInfo(d.id, param, C.size_t(unsafe.Sizeof(val)), unsafe.Pointer(&val), nil); err != C.CL_SUCCESS { - if panicOnError { - panic("Should never fail") - } - return 0, toError(err) - } - return uint(val), nil -} - -func (d *Device) getInfoSize(param C.cl_device_info, panicOnError bool) (int, error) { - var val C.size_t - if err := C.clGetDeviceInfo(d.id, param, C.size_t(unsafe.Sizeof(val)), unsafe.Pointer(&val), nil); err != C.CL_SUCCESS { - if panicOnError { - panic("Should never fail") - } - return 0, toError(err) - } - return int(val), nil -} - -func (d *Device) getInfoUlong(param C.cl_device_info, panicOnError bool) (int64, error) { - var val C.cl_ulong - if err := C.clGetDeviceInfo(d.id, param, C.size_t(unsafe.Sizeof(val)), unsafe.Pointer(&val), nil); err != C.CL_SUCCESS { - if panicOnError { - panic("Should never fail") - } - return 0, toError(err) - } - return int64(val), nil -} - -func (d *Device) getInfoBool(param C.cl_device_info, panicOnError bool) (bool, error) { - var val C.cl_bool - if err := C.clGetDeviceInfo(d.id, param, C.size_t(unsafe.Sizeof(val)), unsafe.Pointer(&val), nil); err != C.CL_SUCCESS { - if panicOnError { - panic("Should never fail") - } - return false, toError(err) - } - return val == C.CL_TRUE, nil -} - -func (d *Device) Name() string { - str, _ := d.GetInfoString(C.CL_DEVICE_NAME, true) - return str -} - -func (d *Device) Vendor() string { - str, _ := d.GetInfoString(C.CL_DEVICE_VENDOR, true) - return str -} - -func (d *Device) Extensions() string { - str, _ := d.GetInfoString(C.CL_DEVICE_EXTENSIONS, true) - return str -} - -func (d *Device) OpenCLCVersion() string { - str, _ := d.GetInfoString(C.CL_DEVICE_OPENCL_C_VERSION, true) - return str -} - -func (d *Device) Profile() string { - str, _ := d.GetInfoString(C.CL_DEVICE_PROFILE, true) - return str -} - -func (d *Device) Version() string { - str, _ := d.GetInfoString(C.CL_DEVICE_VERSION, true) - return str -} - -func (d *Device) DriverVersion() string { - str, _ := d.GetInfoString(C.CL_DRIVER_VERSION, true) - return str -} - -// The default compute device address space size specified as an -// unsigned integer value in bits. Currently supported values are 32 or 64 bits. -func (d *Device) AddressBits() int { - val, _ := d.getInfoUint(C.CL_DEVICE_ADDRESS_BITS, true) - return int(val) -} - -// Size of global memory cache line in bytes. -func (d *Device) GlobalMemCachelineSize() int { - val, _ := d.getInfoUint(C.CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, true) - return int(val) -} - -// Maximum configured clock frequency of the device in MHz. -func (d *Device) MaxClockFrequency() int { - val, _ := d.getInfoUint(C.CL_DEVICE_MAX_CLOCK_FREQUENCY, true) - return int(val) -} - -// The number of parallel compute units on the OpenCL device. -// A work-group executes on a single compute unit. The minimum value is 1. -func (d *Device) MaxComputeUnits() int { - val, _ := d.getInfoUint(C.CL_DEVICE_MAX_COMPUTE_UNITS, true) - return int(val) -} - -// Max number of arguments declared with the __constant qualifier in a kernel. -// The minimum value is 8 for devices that are not of type CL_DEVICE_TYPE_CUSTOM. -func (d *Device) MaxConstantArgs() int { - val, _ := d.getInfoUint(C.CL_DEVICE_MAX_CONSTANT_ARGS, true) - return int(val) -} - -// Max number of simultaneous image objects that can be read by a kernel. -// The minimum value is 128 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. -func (d *Device) MaxReadImageArgs() int { - val, _ := d.getInfoUint(C.CL_DEVICE_MAX_READ_IMAGE_ARGS, true) - return int(val) -} - -// Maximum number of samplers that can be used in a kernel. The minimum -// value is 16 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. (Also see sampler_t.) -func (d *Device) MaxSamplers() int { - val, _ := d.getInfoUint(C.CL_DEVICE_MAX_SAMPLERS, true) - return int(val) -} - -// Maximum dimensions that specify the global and local work-item IDs used -// by the data parallel execution model. (Refer to clEnqueueNDRangeKernel). -// The minimum value is 3 for devices that are not of type CL_DEVICE_TYPE_CUSTOM. -func (d *Device) MaxWorkItemDimensions() int { - val, _ := d.getInfoUint(C.CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, true) - return int(val) -} - -// Max number of simultaneous image objects that can be written to by a -// kernel. The minimum value is 8 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. -func (d *Device) MaxWriteImageArgs() int { - val, _ := d.getInfoUint(C.CL_DEVICE_MAX_WRITE_IMAGE_ARGS, true) - return int(val) -} - -// The minimum value is the size (in bits) of the largest OpenCL built-in -// data type supported by the device (long16 in FULL profile, long16 or -// int16 in EMBEDDED profile) for devices that are not of type CL_DEVICE_TYPE_CUSTOM. -func (d *Device) MemBaseAddrAlign() int { - val, _ := d.getInfoUint(C.CL_DEVICE_MEM_BASE_ADDR_ALIGN, true) - return int(val) -} - -func (d *Device) NativeVectorWidthChar() int { - val, _ := d.getInfoUint(C.CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, true) - return int(val) -} - -func (d *Device) NativeVectorWidthShort() int { - val, _ := d.getInfoUint(C.CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, true) - return int(val) -} - -func (d *Device) NativeVectorWidthInt() int { - val, _ := d.getInfoUint(C.CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, true) - return int(val) -} - -func (d *Device) NativeVectorWidthLong() int { - val, _ := d.getInfoUint(C.CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, true) - return int(val) -} - -func (d *Device) NativeVectorWidthFloat() int { - val, _ := d.getInfoUint(C.CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, true) - return int(val) -} - -func (d *Device) NativeVectorWidthDouble() int { - val, _ := d.getInfoUint(C.CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, true) - return int(val) -} - -func (d *Device) NativeVectorWidthHalf() int { - val, _ := d.getInfoUint(C.CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, true) - return int(val) -} - -// Max height of 2D image in pixels. The minimum value is 8192 -// if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. -func (d *Device) Image2DMaxHeight() int { - val, _ := d.getInfoSize(C.CL_DEVICE_IMAGE2D_MAX_HEIGHT, true) - return int(val) -} - -// Max width of 2D image or 1D image not created from a buffer object in -// pixels. The minimum value is 8192 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. -func (d *Device) Image2DMaxWidth() int { - val, _ := d.getInfoSize(C.CL_DEVICE_IMAGE2D_MAX_WIDTH, true) - return int(val) -} - -// Max depth of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. -func (d *Device) Image3DMaxDepth() int { - val, _ := d.getInfoSize(C.CL_DEVICE_IMAGE3D_MAX_DEPTH, true) - return int(val) -} - -// Max height of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. -func (d *Device) Image3DMaxHeight() int { - val, _ := d.getInfoSize(C.CL_DEVICE_IMAGE3D_MAX_HEIGHT, true) - return int(val) -} - -// Max width of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. -func (d *Device) Image3DMaxWidth() int { - val, _ := d.getInfoSize(C.CL_DEVICE_IMAGE3D_MAX_WIDTH, true) - return int(val) -} - -// Max size in bytes of the arguments that can be passed to a kernel. The -// minimum value is 1024 for devices that are not of type CL_DEVICE_TYPE_CUSTOM. -// For this minimum value, only a maximum of 128 arguments can be passed to a kernel. -func (d *Device) MaxParameterSize() int { - val, _ := d.getInfoSize(C.CL_DEVICE_MAX_PARAMETER_SIZE, true) - return int(val) -} - -// Maximum number of work-items in a work-group executing a kernel on a -// single compute unit, using the data parallel execution model. (Refer -// to clEnqueueNDRangeKernel). The minimum value is 1. -func (d *Device) MaxWorkGroupSize() int { - val, _ := d.getInfoSize(C.CL_DEVICE_MAX_WORK_GROUP_SIZE, true) - return int(val) -} - -// Describes the resolution of device timer. This is measured in nanoseconds. -func (d *Device) ProfilingTimerResolution() int { - val, _ := d.getInfoSize(C.CL_DEVICE_PROFILING_TIMER_RESOLUTION, true) - return int(val) -} - -// Size of local memory arena in bytes. The minimum value is 32 KB for -// devices that are not of type CL_DEVICE_TYPE_CUSTOM. -func (d *Device) LocalMemSize() int64 { - val, _ := d.getInfoUlong(C.CL_DEVICE_LOCAL_MEM_SIZE, true) - return val -} - -// Max size in bytes of a constant buffer allocation. The minimum value is -// 64 KB for devices that are not of type CL_DEVICE_TYPE_CUSTOM. -func (d *Device) MaxConstantBufferSize() int64 { - val, _ := d.getInfoUlong(C.CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, true) - return val -} - -// Max size of memory object allocation in bytes. The minimum value is max -// (1/4th of CL_DEVICE_GLOBAL_MEM_SIZE, 128*1024*1024) for devices that are -// not of type CL_DEVICE_TYPE_CUSTOM. -func (d *Device) MaxMemAllocSize() int64 { - val, _ := d.getInfoUlong(C.CL_DEVICE_MAX_MEM_ALLOC_SIZE, true) - return val -} - -// Size of global device memory in bytes. -func (d *Device) GlobalMemSize() int64 { - val, _ := d.getInfoUlong(C.CL_DEVICE_GLOBAL_MEM_SIZE, true) - return val -} - -func (d *Device) Available() bool { - val, _ := d.getInfoBool(C.CL_DEVICE_AVAILABLE, true) - return val -} - -func (d *Device) CompilerAvailable() bool { - val, _ := d.getInfoBool(C.CL_DEVICE_COMPILER_AVAILABLE, true) - return val -} - -func (d *Device) EndianLittle() bool { - val, _ := d.getInfoBool(C.CL_DEVICE_ENDIAN_LITTLE, true) - return val -} - -// Is CL_TRUE if the device implements error correction for all -// accesses to compute device memory (global and constant). Is -// CL_FALSE if the device does not implement such error correction. -func (d *Device) ErrorCorrectionSupport() bool { - val, _ := d.getInfoBool(C.CL_DEVICE_ERROR_CORRECTION_SUPPORT, true) - return val -} - -func (d *Device) HostUnifiedMemory() bool { - val, _ := d.getInfoBool(C.CL_DEVICE_HOST_UNIFIED_MEMORY, true) - return val -} - -func (d *Device) ImageSupport() bool { - val, _ := d.getInfoBool(C.CL_DEVICE_IMAGE_SUPPORT, true) - return val -} - -func (d *Device) Type() DeviceType { - var deviceType C.cl_device_type - if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_TYPE, C.size_t(unsafe.Sizeof(deviceType)), unsafe.Pointer(&deviceType), nil); err != C.CL_SUCCESS { - panic("Failed to get device type") - } - return DeviceType(deviceType) -} - -// Describes double precision floating-point capability of the OpenCL device -func (d *Device) DoubleFPConfig() FPConfig { - var fpConfig C.cl_device_fp_config - if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_DOUBLE_FP_CONFIG, C.size_t(unsafe.Sizeof(fpConfig)), unsafe.Pointer(&fpConfig), nil); err != C.CL_SUCCESS { - panic("Failed to get double FP config") - } - return FPConfig(fpConfig) -} - -// Describes the OPTIONAL half precision floating-point capability of the OpenCL device -func (d *Device) HalfFPConfig() FPConfig { - var fpConfig C.cl_device_fp_config - err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_HALF_FP_CONFIG, C.size_t(unsafe.Sizeof(fpConfig)), unsafe.Pointer(&fpConfig), nil) - if err != C.CL_SUCCESS { - return FPConfig(0) - } - return FPConfig(fpConfig) -} - -// Type of local memory supported. This can be set to CL_LOCAL implying dedicated -// local memory storage such as SRAM, or CL_GLOBAL. For custom devices, CL_NONE -// can also be returned indicating no local memory support. -func (d *Device) LocalMemType() LocalMemType { - var memType C.cl_device_local_mem_type - if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_LOCAL_MEM_TYPE, C.size_t(unsafe.Sizeof(memType)), unsafe.Pointer(&memType), nil); err != C.CL_SUCCESS { - return LocalMemType(C.CL_NONE) - } - return LocalMemType(memType) -} - -// Describes the execution capabilities of the device. The mandated minimum capability is CL_EXEC_KERNEL. -func (d *Device) ExecutionCapabilities() ExecCapability { - var execCap C.cl_device_exec_capabilities - if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_EXECUTION_CAPABILITIES, C.size_t(unsafe.Sizeof(execCap)), unsafe.Pointer(&execCap), nil); err != C.CL_SUCCESS { - panic("Failed to get execution capabilities") - } - return ExecCapability(execCap) -} - -func (d *Device) GlobalMemCacheType() MemCacheType { - var memType C.cl_device_mem_cache_type - if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, C.size_t(unsafe.Sizeof(memType)), unsafe.Pointer(&memType), nil); err != C.CL_SUCCESS { - return MemCacheType(C.CL_NONE) - } - return MemCacheType(memType) -} - -// Maximum number of work-items that can be specified in each dimension of the work-group to clEnqueueNDRangeKernel. -// -// Returns n size_t entries, where n is the value returned by the query for CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS. -// -// The minimum value is (1, 1, 1) for devices that are not of type CL_DEVICE_TYPE_CUSTOM. -func (d *Device) MaxWorkItemSizes() []int { - dims := d.MaxWorkItemDimensions() - sizes := make([]C.size_t, dims) - if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_MAX_WORK_ITEM_SIZES, C.size_t(int(unsafe.Sizeof(sizes[0]))*dims), unsafe.Pointer(&sizes[0]), nil); err != C.CL_SUCCESS { - panic("Failed to get max work item sizes") - } - intSizes := make([]int, dims) - for i, s := range sizes { - intSizes[i] = int(s) - } - return intSizes -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/device12.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/device12.go deleted file mode 100644 index b4b559a6a4..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/device12.go +++ /dev/null @@ -1,51 +0,0 @@ -// +build cl12 - -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" -import "unsafe" - -const FPConfigCorrectlyRoundedDivideSqrt FPConfig = C.CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT - -func init() { - fpConfigNameMap[FPConfigCorrectlyRoundedDivideSqrt] = "CorrectlyRoundedDivideSqrt" -} - -func (d *Device) BuiltInKernels() string { - str, _ := d.getInfoString(C.CL_DEVICE_BUILT_IN_KERNELS, true) - return str -} - -// Is CL_FALSE if the implementation does not have a linker available. Is CL_TRUE if the linker is available. This can be CL_FALSE for the embedded platform profile only. This must be CL_TRUE if CL_DEVICE_COMPILER_AVAILABLE is CL_TRUE -func (d *Device) LinkerAvailable() bool { - val, _ := d.getInfoBool(C.CL_DEVICE_LINKER_AVAILABLE, true) - return val -} - -func (d *Device) ParentDevice() *Device { - var deviceId C.cl_device_id - if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_PARENT_DEVICE, C.size_t(unsafe.Sizeof(deviceId)), unsafe.Pointer(&deviceId), nil); err != C.CL_SUCCESS { - panic("ParentDevice failed") - } - if deviceId == nil { - return nil - } - return &Device{id: deviceId} -} - -// Max number of pixels for a 1D image created from a buffer object. The minimum value is 65536 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. -func (d *Device) ImageMaxBufferSize() int { - val, _ := d.getInfoSize(C.CL_DEVICE_IMAGE_MAX_BUFFER_SIZE, true) - return int(val) -} - -// Max number of images in a 1D or 2D image array. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE -func (d *Device) ImageMaxArraySize() int { - val, _ := d.getInfoSize(C.CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, true) - return int(val) -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl.h b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl.h deleted file mode 100644 index c38aa1edae..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl.h +++ /dev/null @@ -1,1210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 - 2012 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - ******************************************************************************/ - -#ifndef __OPENCL_CL_H -#define __OPENCL_CL_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************/ - -typedef struct _cl_platform_id * cl_platform_id; -typedef struct _cl_device_id * cl_device_id; -typedef struct _cl_context * cl_context; -typedef struct _cl_command_queue * cl_command_queue; -typedef struct _cl_mem * cl_mem; -typedef struct _cl_program * cl_program; -typedef struct _cl_kernel * cl_kernel; -typedef struct _cl_event * cl_event; -typedef struct _cl_sampler * cl_sampler; - -typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */ -typedef cl_ulong cl_bitfield; -typedef cl_bitfield cl_device_type; -typedef cl_uint cl_platform_info; -typedef cl_uint cl_device_info; -typedef cl_bitfield cl_device_fp_config; -typedef cl_uint cl_device_mem_cache_type; -typedef cl_uint cl_device_local_mem_type; -typedef cl_bitfield cl_device_exec_capabilities; -typedef cl_bitfield cl_command_queue_properties; -typedef intptr_t cl_device_partition_property; -typedef cl_bitfield cl_device_affinity_domain; - -typedef intptr_t cl_context_properties; -typedef cl_uint cl_context_info; -typedef cl_uint cl_command_queue_info; -typedef cl_uint cl_channel_order; -typedef cl_uint cl_channel_type; -typedef cl_bitfield cl_mem_flags; -typedef cl_uint cl_mem_object_type; -typedef cl_uint cl_mem_info; -typedef cl_bitfield cl_mem_migration_flags; -typedef cl_uint cl_image_info; -typedef cl_uint cl_buffer_create_type; -typedef cl_uint cl_addressing_mode; -typedef cl_uint cl_filter_mode; -typedef cl_uint cl_sampler_info; -typedef cl_bitfield cl_map_flags; -typedef cl_uint cl_program_info; -typedef cl_uint cl_program_build_info; -typedef cl_uint cl_program_binary_type; -typedef cl_int cl_build_status; -typedef cl_uint cl_kernel_info; -typedef cl_uint cl_kernel_arg_info; -typedef cl_uint cl_kernel_arg_address_qualifier; -typedef cl_uint cl_kernel_arg_access_qualifier; -typedef cl_bitfield cl_kernel_arg_type_qualifier; -typedef cl_uint cl_kernel_work_group_info; -typedef cl_uint cl_event_info; -typedef cl_uint cl_command_type; -typedef cl_uint cl_profiling_info; - - -typedef struct _cl_image_format { - cl_channel_order image_channel_order; - cl_channel_type image_channel_data_type; -} cl_image_format; - -typedef struct _cl_image_desc { - cl_mem_object_type image_type; - size_t image_width; - size_t image_height; - size_t image_depth; - size_t image_array_size; - size_t image_row_pitch; - size_t image_slice_pitch; - cl_uint num_mip_levels; - cl_uint num_samples; - cl_mem buffer; -} cl_image_desc; - -typedef struct _cl_buffer_region { - size_t origin; - size_t size; -} cl_buffer_region; - - -/******************************************************************************/ - -/* Error Codes */ -#define CL_SUCCESS 0 -#define CL_DEVICE_NOT_FOUND -1 -#define CL_DEVICE_NOT_AVAILABLE -2 -#define CL_COMPILER_NOT_AVAILABLE -3 -#define CL_MEM_OBJECT_ALLOCATION_FAILURE -4 -#define CL_OUT_OF_RESOURCES -5 -#define CL_OUT_OF_HOST_MEMORY -6 -#define CL_PROFILING_INFO_NOT_AVAILABLE -7 -#define CL_MEM_COPY_OVERLAP -8 -#define CL_IMAGE_FORMAT_MISMATCH -9 -#define CL_IMAGE_FORMAT_NOT_SUPPORTED -10 -#define CL_BUILD_PROGRAM_FAILURE -11 -#define CL_MAP_FAILURE -12 -#define CL_MISALIGNED_SUB_BUFFER_OFFSET -13 -#define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14 -#define CL_COMPILE_PROGRAM_FAILURE -15 -#define CL_LINKER_NOT_AVAILABLE -16 -#define CL_LINK_PROGRAM_FAILURE -17 -#define CL_DEVICE_PARTITION_FAILED -18 -#define CL_KERNEL_ARG_INFO_NOT_AVAILABLE -19 - -#define CL_INVALID_VALUE -30 -#define CL_INVALID_DEVICE_TYPE -31 -#define CL_INVALID_PLATFORM -32 -#define CL_INVALID_DEVICE -33 -#define CL_INVALID_CONTEXT -34 -#define CL_INVALID_QUEUE_PROPERTIES -35 -#define CL_INVALID_COMMAND_QUEUE -36 -#define CL_INVALID_HOST_PTR -37 -#define CL_INVALID_MEM_OBJECT -38 -#define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR -39 -#define CL_INVALID_IMAGE_SIZE -40 -#define CL_INVALID_SAMPLER -41 -#define CL_INVALID_BINARY -42 -#define CL_INVALID_BUILD_OPTIONS -43 -#define CL_INVALID_PROGRAM -44 -#define CL_INVALID_PROGRAM_EXECUTABLE -45 -#define CL_INVALID_KERNEL_NAME -46 -#define CL_INVALID_KERNEL_DEFINITION -47 -#define CL_INVALID_KERNEL -48 -#define CL_INVALID_ARG_INDEX -49 -#define CL_INVALID_ARG_VALUE -50 -#define CL_INVALID_ARG_SIZE -51 -#define CL_INVALID_KERNEL_ARGS -52 -#define CL_INVALID_WORK_DIMENSION -53 -#define CL_INVALID_WORK_GROUP_SIZE -54 -#define CL_INVALID_WORK_ITEM_SIZE -55 -#define CL_INVALID_GLOBAL_OFFSET -56 -#define CL_INVALID_EVENT_WAIT_LIST -57 -#define CL_INVALID_EVENT -58 -#define CL_INVALID_OPERATION -59 -#define CL_INVALID_GL_OBJECT -60 -#define CL_INVALID_BUFFER_SIZE -61 -#define CL_INVALID_MIP_LEVEL -62 -#define CL_INVALID_GLOBAL_WORK_SIZE -63 -#define CL_INVALID_PROPERTY -64 -#define CL_INVALID_IMAGE_DESCRIPTOR -65 -#define CL_INVALID_COMPILER_OPTIONS -66 -#define CL_INVALID_LINKER_OPTIONS -67 -#define CL_INVALID_DEVICE_PARTITION_COUNT -68 - -/* OpenCL Version */ -#define CL_VERSION_1_0 1 -#define CL_VERSION_1_1 1 -#define CL_VERSION_1_2 1 - -/* cl_bool */ -#define CL_FALSE 0 -#define CL_TRUE 1 -#define CL_BLOCKING CL_TRUE -#define CL_NON_BLOCKING CL_FALSE - -/* cl_platform_info */ -#define CL_PLATFORM_PROFILE 0x0900 -#define CL_PLATFORM_VERSION 0x0901 -#define CL_PLATFORM_NAME 0x0902 -#define CL_PLATFORM_VENDOR 0x0903 -#define CL_PLATFORM_EXTENSIONS 0x0904 - -/* cl_device_type - bitfield */ -#define CL_DEVICE_TYPE_DEFAULT (1 << 0) -#define CL_DEVICE_TYPE_CPU (1 << 1) -#define CL_DEVICE_TYPE_GPU (1 << 2) -#define CL_DEVICE_TYPE_ACCELERATOR (1 << 3) -#define CL_DEVICE_TYPE_CUSTOM (1 << 4) -#define CL_DEVICE_TYPE_ALL 0xFFFFFFFF - -/* cl_device_info */ -#define CL_DEVICE_TYPE 0x1000 -#define CL_DEVICE_VENDOR_ID 0x1001 -#define CL_DEVICE_MAX_COMPUTE_UNITS 0x1002 -#define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS 0x1003 -#define CL_DEVICE_MAX_WORK_GROUP_SIZE 0x1004 -#define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005 -#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR 0x1006 -#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT 0x1007 -#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT 0x1008 -#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG 0x1009 -#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT 0x100A -#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE 0x100B -#define CL_DEVICE_MAX_CLOCK_FREQUENCY 0x100C -#define CL_DEVICE_ADDRESS_BITS 0x100D -#define CL_DEVICE_MAX_READ_IMAGE_ARGS 0x100E -#define CL_DEVICE_MAX_WRITE_IMAGE_ARGS 0x100F -#define CL_DEVICE_MAX_MEM_ALLOC_SIZE 0x1010 -#define CL_DEVICE_IMAGE2D_MAX_WIDTH 0x1011 -#define CL_DEVICE_IMAGE2D_MAX_HEIGHT 0x1012 -#define CL_DEVICE_IMAGE3D_MAX_WIDTH 0x1013 -#define CL_DEVICE_IMAGE3D_MAX_HEIGHT 0x1014 -#define CL_DEVICE_IMAGE3D_MAX_DEPTH 0x1015 -#define CL_DEVICE_IMAGE_SUPPORT 0x1016 -#define CL_DEVICE_MAX_PARAMETER_SIZE 0x1017 -#define CL_DEVICE_MAX_SAMPLERS 0x1018 -#define CL_DEVICE_MEM_BASE_ADDR_ALIGN 0x1019 -#define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE 0x101A -#define CL_DEVICE_SINGLE_FP_CONFIG 0x101B -#define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE 0x101C -#define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE 0x101D -#define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 0x101E -#define CL_DEVICE_GLOBAL_MEM_SIZE 0x101F -#define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE 0x1020 -#define CL_DEVICE_MAX_CONSTANT_ARGS 0x1021 -#define CL_DEVICE_LOCAL_MEM_TYPE 0x1022 -#define CL_DEVICE_LOCAL_MEM_SIZE 0x1023 -#define CL_DEVICE_ERROR_CORRECTION_SUPPORT 0x1024 -#define CL_DEVICE_PROFILING_TIMER_RESOLUTION 0x1025 -#define CL_DEVICE_ENDIAN_LITTLE 0x1026 -#define CL_DEVICE_AVAILABLE 0x1027 -#define CL_DEVICE_COMPILER_AVAILABLE 0x1028 -#define CL_DEVICE_EXECUTION_CAPABILITIES 0x1029 -#define CL_DEVICE_QUEUE_PROPERTIES 0x102A -#define CL_DEVICE_NAME 0x102B -#define CL_DEVICE_VENDOR 0x102C -#define CL_DRIVER_VERSION 0x102D -#define CL_DEVICE_PROFILE 0x102E -#define CL_DEVICE_VERSION 0x102F -#define CL_DEVICE_EXTENSIONS 0x1030 -#define CL_DEVICE_PLATFORM 0x1031 -#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 -/* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */ -#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF 0x1034 -#define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035 -#define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR 0x1036 -#define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT 0x1037 -#define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT 0x1038 -#define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG 0x1039 -#define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT 0x103A -#define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE 0x103B -#define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF 0x103C -#define CL_DEVICE_OPENCL_C_VERSION 0x103D -#define CL_DEVICE_LINKER_AVAILABLE 0x103E -#define CL_DEVICE_BUILT_IN_KERNELS 0x103F -#define CL_DEVICE_IMAGE_MAX_BUFFER_SIZE 0x1040 -#define CL_DEVICE_IMAGE_MAX_ARRAY_SIZE 0x1041 -#define CL_DEVICE_PARENT_DEVICE 0x1042 -#define CL_DEVICE_PARTITION_MAX_SUB_DEVICES 0x1043 -#define CL_DEVICE_PARTITION_PROPERTIES 0x1044 -#define CL_DEVICE_PARTITION_AFFINITY_DOMAIN 0x1045 -#define CL_DEVICE_PARTITION_TYPE 0x1046 -#define CL_DEVICE_REFERENCE_COUNT 0x1047 -#define CL_DEVICE_PREFERRED_INTEROP_USER_SYNC 0x1048 -#define CL_DEVICE_PRINTF_BUFFER_SIZE 0x1049 -#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT 0x104A -#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT 0x104B - -/* cl_device_fp_config - bitfield */ -#define CL_FP_DENORM (1 << 0) -#define CL_FP_INF_NAN (1 << 1) -#define CL_FP_ROUND_TO_NEAREST (1 << 2) -#define CL_FP_ROUND_TO_ZERO (1 << 3) -#define CL_FP_ROUND_TO_INF (1 << 4) -#define CL_FP_FMA (1 << 5) -#define CL_FP_SOFT_FLOAT (1 << 6) -#define CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT (1 << 7) - -/* cl_device_mem_cache_type */ -#define CL_NONE 0x0 -#define CL_READ_ONLY_CACHE 0x1 -#define CL_READ_WRITE_CACHE 0x2 - -/* cl_device_local_mem_type */ -#define CL_LOCAL 0x1 -#define CL_GLOBAL 0x2 - -/* cl_device_exec_capabilities - bitfield */ -#define CL_EXEC_KERNEL (1 << 0) -#define CL_EXEC_NATIVE_KERNEL (1 << 1) - -/* cl_command_queue_properties - bitfield */ -#define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE (1 << 0) -#define CL_QUEUE_PROFILING_ENABLE (1 << 1) - -/* cl_context_info */ -#define CL_CONTEXT_REFERENCE_COUNT 0x1080 -#define CL_CONTEXT_DEVICES 0x1081 -#define CL_CONTEXT_PROPERTIES 0x1082 -#define CL_CONTEXT_NUM_DEVICES 0x1083 - -/* cl_context_properties */ -#define CL_CONTEXT_PLATFORM 0x1084 -#define CL_CONTEXT_INTEROP_USER_SYNC 0x1085 - -/* cl_device_partition_property */ -#define CL_DEVICE_PARTITION_EQUALLY 0x1086 -#define CL_DEVICE_PARTITION_BY_COUNTS 0x1087 -#define CL_DEVICE_PARTITION_BY_COUNTS_LIST_END 0x0 -#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN 0x1088 - -/* cl_device_affinity_domain */ -#define CL_DEVICE_AFFINITY_DOMAIN_NUMA (1 << 0) -#define CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE (1 << 1) -#define CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE (1 << 2) -#define CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE (1 << 3) -#define CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE (1 << 4) -#define CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE (1 << 5) - -/* cl_command_queue_info */ -#define CL_QUEUE_CONTEXT 0x1090 -#define CL_QUEUE_DEVICE 0x1091 -#define CL_QUEUE_REFERENCE_COUNT 0x1092 -#define CL_QUEUE_PROPERTIES 0x1093 - -/* cl_mem_flags - bitfield */ -#define CL_MEM_READ_WRITE (1 << 0) -#define CL_MEM_WRITE_ONLY (1 << 1) -#define CL_MEM_READ_ONLY (1 << 2) -#define CL_MEM_USE_HOST_PTR (1 << 3) -#define CL_MEM_ALLOC_HOST_PTR (1 << 4) -#define CL_MEM_COPY_HOST_PTR (1 << 5) -/* reserved (1 << 6) */ -#define CL_MEM_HOST_WRITE_ONLY (1 << 7) -#define CL_MEM_HOST_READ_ONLY (1 << 8) -#define CL_MEM_HOST_NO_ACCESS (1 << 9) - -/* cl_mem_migration_flags - bitfield */ -#define CL_MIGRATE_MEM_OBJECT_HOST (1 << 0) -#define CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED (1 << 1) - -/* cl_channel_order */ -#define CL_R 0x10B0 -#define CL_A 0x10B1 -#define CL_RG 0x10B2 -#define CL_RA 0x10B3 -#define CL_RGB 0x10B4 -#define CL_RGBA 0x10B5 -#define CL_BGRA 0x10B6 -#define CL_ARGB 0x10B7 -#define CL_INTENSITY 0x10B8 -#define CL_LUMINANCE 0x10B9 -#define CL_Rx 0x10BA -#define CL_RGx 0x10BB -#define CL_RGBx 0x10BC -#define CL_DEPTH 0x10BD -#define CL_DEPTH_STENCIL 0x10BE - -/* cl_channel_type */ -#define CL_SNORM_INT8 0x10D0 -#define CL_SNORM_INT16 0x10D1 -#define CL_UNORM_INT8 0x10D2 -#define CL_UNORM_INT16 0x10D3 -#define CL_UNORM_SHORT_565 0x10D4 -#define CL_UNORM_SHORT_555 0x10D5 -#define CL_UNORM_INT_101010 0x10D6 -#define CL_SIGNED_INT8 0x10D7 -#define CL_SIGNED_INT16 0x10D8 -#define CL_SIGNED_INT32 0x10D9 -#define CL_UNSIGNED_INT8 0x10DA -#define CL_UNSIGNED_INT16 0x10DB -#define CL_UNSIGNED_INT32 0x10DC -#define CL_HALF_FLOAT 0x10DD -#define CL_FLOAT 0x10DE -#define CL_UNORM_INT24 0x10DF - -/* cl_mem_object_type */ -#define CL_MEM_OBJECT_BUFFER 0x10F0 -#define CL_MEM_OBJECT_IMAGE2D 0x10F1 -#define CL_MEM_OBJECT_IMAGE3D 0x10F2 -#define CL_MEM_OBJECT_IMAGE2D_ARRAY 0x10F3 -#define CL_MEM_OBJECT_IMAGE1D 0x10F4 -#define CL_MEM_OBJECT_IMAGE1D_ARRAY 0x10F5 -#define CL_MEM_OBJECT_IMAGE1D_BUFFER 0x10F6 - -/* cl_mem_info */ -#define CL_MEM_TYPE 0x1100 -#define CL_MEM_FLAGS 0x1101 -#define CL_MEM_SIZE 0x1102 -#define CL_MEM_HOST_PTR 0x1103 -#define CL_MEM_MAP_COUNT 0x1104 -#define CL_MEM_REFERENCE_COUNT 0x1105 -#define CL_MEM_CONTEXT 0x1106 -#define CL_MEM_ASSOCIATED_MEMOBJECT 0x1107 -#define CL_MEM_OFFSET 0x1108 - -/* cl_image_info */ -#define CL_IMAGE_FORMAT 0x1110 -#define CL_IMAGE_ELEMENT_SIZE 0x1111 -#define CL_IMAGE_ROW_PITCH 0x1112 -#define CL_IMAGE_SLICE_PITCH 0x1113 -#define CL_IMAGE_WIDTH 0x1114 -#define CL_IMAGE_HEIGHT 0x1115 -#define CL_IMAGE_DEPTH 0x1116 -#define CL_IMAGE_ARRAY_SIZE 0x1117 -#define CL_IMAGE_BUFFER 0x1118 -#define CL_IMAGE_NUM_MIP_LEVELS 0x1119 -#define CL_IMAGE_NUM_SAMPLES 0x111A - -/* cl_addressing_mode */ -#define CL_ADDRESS_NONE 0x1130 -#define CL_ADDRESS_CLAMP_TO_EDGE 0x1131 -#define CL_ADDRESS_CLAMP 0x1132 -#define CL_ADDRESS_REPEAT 0x1133 -#define CL_ADDRESS_MIRRORED_REPEAT 0x1134 - -/* cl_filter_mode */ -#define CL_FILTER_NEAREST 0x1140 -#define CL_FILTER_LINEAR 0x1141 - -/* cl_sampler_info */ -#define CL_SAMPLER_REFERENCE_COUNT 0x1150 -#define CL_SAMPLER_CONTEXT 0x1151 -#define CL_SAMPLER_NORMALIZED_COORDS 0x1152 -#define CL_SAMPLER_ADDRESSING_MODE 0x1153 -#define CL_SAMPLER_FILTER_MODE 0x1154 - -/* cl_map_flags - bitfield */ -#define CL_MAP_READ (1 << 0) -#define CL_MAP_WRITE (1 << 1) -#define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2) - -/* cl_program_info */ -#define CL_PROGRAM_REFERENCE_COUNT 0x1160 -#define CL_PROGRAM_CONTEXT 0x1161 -#define CL_PROGRAM_NUM_DEVICES 0x1162 -#define CL_PROGRAM_DEVICES 0x1163 -#define CL_PROGRAM_SOURCE 0x1164 -#define CL_PROGRAM_BINARY_SIZES 0x1165 -#define CL_PROGRAM_BINARIES 0x1166 -#define CL_PROGRAM_NUM_KERNELS 0x1167 -#define CL_PROGRAM_KERNEL_NAMES 0x1168 - -/* cl_program_build_info */ -#define CL_PROGRAM_BUILD_STATUS 0x1181 -#define CL_PROGRAM_BUILD_OPTIONS 0x1182 -#define CL_PROGRAM_BUILD_LOG 0x1183 -#define CL_PROGRAM_BINARY_TYPE 0x1184 - -/* cl_program_binary_type */ -#define CL_PROGRAM_BINARY_TYPE_NONE 0x0 -#define CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT 0x1 -#define CL_PROGRAM_BINARY_TYPE_LIBRARY 0x2 -#define CL_PROGRAM_BINARY_TYPE_EXECUTABLE 0x4 - -/* cl_build_status */ -#define CL_BUILD_SUCCESS 0 -#define CL_BUILD_NONE -1 -#define CL_BUILD_ERROR -2 -#define CL_BUILD_IN_PROGRESS -3 - -/* cl_kernel_info */ -#define CL_KERNEL_FUNCTION_NAME 0x1190 -#define CL_KERNEL_NUM_ARGS 0x1191 -#define CL_KERNEL_REFERENCE_COUNT 0x1192 -#define CL_KERNEL_CONTEXT 0x1193 -#define CL_KERNEL_PROGRAM 0x1194 -#define CL_KERNEL_ATTRIBUTES 0x1195 - -/* cl_kernel_arg_info */ -#define CL_KERNEL_ARG_ADDRESS_QUALIFIER 0x1196 -#define CL_KERNEL_ARG_ACCESS_QUALIFIER 0x1197 -#define CL_KERNEL_ARG_TYPE_NAME 0x1198 -#define CL_KERNEL_ARG_TYPE_QUALIFIER 0x1199 -#define CL_KERNEL_ARG_NAME 0x119A - -/* cl_kernel_arg_address_qualifier */ -#define CL_KERNEL_ARG_ADDRESS_GLOBAL 0x119B -#define CL_KERNEL_ARG_ADDRESS_LOCAL 0x119C -#define CL_KERNEL_ARG_ADDRESS_CONSTANT 0x119D -#define CL_KERNEL_ARG_ADDRESS_PRIVATE 0x119E - -/* cl_kernel_arg_access_qualifier */ -#define CL_KERNEL_ARG_ACCESS_READ_ONLY 0x11A0 -#define CL_KERNEL_ARG_ACCESS_WRITE_ONLY 0x11A1 -#define CL_KERNEL_ARG_ACCESS_READ_WRITE 0x11A2 -#define CL_KERNEL_ARG_ACCESS_NONE 0x11A3 - -/* cl_kernel_arg_type_qualifer */ -#define CL_KERNEL_ARG_TYPE_NONE 0 -#define CL_KERNEL_ARG_TYPE_CONST (1 << 0) -#define CL_KERNEL_ARG_TYPE_RESTRICT (1 << 1) -#define CL_KERNEL_ARG_TYPE_VOLATILE (1 << 2) - -/* cl_kernel_work_group_info */ -#define CL_KERNEL_WORK_GROUP_SIZE 0x11B0 -#define CL_KERNEL_COMPILE_WORK_GROUP_SIZE 0x11B1 -#define CL_KERNEL_LOCAL_MEM_SIZE 0x11B2 -#define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3 -#define CL_KERNEL_PRIVATE_MEM_SIZE 0x11B4 -#define CL_KERNEL_GLOBAL_WORK_SIZE 0x11B5 - -/* cl_event_info */ -#define CL_EVENT_COMMAND_QUEUE 0x11D0 -#define CL_EVENT_COMMAND_TYPE 0x11D1 -#define CL_EVENT_REFERENCE_COUNT 0x11D2 -#define CL_EVENT_COMMAND_EXECUTION_STATUS 0x11D3 -#define CL_EVENT_CONTEXT 0x11D4 - -/* cl_command_type */ -#define CL_COMMAND_NDRANGE_KERNEL 0x11F0 -#define CL_COMMAND_TASK 0x11F1 -#define CL_COMMAND_NATIVE_KERNEL 0x11F2 -#define CL_COMMAND_READ_BUFFER 0x11F3 -#define CL_COMMAND_WRITE_BUFFER 0x11F4 -#define CL_COMMAND_COPY_BUFFER 0x11F5 -#define CL_COMMAND_READ_IMAGE 0x11F6 -#define CL_COMMAND_WRITE_IMAGE 0x11F7 -#define CL_COMMAND_COPY_IMAGE 0x11F8 -#define CL_COMMAND_COPY_IMAGE_TO_BUFFER 0x11F9 -#define CL_COMMAND_COPY_BUFFER_TO_IMAGE 0x11FA -#define CL_COMMAND_MAP_BUFFER 0x11FB -#define CL_COMMAND_MAP_IMAGE 0x11FC -#define CL_COMMAND_UNMAP_MEM_OBJECT 0x11FD -#define CL_COMMAND_MARKER 0x11FE -#define CL_COMMAND_ACQUIRE_GL_OBJECTS 0x11FF -#define CL_COMMAND_RELEASE_GL_OBJECTS 0x1200 -#define CL_COMMAND_READ_BUFFER_RECT 0x1201 -#define CL_COMMAND_WRITE_BUFFER_RECT 0x1202 -#define CL_COMMAND_COPY_BUFFER_RECT 0x1203 -#define CL_COMMAND_USER 0x1204 -#define CL_COMMAND_BARRIER 0x1205 -#define CL_COMMAND_MIGRATE_MEM_OBJECTS 0x1206 -#define CL_COMMAND_FILL_BUFFER 0x1207 -#define CL_COMMAND_FILL_IMAGE 0x1208 - -/* command execution status */ -#define CL_COMPLETE 0x0 -#define CL_RUNNING 0x1 -#define CL_SUBMITTED 0x2 -#define CL_QUEUED 0x3 - -/* cl_buffer_create_type */ -#define CL_BUFFER_CREATE_TYPE_REGION 0x1220 - -/* cl_profiling_info */ -#define CL_PROFILING_COMMAND_QUEUED 0x1280 -#define CL_PROFILING_COMMAND_SUBMIT 0x1281 -#define CL_PROFILING_COMMAND_START 0x1282 -#define CL_PROFILING_COMMAND_END 0x1283 - -/********************************************************************************************************/ - -/* Platform API */ -extern CL_API_ENTRY cl_int CL_API_CALL -clGetPlatformIDs(cl_uint /* num_entries */, - cl_platform_id * /* platforms */, - cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetPlatformInfo(cl_platform_id /* platform */, - cl_platform_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -/* Device APIs */ -extern CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceIDs(cl_platform_id /* platform */, - cl_device_type /* device_type */, - cl_uint /* num_entries */, - cl_device_id * /* devices */, - cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceInfo(cl_device_id /* device */, - cl_device_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clCreateSubDevices(cl_device_id /* in_device */, - const cl_device_partition_property * /* properties */, - cl_uint /* num_devices */, - cl_device_id * /* out_devices */, - cl_uint * /* num_devices_ret */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainDevice(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseDevice(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2; - -/* Context APIs */ -extern CL_API_ENTRY cl_context CL_API_CALL -clCreateContext(const cl_context_properties * /* properties */, - cl_uint /* num_devices */, - const cl_device_id * /* devices */, - void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *), - void * /* user_data */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_context CL_API_CALL -clCreateContextFromType(const cl_context_properties * /* properties */, - cl_device_type /* device_type */, - void (CL_CALLBACK * /* pfn_notify*/ )(const char *, const void *, size_t, void *), - void * /* user_data */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetContextInfo(cl_context /* context */, - cl_context_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -/* Command Queue APIs */ -extern CL_API_ENTRY cl_command_queue CL_API_CALL -clCreateCommandQueue(cl_context /* context */, - cl_device_id /* device */, - cl_command_queue_properties /* properties */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetCommandQueueInfo(cl_command_queue /* command_queue */, - cl_command_queue_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -/* Memory Object APIs */ -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateBuffer(cl_context /* context */, - cl_mem_flags /* flags */, - size_t /* size */, - void * /* host_ptr */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateSubBuffer(cl_mem /* buffer */, - cl_mem_flags /* flags */, - cl_buffer_create_type /* buffer_create_type */, - const void * /* buffer_create_info */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateImage(cl_context /* context */, - cl_mem_flags /* flags */, - const cl_image_format * /* image_format */, - const cl_image_desc * /* image_desc */, - void * /* host_ptr */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetSupportedImageFormats(cl_context /* context */, - cl_mem_flags /* flags */, - cl_mem_object_type /* image_type */, - cl_uint /* num_entries */, - cl_image_format * /* image_formats */, - cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetMemObjectInfo(cl_mem /* memobj */, - cl_mem_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetImageInfo(cl_mem /* image */, - cl_image_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clSetMemObjectDestructorCallback( cl_mem /* memobj */, - void (CL_CALLBACK * /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), - void * /*user_data */ ) CL_API_SUFFIX__VERSION_1_1; - -/* Sampler APIs */ -extern CL_API_ENTRY cl_sampler CL_API_CALL -clCreateSampler(cl_context /* context */, - cl_bool /* normalized_coords */, - cl_addressing_mode /* addressing_mode */, - cl_filter_mode /* filter_mode */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetSamplerInfo(cl_sampler /* sampler */, - cl_sampler_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -/* Program Object APIs */ -extern CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithSource(cl_context /* context */, - cl_uint /* count */, - const char ** /* strings */, - const size_t * /* lengths */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithBinary(cl_context /* context */, - cl_uint /* num_devices */, - const cl_device_id * /* device_list */, - const size_t * /* lengths */, - const unsigned char ** /* binaries */, - cl_int * /* binary_status */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithBuiltInKernels(cl_context /* context */, - cl_uint /* num_devices */, - const cl_device_id * /* device_list */, - const char * /* kernel_names */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clBuildProgram(cl_program /* program */, - cl_uint /* num_devices */, - const cl_device_id * /* device_list */, - const char * /* options */, - void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), - void * /* user_data */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clCompileProgram(cl_program /* program */, - cl_uint /* num_devices */, - const cl_device_id * /* device_list */, - const char * /* options */, - cl_uint /* num_input_headers */, - const cl_program * /* input_headers */, - const char ** /* header_include_names */, - void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), - void * /* user_data */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_program CL_API_CALL -clLinkProgram(cl_context /* context */, - cl_uint /* num_devices */, - const cl_device_id * /* device_list */, - const char * /* options */, - cl_uint /* num_input_programs */, - const cl_program * /* input_programs */, - void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), - void * /* user_data */, - cl_int * /* errcode_ret */ ) CL_API_SUFFIX__VERSION_1_2; - - -extern CL_API_ENTRY cl_int CL_API_CALL -clUnloadPlatformCompiler(cl_platform_id /* platform */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetProgramInfo(cl_program /* program */, - cl_program_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetProgramBuildInfo(cl_program /* program */, - cl_device_id /* device */, - cl_program_build_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -/* Kernel Object APIs */ -extern CL_API_ENTRY cl_kernel CL_API_CALL -clCreateKernel(cl_program /* program */, - const char * /* kernel_name */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clCreateKernelsInProgram(cl_program /* program */, - cl_uint /* num_kernels */, - cl_kernel * /* kernels */, - cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clSetKernelArg(cl_kernel /* kernel */, - cl_uint /* arg_index */, - size_t /* arg_size */, - const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetKernelInfo(cl_kernel /* kernel */, - cl_kernel_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetKernelArgInfo(cl_kernel /* kernel */, - cl_uint /* arg_indx */, - cl_kernel_arg_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetKernelWorkGroupInfo(cl_kernel /* kernel */, - cl_device_id /* device */, - cl_kernel_work_group_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -/* Event Object APIs */ -extern CL_API_ENTRY cl_int CL_API_CALL -clWaitForEvents(cl_uint /* num_events */, - const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetEventInfo(cl_event /* event */, - cl_event_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_event CL_API_CALL -clCreateUserEvent(cl_context /* context */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clSetUserEventStatus(cl_event /* event */, - cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_int CL_API_CALL -clSetEventCallback( cl_event /* event */, - cl_int /* command_exec_callback_type */, - void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *), - void * /* user_data */) CL_API_SUFFIX__VERSION_1_1; - -/* Profiling APIs */ -extern CL_API_ENTRY cl_int CL_API_CALL -clGetEventProfilingInfo(cl_event /* event */, - cl_profiling_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -/* Flush and Finish APIs */ -extern CL_API_ENTRY cl_int CL_API_CALL -clFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; - -/* Enqueued Commands APIs */ -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReadBuffer(cl_command_queue /* command_queue */, - cl_mem /* buffer */, - cl_bool /* blocking_read */, - size_t /* offset */, - size_t /* size */, - void * /* ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReadBufferRect(cl_command_queue /* command_queue */, - cl_mem /* buffer */, - cl_bool /* blocking_read */, - const size_t * /* buffer_offset */, - const size_t * /* host_offset */, - const size_t * /* region */, - size_t /* buffer_row_pitch */, - size_t /* buffer_slice_pitch */, - size_t /* host_row_pitch */, - size_t /* host_slice_pitch */, - void * /* ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueWriteBuffer(cl_command_queue /* command_queue */, - cl_mem /* buffer */, - cl_bool /* blocking_write */, - size_t /* offset */, - size_t /* size */, - const void * /* ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueWriteBufferRect(cl_command_queue /* command_queue */, - cl_mem /* buffer */, - cl_bool /* blocking_write */, - const size_t * /* buffer_offset */, - const size_t * /* host_offset */, - const size_t * /* region */, - size_t /* buffer_row_pitch */, - size_t /* buffer_slice_pitch */, - size_t /* host_row_pitch */, - size_t /* host_slice_pitch */, - const void * /* ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueFillBuffer(cl_command_queue /* command_queue */, - cl_mem /* buffer */, - const void * /* pattern */, - size_t /* pattern_size */, - size_t /* offset */, - size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyBuffer(cl_command_queue /* command_queue */, - cl_mem /* src_buffer */, - cl_mem /* dst_buffer */, - size_t /* src_offset */, - size_t /* dst_offset */, - size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyBufferRect(cl_command_queue /* command_queue */, - cl_mem /* src_buffer */, - cl_mem /* dst_buffer */, - const size_t * /* src_origin */, - const size_t * /* dst_origin */, - const size_t * /* region */, - size_t /* src_row_pitch */, - size_t /* src_slice_pitch */, - size_t /* dst_row_pitch */, - size_t /* dst_slice_pitch */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReadImage(cl_command_queue /* command_queue */, - cl_mem /* image */, - cl_bool /* blocking_read */, - const size_t * /* origin[3] */, - const size_t * /* region[3] */, - size_t /* row_pitch */, - size_t /* slice_pitch */, - void * /* ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueWriteImage(cl_command_queue /* command_queue */, - cl_mem /* image */, - cl_bool /* blocking_write */, - const size_t * /* origin[3] */, - const size_t * /* region[3] */, - size_t /* input_row_pitch */, - size_t /* input_slice_pitch */, - const void * /* ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueFillImage(cl_command_queue /* command_queue */, - cl_mem /* image */, - const void * /* fill_color */, - const size_t * /* origin[3] */, - const size_t * /* region[3] */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyImage(cl_command_queue /* command_queue */, - cl_mem /* src_image */, - cl_mem /* dst_image */, - const size_t * /* src_origin[3] */, - const size_t * /* dst_origin[3] */, - const size_t * /* region[3] */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */, - cl_mem /* src_image */, - cl_mem /* dst_buffer */, - const size_t * /* src_origin[3] */, - const size_t * /* region[3] */, - size_t /* dst_offset */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyBufferToImage(cl_command_queue /* command_queue */, - cl_mem /* src_buffer */, - cl_mem /* dst_image */, - size_t /* src_offset */, - const size_t * /* dst_origin[3] */, - const size_t * /* region[3] */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY void * CL_API_CALL -clEnqueueMapBuffer(cl_command_queue /* command_queue */, - cl_mem /* buffer */, - cl_bool /* blocking_map */, - cl_map_flags /* map_flags */, - size_t /* offset */, - size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY void * CL_API_CALL -clEnqueueMapImage(cl_command_queue /* command_queue */, - cl_mem /* image */, - cl_bool /* blocking_map */, - cl_map_flags /* map_flags */, - const size_t * /* origin[3] */, - const size_t * /* region[3] */, - size_t * /* image_row_pitch */, - size_t * /* image_slice_pitch */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueUnmapMemObject(cl_command_queue /* command_queue */, - cl_mem /* memobj */, - void * /* mapped_ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMigrateMemObjects(cl_command_queue /* command_queue */, - cl_uint /* num_mem_objects */, - const cl_mem * /* mem_objects */, - cl_mem_migration_flags /* flags */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueNDRangeKernel(cl_command_queue /* command_queue */, - cl_kernel /* kernel */, - cl_uint /* work_dim */, - const size_t * /* global_work_offset */, - const size_t * /* global_work_size */, - const size_t * /* local_work_size */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueTask(cl_command_queue /* command_queue */, - cl_kernel /* kernel */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueNativeKernel(cl_command_queue /* command_queue */, - void (CL_CALLBACK * /*user_func*/)(void *), - void * /* args */, - size_t /* cb_args */, - cl_uint /* num_mem_objects */, - const cl_mem * /* mem_list */, - const void ** /* args_mem_loc */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMarkerWithWaitList(cl_command_queue /* command_queue */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueBarrierWithWaitList(cl_command_queue /* command_queue */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; - - -/* Extension function access - * - * Returns the extension function address for the given function name, - * or NULL if a valid function can not be found. The client must - * check to make sure the address is not NULL, before using or - * calling the returned function address. - */ -extern CL_API_ENTRY void * CL_API_CALL -clGetExtensionFunctionAddressForPlatform(cl_platform_id /* platform */, - const char * /* func_name */) CL_API_SUFFIX__VERSION_1_2; - - -/* Deprecated OpenCL 1.1 APIs */ -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL -clCreateImage2D(cl_context /* context */, - cl_mem_flags /* flags */, - const cl_image_format * /* image_format */, - size_t /* image_width */, - size_t /* image_height */, - size_t /* image_row_pitch */, - void * /* host_ptr */, - cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL -clCreateImage3D(cl_context /* context */, - cl_mem_flags /* flags */, - const cl_image_format * /* image_format */, - size_t /* image_width */, - size_t /* image_height */, - size_t /* image_depth */, - size_t /* image_row_pitch */, - size_t /* image_slice_pitch */, - void * /* host_ptr */, - cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL -clEnqueueMarker(cl_command_queue /* command_queue */, - cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL -clEnqueueWaitForEvents(cl_command_queue /* command_queue */, - cl_uint /* num_events */, - const cl_event * /* event_list */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL -clEnqueueBarrier(cl_command_queue /* command_queue */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL -clUnloadCompiler(void) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL -clGetExtensionFunctionAddress(const char * /* func_name */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_H */ - diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_ext.h b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_ext.h deleted file mode 100644 index a998c9c519..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_ext.h +++ /dev/null @@ -1,315 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008-2013 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - ******************************************************************************/ - -/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */ - -/* cl_ext.h contains OpenCL extensions which don't have external */ -/* (OpenGL, D3D) dependencies. */ - -#ifndef __CL_EXT_H -#define __CL_EXT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __APPLE__ -#include -#endif - -#include - -/* cl_khr_fp16 extension - no extension #define since it has no functions */ -#define CL_DEVICE_HALF_FP_CONFIG 0x1033 - -/* Memory object destruction - * - * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR - * - * Registers a user callback function that will be called when the memory object is deleted and its resources - * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback - * stack associated with memobj. The registered user callback functions are called in the reverse order in - * which they were registered. The user callback functions are called and then the memory object is deleted - * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be - * notified when the memory referenced by host_ptr, specified when the memory object is created and used as - * the storage bits for the memory object, can be reused or freed. - * - * The application may not call CL api's with the cl_mem object passed to the pfn_notify. - * - * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) - * before using. - */ -#define cl_APPLE_SetMemObjectDestructor 1 -cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */, - void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), - void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; - - -/* Context Logging Functions - * - * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). - * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) - * before using. - * - * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger - */ -#define cl_APPLE_ContextLoggingFunctions 1 -extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */, - const void * /* private_info */, - size_t /* cb */, - void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; - -/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ -extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */, - const void * /* private_info */, - size_t /* cb */, - void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; - -/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ -extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */, - const void * /* private_info */, - size_t /* cb */, - void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; - - -/************************ -* cl_khr_icd extension * -************************/ -#define cl_khr_icd 1 - -/* cl_platform_info */ -#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 - -/* Additional Error Codes */ -#define CL_PLATFORM_NOT_FOUND_KHR -1001 - -extern CL_API_ENTRY cl_int CL_API_CALL -clIcdGetPlatformIDsKHR(cl_uint /* num_entries */, - cl_platform_id * /* platforms */, - cl_uint * /* num_platforms */); - -typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)( - cl_uint /* num_entries */, - cl_platform_id * /* platforms */, - cl_uint * /* num_platforms */); - - -/* Extension: cl_khr_image2D_buffer - * - * This extension allows a 2D image to be created from a cl_mem buffer without a copy. - * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t. - * Both the sampler and sampler-less read_image built-in functions are supported for 2D images - * and 2D images created from a buffer. Similarly, the write_image built-ins are also supported - * for 2D images created from a buffer. - * - * When the 2D image from buffer is created, the client must specify the width, - * height, image format (i.e. channel order and channel data type) and optionally the row pitch - * - * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels. - * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels. - */ - -/************************************* - * cl_khr_initalize_memory extension * - *************************************/ - -#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x200E - - -/************************************** - * cl_khr_terminate_context extension * - **************************************/ - -#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x200F -#define CL_CONTEXT_TERMINATE_KHR 0x2010 - -#define cl_khr_terminate_context 1 -extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2; - -typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2; - - -/* - * Extension: cl_khr_spir - * - * This extension adds support to create an OpenCL program object from a - * Standard Portable Intermediate Representation (SPIR) instance - */ - -#define CL_DEVICE_SPIR_VERSIONS 0x40E0 -#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1 - - -/****************************************** -* cl_nv_device_attribute_query extension * -******************************************/ -/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ -#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 -#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 -#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 -#define CL_DEVICE_WARP_SIZE_NV 0x4003 -#define CL_DEVICE_GPU_OVERLAP_NV 0x4004 -#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 -#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 - -/********************************* -* cl_amd_device_attribute_query * -*********************************/ -#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 - -/********************************* -* cl_arm_printf extension -*********************************/ -#define CL_PRINTF_CALLBACK_ARM 0x40B0 -#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1 - -#ifdef CL_VERSION_1_1 - /*********************************** - * cl_ext_device_fission extension * - ***********************************/ - #define cl_ext_device_fission 1 - - extern CL_API_ENTRY cl_int CL_API_CALL - clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; - - typedef CL_API_ENTRY cl_int - (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; - - extern CL_API_ENTRY cl_int CL_API_CALL - clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; - - typedef CL_API_ENTRY cl_int - (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; - - typedef cl_ulong cl_device_partition_property_ext; - extern CL_API_ENTRY cl_int CL_API_CALL - clCreateSubDevicesEXT( cl_device_id /*in_device*/, - const cl_device_partition_property_ext * /* properties */, - cl_uint /*num_entries*/, - cl_device_id * /*out_devices*/, - cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; - - typedef CL_API_ENTRY cl_int - ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/, - const cl_device_partition_property_ext * /* properties */, - cl_uint /*num_entries*/, - cl_device_id * /*out_devices*/, - cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; - - /* cl_device_partition_property_ext */ - #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 - #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 - #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 - #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 - - /* clDeviceGetInfo selectors */ - #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 - #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 - #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 - #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 - #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 - - /* error codes */ - #define CL_DEVICE_PARTITION_FAILED_EXT -1057 - #define CL_INVALID_PARTITION_COUNT_EXT -1058 - #define CL_INVALID_PARTITION_NAME_EXT -1059 - - /* CL_AFFINITY_DOMAINs */ - #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 - #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 - #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 - #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 - #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 - #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 - - /* cl_device_partition_property_ext list terminators */ - #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) - #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) - #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) - -/********************************* -* cl_qcom_ext_host_ptr extension -*********************************/ - -#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29) - -#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0 -#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1 -#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2 -#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3 -#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4 -#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5 -#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6 -#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7 - -typedef cl_uint cl_image_pitch_info_qcom; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceImageInfoQCOM(cl_device_id device, - size_t image_width, - size_t image_height, - const cl_image_format *image_format, - cl_image_pitch_info_qcom param_name, - size_t param_value_size, - void *param_value, - size_t *param_value_size_ret); - -typedef struct _cl_mem_ext_host_ptr -{ - /* Type of external memory allocation. */ - /* Legal values will be defined in layered extensions. */ - cl_uint allocation_type; - - /* Host cache policy for this external memory allocation. */ - cl_uint host_cache_policy; - -} cl_mem_ext_host_ptr; - -/********************************* -* cl_qcom_ion_host_ptr extension -*********************************/ - -#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8 - -typedef struct _cl_mem_ion_host_ptr -{ - /* Type of external memory allocation. */ - /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */ - cl_mem_ext_host_ptr ext_host_ptr; - - /* ION file descriptor */ - int ion_filedesc; - - /* Host pointer to the ION allocated memory */ - void* ion_hostptr; - -} cl_mem_ion_host_ptr; - -#endif /* CL_VERSION_1_1 */ - -#ifdef __cplusplus -} -#endif - - -#endif /* __CL_EXT_H */ diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_gl.h b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_gl.h deleted file mode 100644 index ad914cbd46..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_gl.h +++ /dev/null @@ -1,158 +0,0 @@ -/********************************************************************************** - * Copyright (c) 2008 - 2012 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - **********************************************************************************/ - -#ifndef __OPENCL_CL_GL_H -#define __OPENCL_CL_GL_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef cl_uint cl_gl_object_type; -typedef cl_uint cl_gl_texture_info; -typedef cl_uint cl_gl_platform_info; -typedef struct __GLsync *cl_GLsync; - -/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */ -#define CL_GL_OBJECT_BUFFER 0x2000 -#define CL_GL_OBJECT_TEXTURE2D 0x2001 -#define CL_GL_OBJECT_TEXTURE3D 0x2002 -#define CL_GL_OBJECT_RENDERBUFFER 0x2003 -#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E -#define CL_GL_OBJECT_TEXTURE1D 0x200F -#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010 -#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011 - -/* cl_gl_texture_info */ -#define CL_GL_TEXTURE_TARGET 0x2004 -#define CL_GL_MIPMAP_LEVEL 0x2005 -#define CL_GL_NUM_SAMPLES 0x2012 - - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromGLBuffer(cl_context /* context */, - cl_mem_flags /* flags */, - cl_GLuint /* bufobj */, - int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromGLTexture(cl_context /* context */, - cl_mem_flags /* flags */, - cl_GLenum /* target */, - cl_GLint /* miplevel */, - cl_GLuint /* texture */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromGLRenderbuffer(cl_context /* context */, - cl_mem_flags /* flags */, - cl_GLuint /* renderbuffer */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetGLObjectInfo(cl_mem /* memobj */, - cl_gl_object_type * /* gl_object_type */, - cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetGLTextureInfo(cl_mem /* memobj */, - cl_gl_texture_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */, - cl_uint /* num_objects */, - const cl_mem * /* mem_objects */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */, - cl_uint /* num_objects */, - const cl_mem * /* mem_objects */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; - - -/* Deprecated OpenCL 1.1 APIs */ -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL -clCreateFromGLTexture2D(cl_context /* context */, - cl_mem_flags /* flags */, - cl_GLenum /* target */, - cl_GLint /* miplevel */, - cl_GLuint /* texture */, - cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL -clCreateFromGLTexture3D(cl_context /* context */, - cl_mem_flags /* flags */, - cl_GLenum /* target */, - cl_GLint /* miplevel */, - cl_GLuint /* texture */, - cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; - -/* cl_khr_gl_sharing extension */ - -#define cl_khr_gl_sharing 1 - -typedef cl_uint cl_gl_context_info; - -/* Additional Error Codes */ -#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 - -/* cl_gl_context_info */ -#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006 -#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007 - -/* Additional cl_context_properties */ -#define CL_GL_CONTEXT_KHR 0x2008 -#define CL_EGL_DISPLAY_KHR 0x2009 -#define CL_GLX_DISPLAY_KHR 0x200A -#define CL_WGL_HDC_KHR 0x200B -#define CL_CGL_SHAREGROUP_KHR 0x200C - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetGLContextInfoKHR(const cl_context_properties * /* properties */, - cl_gl_context_info /* param_name */, - size_t /* param_value_size */, - void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - -typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( - const cl_context_properties * properties, - cl_gl_context_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret); - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_GL_H */ diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_gl_ext.h b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_gl_ext.h deleted file mode 100644 index 0c10fedfa4..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_gl_ext.h +++ /dev/null @@ -1,65 +0,0 @@ -/********************************************************************************** - * Copyright (c) 2008-2012 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - **********************************************************************************/ - -/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ - -/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */ -/* OpenGL dependencies. */ - -#ifndef __OPENCL_CL_GL_EXT_H -#define __OPENCL_CL_GL_EXT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* - * For each extension, follow this template - * cl_VEN_extname extension */ -/* #define cl_VEN_extname 1 - * ... define new types, if any - * ... define new tokens, if any - * ... define new APIs, if any - * - * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header - * This allows us to avoid having to decide whether to include GL headers or GLES here. - */ - -/* - * cl_khr_gl_event extension - * See section 9.9 in the OpenCL 1.1 spec for more information - */ -#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D - -extern CL_API_ENTRY cl_event CL_API_CALL -clCreateEventFromGLsyncKHR(cl_context /* context */, - cl_GLsync /* cl_GLsync */, - cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1; - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_GL_EXT_H */ diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_platform.h b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_platform.h deleted file mode 100644 index 7f6f5e8a74..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/cl_platform.h +++ /dev/null @@ -1,1278 +0,0 @@ -/********************************************************************************** - * Copyright (c) 2008-2012 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - **********************************************************************************/ - -/* $Revision: 11803 $ on $Date: 2010-06-25 10:02:12 -0700 (Fri, 25 Jun 2010) $ */ - -#ifndef __CL_PLATFORM_H -#define __CL_PLATFORM_H - -#ifdef __APPLE__ - /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */ - #include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(_WIN32) - #define CL_API_ENTRY - #define CL_API_CALL __stdcall - #define CL_CALLBACK __stdcall -#else - #define CL_API_ENTRY - #define CL_API_CALL - #define CL_CALLBACK -#endif - -#ifdef __APPLE__ - #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import)) - #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER - #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER - #define CL_API_SUFFIX__VERSION_1_1 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER - #define GCL_API_SUFFIX__VERSION_1_1 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER - #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER - #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_7 - - #ifdef AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER - #define CL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER - #define GCL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER - #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER - #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED - #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_8 - #else - #warning This path should never happen outside of internal operating system development. AvailabilityMacros do not function correctly here! - #define CL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER - #define GCL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER - #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER - #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER - #endif -#else - #define CL_EXTENSION_WEAK_LINK - #define CL_API_SUFFIX__VERSION_1_0 - #define CL_EXT_SUFFIX__VERSION_1_0 - #define CL_API_SUFFIX__VERSION_1_1 - #define CL_EXT_SUFFIX__VERSION_1_1 - #define CL_API_SUFFIX__VERSION_1_2 - #define CL_EXT_SUFFIX__VERSION_1_2 - - #ifdef __GNUC__ - #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS - #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED - #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED - #else - #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated)) - #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED - #endif - - #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS - #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED - #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED - #else - #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated)) - #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED - #endif - #elif _WIN32 - #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS - #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED - #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED - #else - #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED - #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated) - #endif - - #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS - #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED - #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED - #else - #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED - #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated) - #endif - #else - #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED - #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED - - #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED - #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED - #endif -#endif - -#if (defined (_WIN32) && defined(_MSC_VER)) - -/* scalar types */ -typedef signed __int8 cl_char; -typedef unsigned __int8 cl_uchar; -typedef signed __int16 cl_short; -typedef unsigned __int16 cl_ushort; -typedef signed __int32 cl_int; -typedef unsigned __int32 cl_uint; -typedef signed __int64 cl_long; -typedef unsigned __int64 cl_ulong; - -typedef unsigned __int16 cl_half; -typedef float cl_float; -typedef double cl_double; - -/* Macro names and corresponding values defined by OpenCL */ -#define CL_CHAR_BIT 8 -#define CL_SCHAR_MAX 127 -#define CL_SCHAR_MIN (-127-1) -#define CL_CHAR_MAX CL_SCHAR_MAX -#define CL_CHAR_MIN CL_SCHAR_MIN -#define CL_UCHAR_MAX 255 -#define CL_SHRT_MAX 32767 -#define CL_SHRT_MIN (-32767-1) -#define CL_USHRT_MAX 65535 -#define CL_INT_MAX 2147483647 -#define CL_INT_MIN (-2147483647-1) -#define CL_UINT_MAX 0xffffffffU -#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL) -#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL) -#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL) - -#define CL_FLT_DIG 6 -#define CL_FLT_MANT_DIG 24 -#define CL_FLT_MAX_10_EXP +38 -#define CL_FLT_MAX_EXP +128 -#define CL_FLT_MIN_10_EXP -37 -#define CL_FLT_MIN_EXP -125 -#define CL_FLT_RADIX 2 -#define CL_FLT_MAX 340282346638528859811704183484516925440.0f -#define CL_FLT_MIN 1.175494350822287507969e-38f -#define CL_FLT_EPSILON 0x1.0p-23f - -#define CL_DBL_DIG 15 -#define CL_DBL_MANT_DIG 53 -#define CL_DBL_MAX_10_EXP +308 -#define CL_DBL_MAX_EXP +1024 -#define CL_DBL_MIN_10_EXP -307 -#define CL_DBL_MIN_EXP -1021 -#define CL_DBL_RADIX 2 -#define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 -#define CL_DBL_MIN 2.225073858507201383090e-308 -#define CL_DBL_EPSILON 2.220446049250313080847e-16 - -#define CL_M_E 2.718281828459045090796 -#define CL_M_LOG2E 1.442695040888963387005 -#define CL_M_LOG10E 0.434294481903251816668 -#define CL_M_LN2 0.693147180559945286227 -#define CL_M_LN10 2.302585092994045901094 -#define CL_M_PI 3.141592653589793115998 -#define CL_M_PI_2 1.570796326794896557999 -#define CL_M_PI_4 0.785398163397448278999 -#define CL_M_1_PI 0.318309886183790691216 -#define CL_M_2_PI 0.636619772367581382433 -#define CL_M_2_SQRTPI 1.128379167095512558561 -#define CL_M_SQRT2 1.414213562373095145475 -#define CL_M_SQRT1_2 0.707106781186547572737 - -#define CL_M_E_F 2.71828174591064f -#define CL_M_LOG2E_F 1.44269502162933f -#define CL_M_LOG10E_F 0.43429449200630f -#define CL_M_LN2_F 0.69314718246460f -#define CL_M_LN10_F 2.30258512496948f -#define CL_M_PI_F 3.14159274101257f -#define CL_M_PI_2_F 1.57079637050629f -#define CL_M_PI_4_F 0.78539818525314f -#define CL_M_1_PI_F 0.31830987334251f -#define CL_M_2_PI_F 0.63661974668503f -#define CL_M_2_SQRTPI_F 1.12837922573090f -#define CL_M_SQRT2_F 1.41421353816986f -#define CL_M_SQRT1_2_F 0.70710676908493f - -#define CL_NAN (CL_INFINITY - CL_INFINITY) -#define CL_HUGE_VALF ((cl_float) 1e50) -#define CL_HUGE_VAL ((cl_double) 1e500) -#define CL_MAXFLOAT CL_FLT_MAX -#define CL_INFINITY CL_HUGE_VALF - -#else - -#include - -/* scalar types */ -typedef int8_t cl_char; -typedef uint8_t cl_uchar; -typedef int16_t cl_short __attribute__((aligned(2))); -typedef uint16_t cl_ushort __attribute__((aligned(2))); -typedef int32_t cl_int __attribute__((aligned(4))); -typedef uint32_t cl_uint __attribute__((aligned(4))); -typedef int64_t cl_long __attribute__((aligned(8))); -typedef uint64_t cl_ulong __attribute__((aligned(8))); - -typedef uint16_t cl_half __attribute__((aligned(2))); -typedef float cl_float __attribute__((aligned(4))); -typedef double cl_double __attribute__((aligned(8))); - -/* Macro names and corresponding values defined by OpenCL */ -#define CL_CHAR_BIT 8 -#define CL_SCHAR_MAX 127 -#define CL_SCHAR_MIN (-127-1) -#define CL_CHAR_MAX CL_SCHAR_MAX -#define CL_CHAR_MIN CL_SCHAR_MIN -#define CL_UCHAR_MAX 255 -#define CL_SHRT_MAX 32767 -#define CL_SHRT_MIN (-32767-1) -#define CL_USHRT_MAX 65535 -#define CL_INT_MAX 2147483647 -#define CL_INT_MIN (-2147483647-1) -#define CL_UINT_MAX 0xffffffffU -#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL) -#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL) -#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL) - -#define CL_FLT_DIG 6 -#define CL_FLT_MANT_DIG 24 -#define CL_FLT_MAX_10_EXP +38 -#define CL_FLT_MAX_EXP +128 -#define CL_FLT_MIN_10_EXP -37 -#define CL_FLT_MIN_EXP -125 -#define CL_FLT_RADIX 2 -#define CL_FLT_MAX 0x1.fffffep127f -#define CL_FLT_MIN 0x1.0p-126f -#define CL_FLT_EPSILON 0x1.0p-23f - -#define CL_DBL_DIG 15 -#define CL_DBL_MANT_DIG 53 -#define CL_DBL_MAX_10_EXP +308 -#define CL_DBL_MAX_EXP +1024 -#define CL_DBL_MIN_10_EXP -307 -#define CL_DBL_MIN_EXP -1021 -#define CL_DBL_RADIX 2 -#define CL_DBL_MAX 0x1.fffffffffffffp1023 -#define CL_DBL_MIN 0x1.0p-1022 -#define CL_DBL_EPSILON 0x1.0p-52 - -#define CL_M_E 2.718281828459045090796 -#define CL_M_LOG2E 1.442695040888963387005 -#define CL_M_LOG10E 0.434294481903251816668 -#define CL_M_LN2 0.693147180559945286227 -#define CL_M_LN10 2.302585092994045901094 -#define CL_M_PI 3.141592653589793115998 -#define CL_M_PI_2 1.570796326794896557999 -#define CL_M_PI_4 0.785398163397448278999 -#define CL_M_1_PI 0.318309886183790691216 -#define CL_M_2_PI 0.636619772367581382433 -#define CL_M_2_SQRTPI 1.128379167095512558561 -#define CL_M_SQRT2 1.414213562373095145475 -#define CL_M_SQRT1_2 0.707106781186547572737 - -#define CL_M_E_F 2.71828174591064f -#define CL_M_LOG2E_F 1.44269502162933f -#define CL_M_LOG10E_F 0.43429449200630f -#define CL_M_LN2_F 0.69314718246460f -#define CL_M_LN10_F 2.30258512496948f -#define CL_M_PI_F 3.14159274101257f -#define CL_M_PI_2_F 1.57079637050629f -#define CL_M_PI_4_F 0.78539818525314f -#define CL_M_1_PI_F 0.31830987334251f -#define CL_M_2_PI_F 0.63661974668503f -#define CL_M_2_SQRTPI_F 1.12837922573090f -#define CL_M_SQRT2_F 1.41421353816986f -#define CL_M_SQRT1_2_F 0.70710676908493f - -#if defined( __GNUC__ ) - #define CL_HUGE_VALF __builtin_huge_valf() - #define CL_HUGE_VAL __builtin_huge_val() - #define CL_NAN __builtin_nanf( "" ) -#else - #define CL_HUGE_VALF ((cl_float) 1e50) - #define CL_HUGE_VAL ((cl_double) 1e500) - float nanf( const char * ); - #define CL_NAN nanf( "" ) -#endif -#define CL_MAXFLOAT CL_FLT_MAX -#define CL_INFINITY CL_HUGE_VALF - -#endif - -#include - -/* Mirror types to GL types. Mirror types allow us to avoid deciding which 87s to load based on whether we are using GL or GLES here. */ -typedef unsigned int cl_GLuint; -typedef int cl_GLint; -typedef unsigned int cl_GLenum; - -/* - * Vector types - * - * Note: OpenCL requires that all types be naturally aligned. - * This means that vector types must be naturally aligned. - * For example, a vector of four floats must be aligned to - * a 16 byte boundary (calculated as 4 * the natural 4-byte - * alignment of the float). The alignment qualifiers here - * will only function properly if your compiler supports them - * and if you don't actively work to defeat them. For example, - * in order for a cl_float4 to be 16 byte aligned in a struct, - * the start of the struct must itself be 16-byte aligned. - * - * Maintaining proper alignment is the user's responsibility. - */ - -/* Define basic vector types */ -#if defined( __VEC__ ) - #include /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */ - typedef vector unsigned char __cl_uchar16; - typedef vector signed char __cl_char16; - typedef vector unsigned short __cl_ushort8; - typedef vector signed short __cl_short8; - typedef vector unsigned int __cl_uint4; - typedef vector signed int __cl_int4; - typedef vector float __cl_float4; - #define __CL_UCHAR16__ 1 - #define __CL_CHAR16__ 1 - #define __CL_USHORT8__ 1 - #define __CL_SHORT8__ 1 - #define __CL_UINT4__ 1 - #define __CL_INT4__ 1 - #define __CL_FLOAT4__ 1 -#endif - -#if defined( __SSE__ ) - #if defined( __MINGW64__ ) - #include - #else - #include - #endif - #if defined( __GNUC__ ) - typedef float __cl_float4 __attribute__((vector_size(16))); - #else - typedef __m128 __cl_float4; - #endif - #define __CL_FLOAT4__ 1 -#endif - -#if defined( __SSE2__ ) - #if defined( __MINGW64__ ) - #include - #else - #include - #endif - #if defined( __GNUC__ ) - typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16))); - typedef cl_char __cl_char16 __attribute__((vector_size(16))); - typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16))); - typedef cl_short __cl_short8 __attribute__((vector_size(16))); - typedef cl_uint __cl_uint4 __attribute__((vector_size(16))); - typedef cl_int __cl_int4 __attribute__((vector_size(16))); - typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16))); - typedef cl_long __cl_long2 __attribute__((vector_size(16))); - typedef cl_double __cl_double2 __attribute__((vector_size(16))); - #else - typedef __m128i __cl_uchar16; - typedef __m128i __cl_char16; - typedef __m128i __cl_ushort8; - typedef __m128i __cl_short8; - typedef __m128i __cl_uint4; - typedef __m128i __cl_int4; - typedef __m128i __cl_ulong2; - typedef __m128i __cl_long2; - typedef __m128d __cl_double2; - #endif - #define __CL_UCHAR16__ 1 - #define __CL_CHAR16__ 1 - #define __CL_USHORT8__ 1 - #define __CL_SHORT8__ 1 - #define __CL_INT4__ 1 - #define __CL_UINT4__ 1 - #define __CL_ULONG2__ 1 - #define __CL_LONG2__ 1 - #define __CL_DOUBLE2__ 1 -#endif - -#if defined( __MMX__ ) - #include - #if defined( __GNUC__ ) - typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8))); - typedef cl_char __cl_char8 __attribute__((vector_size(8))); - typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8))); - typedef cl_short __cl_short4 __attribute__((vector_size(8))); - typedef cl_uint __cl_uint2 __attribute__((vector_size(8))); - typedef cl_int __cl_int2 __attribute__((vector_size(8))); - typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8))); - typedef cl_long __cl_long1 __attribute__((vector_size(8))); - typedef cl_float __cl_float2 __attribute__((vector_size(8))); - #else - typedef __m64 __cl_uchar8; - typedef __m64 __cl_char8; - typedef __m64 __cl_ushort4; - typedef __m64 __cl_short4; - typedef __m64 __cl_uint2; - typedef __m64 __cl_int2; - typedef __m64 __cl_ulong1; - typedef __m64 __cl_long1; - typedef __m64 __cl_float2; - #endif - #define __CL_UCHAR8__ 1 - #define __CL_CHAR8__ 1 - #define __CL_USHORT4__ 1 - #define __CL_SHORT4__ 1 - #define __CL_INT2__ 1 - #define __CL_UINT2__ 1 - #define __CL_ULONG1__ 1 - #define __CL_LONG1__ 1 - #define __CL_FLOAT2__ 1 -#endif - -#if defined( __AVX__ ) - #if defined( __MINGW64__ ) - #include - #else - #include - #endif - #if defined( __GNUC__ ) - typedef cl_float __cl_float8 __attribute__((vector_size(32))); - typedef cl_double __cl_double4 __attribute__((vector_size(32))); - #else - typedef __m256 __cl_float8; - typedef __m256d __cl_double4; - #endif - #define __CL_FLOAT8__ 1 - #define __CL_DOUBLE4__ 1 -#endif - -/* Define capabilities for anonymous struct members. */ -#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) -#define __CL_HAS_ANON_STRUCT__ 1 -#define __CL_ANON_STRUCT__ __extension__ -#elif defined( _WIN32) && (_MSC_VER >= 1500) - /* Microsoft Developer Studio 2008 supports anonymous structs, but - * complains by default. */ -#define __CL_HAS_ANON_STRUCT__ 1 -#define __CL_ANON_STRUCT__ - /* Disable warning C4201: nonstandard extension used : nameless - * struct/union */ -#pragma warning( push ) -#pragma warning( disable : 4201 ) -#else -#define __CL_HAS_ANON_STRUCT__ 0 -#define __CL_ANON_STRUCT__ -#endif - -/* Define alignment keys */ -#if defined( __GNUC__ ) - #define CL_ALIGNED(_x) __attribute__ ((aligned(_x))) -#elif defined( _WIN32) && (_MSC_VER) - /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */ - /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */ - /* #include */ - /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */ - #define CL_ALIGNED(_x) -#else - #warning Need to implement some method to align data here - #define CL_ALIGNED(_x) -#endif - -/* Indicate whether .xyzw, .s0123 and .hi.lo are supported */ -#if __CL_HAS_ANON_STRUCT__ - /* .xyzw and .s0123...{f|F} are supported */ - #define CL_HAS_NAMED_VECTOR_FIELDS 1 - /* .hi and .lo are supported */ - #define CL_HAS_HI_LO_VECTOR_FIELDS 1 -#endif - -/* Define cl_vector types */ - -/* ---- cl_charn ---- */ -typedef union -{ - cl_char CL_ALIGNED(2) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_char x, y; }; - __CL_ANON_STRUCT__ struct{ cl_char s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_char lo, hi; }; -#endif -#if defined( __CL_CHAR2__) - __cl_char2 v2; -#endif -}cl_char2; - -typedef union -{ - cl_char CL_ALIGNED(4) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_char2 lo, hi; }; -#endif -#if defined( __CL_CHAR2__) - __cl_char2 v2[2]; -#endif -#if defined( __CL_CHAR4__) - __cl_char4 v4; -#endif -}cl_char4; - -/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */ -typedef cl_char4 cl_char3; - -typedef union -{ - cl_char CL_ALIGNED(8) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_char4 lo, hi; }; -#endif -#if defined( __CL_CHAR2__) - __cl_char2 v2[4]; -#endif -#if defined( __CL_CHAR4__) - __cl_char4 v4[2]; -#endif -#if defined( __CL_CHAR8__ ) - __cl_char8 v8; -#endif -}cl_char8; - -typedef union -{ - cl_char CL_ALIGNED(16) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_char8 lo, hi; }; -#endif -#if defined( __CL_CHAR2__) - __cl_char2 v2[8]; -#endif -#if defined( __CL_CHAR4__) - __cl_char4 v4[4]; -#endif -#if defined( __CL_CHAR8__ ) - __cl_char8 v8[2]; -#endif -#if defined( __CL_CHAR16__ ) - __cl_char16 v16; -#endif -}cl_char16; - - -/* ---- cl_ucharn ---- */ -typedef union -{ - cl_uchar CL_ALIGNED(2) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_uchar x, y; }; - __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_uchar lo, hi; }; -#endif -#if defined( __cl_uchar2__) - __cl_uchar2 v2; -#endif -}cl_uchar2; - -typedef union -{ - cl_uchar CL_ALIGNED(4) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_uchar2 lo, hi; }; -#endif -#if defined( __CL_UCHAR2__) - __cl_uchar2 v2[2]; -#endif -#if defined( __CL_UCHAR4__) - __cl_uchar4 v4; -#endif -}cl_uchar4; - -/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */ -typedef cl_uchar4 cl_uchar3; - -typedef union -{ - cl_uchar CL_ALIGNED(8) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_uchar4 lo, hi; }; -#endif -#if defined( __CL_UCHAR2__) - __cl_uchar2 v2[4]; -#endif -#if defined( __CL_UCHAR4__) - __cl_uchar4 v4[2]; -#endif -#if defined( __CL_UCHAR8__ ) - __cl_uchar8 v8; -#endif -}cl_uchar8; - -typedef union -{ - cl_uchar CL_ALIGNED(16) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_uchar8 lo, hi; }; -#endif -#if defined( __CL_UCHAR2__) - __cl_uchar2 v2[8]; -#endif -#if defined( __CL_UCHAR4__) - __cl_uchar4 v4[4]; -#endif -#if defined( __CL_UCHAR8__ ) - __cl_uchar8 v8[2]; -#endif -#if defined( __CL_UCHAR16__ ) - __cl_uchar16 v16; -#endif -}cl_uchar16; - - -/* ---- cl_shortn ---- */ -typedef union -{ - cl_short CL_ALIGNED(4) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_short x, y; }; - __CL_ANON_STRUCT__ struct{ cl_short s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_short lo, hi; }; -#endif -#if defined( __CL_SHORT2__) - __cl_short2 v2; -#endif -}cl_short2; - -typedef union -{ - cl_short CL_ALIGNED(8) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_short2 lo, hi; }; -#endif -#if defined( __CL_SHORT2__) - __cl_short2 v2[2]; -#endif -#if defined( __CL_SHORT4__) - __cl_short4 v4; -#endif -}cl_short4; - -/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */ -typedef cl_short4 cl_short3; - -typedef union -{ - cl_short CL_ALIGNED(16) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_short4 lo, hi; }; -#endif -#if defined( __CL_SHORT2__) - __cl_short2 v2[4]; -#endif -#if defined( __CL_SHORT4__) - __cl_short4 v4[2]; -#endif -#if defined( __CL_SHORT8__ ) - __cl_short8 v8; -#endif -}cl_short8; - -typedef union -{ - cl_short CL_ALIGNED(32) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_short8 lo, hi; }; -#endif -#if defined( __CL_SHORT2__) - __cl_short2 v2[8]; -#endif -#if defined( __CL_SHORT4__) - __cl_short4 v4[4]; -#endif -#if defined( __CL_SHORT8__ ) - __cl_short8 v8[2]; -#endif -#if defined( __CL_SHORT16__ ) - __cl_short16 v16; -#endif -}cl_short16; - - -/* ---- cl_ushortn ---- */ -typedef union -{ - cl_ushort CL_ALIGNED(4) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_ushort x, y; }; - __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_ushort lo, hi; }; -#endif -#if defined( __CL_USHORT2__) - __cl_ushort2 v2; -#endif -}cl_ushort2; - -typedef union -{ - cl_ushort CL_ALIGNED(8) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_ushort2 lo, hi; }; -#endif -#if defined( __CL_USHORT2__) - __cl_ushort2 v2[2]; -#endif -#if defined( __CL_USHORT4__) - __cl_ushort4 v4; -#endif -}cl_ushort4; - -/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */ -typedef cl_ushort4 cl_ushort3; - -typedef union -{ - cl_ushort CL_ALIGNED(16) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_ushort4 lo, hi; }; -#endif -#if defined( __CL_USHORT2__) - __cl_ushort2 v2[4]; -#endif -#if defined( __CL_USHORT4__) - __cl_ushort4 v4[2]; -#endif -#if defined( __CL_USHORT8__ ) - __cl_ushort8 v8; -#endif -}cl_ushort8; - -typedef union -{ - cl_ushort CL_ALIGNED(32) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_ushort8 lo, hi; }; -#endif -#if defined( __CL_USHORT2__) - __cl_ushort2 v2[8]; -#endif -#if defined( __CL_USHORT4__) - __cl_ushort4 v4[4]; -#endif -#if defined( __CL_USHORT8__ ) - __cl_ushort8 v8[2]; -#endif -#if defined( __CL_USHORT16__ ) - __cl_ushort16 v16; -#endif -}cl_ushort16; - -/* ---- cl_intn ---- */ -typedef union -{ - cl_int CL_ALIGNED(8) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_int x, y; }; - __CL_ANON_STRUCT__ struct{ cl_int s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_int lo, hi; }; -#endif -#if defined( __CL_INT2__) - __cl_int2 v2; -#endif -}cl_int2; - -typedef union -{ - cl_int CL_ALIGNED(16) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_int2 lo, hi; }; -#endif -#if defined( __CL_INT2__) - __cl_int2 v2[2]; -#endif -#if defined( __CL_INT4__) - __cl_int4 v4; -#endif -}cl_int4; - -/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */ -typedef cl_int4 cl_int3; - -typedef union -{ - cl_int CL_ALIGNED(32) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_int4 lo, hi; }; -#endif -#if defined( __CL_INT2__) - __cl_int2 v2[4]; -#endif -#if defined( __CL_INT4__) - __cl_int4 v4[2]; -#endif -#if defined( __CL_INT8__ ) - __cl_int8 v8; -#endif -}cl_int8; - -typedef union -{ - cl_int CL_ALIGNED(64) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_int8 lo, hi; }; -#endif -#if defined( __CL_INT2__) - __cl_int2 v2[8]; -#endif -#if defined( __CL_INT4__) - __cl_int4 v4[4]; -#endif -#if defined( __CL_INT8__ ) - __cl_int8 v8[2]; -#endif -#if defined( __CL_INT16__ ) - __cl_int16 v16; -#endif -}cl_int16; - - -/* ---- cl_uintn ---- */ -typedef union -{ - cl_uint CL_ALIGNED(8) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_uint x, y; }; - __CL_ANON_STRUCT__ struct{ cl_uint s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_uint lo, hi; }; -#endif -#if defined( __CL_UINT2__) - __cl_uint2 v2; -#endif -}cl_uint2; - -typedef union -{ - cl_uint CL_ALIGNED(16) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_uint2 lo, hi; }; -#endif -#if defined( __CL_UINT2__) - __cl_uint2 v2[2]; -#endif -#if defined( __CL_UINT4__) - __cl_uint4 v4; -#endif -}cl_uint4; - -/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */ -typedef cl_uint4 cl_uint3; - -typedef union -{ - cl_uint CL_ALIGNED(32) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_uint4 lo, hi; }; -#endif -#if defined( __CL_UINT2__) - __cl_uint2 v2[4]; -#endif -#if defined( __CL_UINT4__) - __cl_uint4 v4[2]; -#endif -#if defined( __CL_UINT8__ ) - __cl_uint8 v8; -#endif -}cl_uint8; - -typedef union -{ - cl_uint CL_ALIGNED(64) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_uint8 lo, hi; }; -#endif -#if defined( __CL_UINT2__) - __cl_uint2 v2[8]; -#endif -#if defined( __CL_UINT4__) - __cl_uint4 v4[4]; -#endif -#if defined( __CL_UINT8__ ) - __cl_uint8 v8[2]; -#endif -#if defined( __CL_UINT16__ ) - __cl_uint16 v16; -#endif -}cl_uint16; - -/* ---- cl_longn ---- */ -typedef union -{ - cl_long CL_ALIGNED(16) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_long x, y; }; - __CL_ANON_STRUCT__ struct{ cl_long s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_long lo, hi; }; -#endif -#if defined( __CL_LONG2__) - __cl_long2 v2; -#endif -}cl_long2; - -typedef union -{ - cl_long CL_ALIGNED(32) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_long2 lo, hi; }; -#endif -#if defined( __CL_LONG2__) - __cl_long2 v2[2]; -#endif -#if defined( __CL_LONG4__) - __cl_long4 v4; -#endif -}cl_long4; - -/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */ -typedef cl_long4 cl_long3; - -typedef union -{ - cl_long CL_ALIGNED(64) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_long4 lo, hi; }; -#endif -#if defined( __CL_LONG2__) - __cl_long2 v2[4]; -#endif -#if defined( __CL_LONG4__) - __cl_long4 v4[2]; -#endif -#if defined( __CL_LONG8__ ) - __cl_long8 v8; -#endif -}cl_long8; - -typedef union -{ - cl_long CL_ALIGNED(128) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_long8 lo, hi; }; -#endif -#if defined( __CL_LONG2__) - __cl_long2 v2[8]; -#endif -#if defined( __CL_LONG4__) - __cl_long4 v4[4]; -#endif -#if defined( __CL_LONG8__ ) - __cl_long8 v8[2]; -#endif -#if defined( __CL_LONG16__ ) - __cl_long16 v16; -#endif -}cl_long16; - - -/* ---- cl_ulongn ---- */ -typedef union -{ - cl_ulong CL_ALIGNED(16) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_ulong x, y; }; - __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_ulong lo, hi; }; -#endif -#if defined( __CL_ULONG2__) - __cl_ulong2 v2; -#endif -}cl_ulong2; - -typedef union -{ - cl_ulong CL_ALIGNED(32) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_ulong2 lo, hi; }; -#endif -#if defined( __CL_ULONG2__) - __cl_ulong2 v2[2]; -#endif -#if defined( __CL_ULONG4__) - __cl_ulong4 v4; -#endif -}cl_ulong4; - -/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */ -typedef cl_ulong4 cl_ulong3; - -typedef union -{ - cl_ulong CL_ALIGNED(64) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_ulong4 lo, hi; }; -#endif -#if defined( __CL_ULONG2__) - __cl_ulong2 v2[4]; -#endif -#if defined( __CL_ULONG4__) - __cl_ulong4 v4[2]; -#endif -#if defined( __CL_ULONG8__ ) - __cl_ulong8 v8; -#endif -}cl_ulong8; - -typedef union -{ - cl_ulong CL_ALIGNED(128) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_ulong8 lo, hi; }; -#endif -#if defined( __CL_ULONG2__) - __cl_ulong2 v2[8]; -#endif -#if defined( __CL_ULONG4__) - __cl_ulong4 v4[4]; -#endif -#if defined( __CL_ULONG8__ ) - __cl_ulong8 v8[2]; -#endif -#if defined( __CL_ULONG16__ ) - __cl_ulong16 v16; -#endif -}cl_ulong16; - - -/* --- cl_floatn ---- */ - -typedef union -{ - cl_float CL_ALIGNED(8) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_float x, y; }; - __CL_ANON_STRUCT__ struct{ cl_float s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_float lo, hi; }; -#endif -#if defined( __CL_FLOAT2__) - __cl_float2 v2; -#endif -}cl_float2; - -typedef union -{ - cl_float CL_ALIGNED(16) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_float2 lo, hi; }; -#endif -#if defined( __CL_FLOAT2__) - __cl_float2 v2[2]; -#endif -#if defined( __CL_FLOAT4__) - __cl_float4 v4; -#endif -}cl_float4; - -/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */ -typedef cl_float4 cl_float3; - -typedef union -{ - cl_float CL_ALIGNED(32) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_float4 lo, hi; }; -#endif -#if defined( __CL_FLOAT2__) - __cl_float2 v2[4]; -#endif -#if defined( __CL_FLOAT4__) - __cl_float4 v4[2]; -#endif -#if defined( __CL_FLOAT8__ ) - __cl_float8 v8; -#endif -}cl_float8; - -typedef union -{ - cl_float CL_ALIGNED(64) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_float8 lo, hi; }; -#endif -#if defined( __CL_FLOAT2__) - __cl_float2 v2[8]; -#endif -#if defined( __CL_FLOAT4__) - __cl_float4 v4[4]; -#endif -#if defined( __CL_FLOAT8__ ) - __cl_float8 v8[2]; -#endif -#if defined( __CL_FLOAT16__ ) - __cl_float16 v16; -#endif -}cl_float16; - -/* --- cl_doublen ---- */ - -typedef union -{ - cl_double CL_ALIGNED(16) s[2]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_double x, y; }; - __CL_ANON_STRUCT__ struct{ cl_double s0, s1; }; - __CL_ANON_STRUCT__ struct{ cl_double lo, hi; }; -#endif -#if defined( __CL_DOUBLE2__) - __cl_double2 v2; -#endif -}cl_double2; - -typedef union -{ - cl_double CL_ALIGNED(32) s[4]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3; }; - __CL_ANON_STRUCT__ struct{ cl_double2 lo, hi; }; -#endif -#if defined( __CL_DOUBLE2__) - __cl_double2 v2[2]; -#endif -#if defined( __CL_DOUBLE4__) - __cl_double4 v4; -#endif -}cl_double4; - -/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */ -typedef cl_double4 cl_double3; - -typedef union -{ - cl_double CL_ALIGNED(64) s[8]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; }; - __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; }; - __CL_ANON_STRUCT__ struct{ cl_double4 lo, hi; }; -#endif -#if defined( __CL_DOUBLE2__) - __cl_double2 v2[4]; -#endif -#if defined( __CL_DOUBLE4__) - __cl_double4 v4[2]; -#endif -#if defined( __CL_DOUBLE8__ ) - __cl_double8 v8; -#endif -}cl_double8; - -typedef union -{ - cl_double CL_ALIGNED(128) s[16]; -#if __CL_HAS_ANON_STRUCT__ - __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; - __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; - __CL_ANON_STRUCT__ struct{ cl_double8 lo, hi; }; -#endif -#if defined( __CL_DOUBLE2__) - __cl_double2 v2[8]; -#endif -#if defined( __CL_DOUBLE4__) - __cl_double4 v4[4]; -#endif -#if defined( __CL_DOUBLE8__ ) - __cl_double8 v8[2]; -#endif -#if defined( __CL_DOUBLE16__ ) - __cl_double16 v16; -#endif -}cl_double16; - -/* Macro to facilitate debugging - * Usage: - * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source. - * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \" - * Each line thereafter of OpenCL C source must end with: \n\ - * The last line ends in "; - * - * Example: - * - * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\ - * kernel void foo( int a, float * b ) \n\ - * { \n\ - * // my comment \n\ - * *b[ get_global_id(0)] = a; \n\ - * } \n\ - * "; - * - * This should correctly set up the line, (column) and file information for your source - * string so you can do source level debugging. - */ -#define __CL_STRINGIFY( _x ) # _x -#define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x ) -#define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n" - -#ifdef __cplusplus -} -#endif - -#undef __CL_HAS_ANON_STRUCT__ -#undef __CL_ANON_STRUCT__ -#if defined( _WIN32) && (_MSC_VER >= 1500) -#pragma warning( pop ) -#endif - -#endif /* __CL_PLATFORM_H */ diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/opencl.h b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/opencl.h deleted file mode 100644 index fccacd168c..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/headers/1.2/opencl.h +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008-2012 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - ******************************************************************************/ - -/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ - -#ifndef __OPENCL_H -#define __OPENCL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_H */ - diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/image.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/image.go deleted file mode 100644 index d6a9963770..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/image.go +++ /dev/null @@ -1,83 +0,0 @@ -// +build cl12 - -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" -import ( - "image" - "unsafe" -) - -func (ctx *Context) CreateImage(flags MemFlag, imageFormat ImageFormat, imageDesc ImageDescription, data []byte) (*MemObject, error) { - format := imageFormat.toCl() - desc := imageDesc.toCl() - var dataPtr unsafe.Pointer - if data != nil { - dataPtr = unsafe.Pointer(&data[0]) - } - var err C.cl_int - clBuffer := C.clCreateImage(ctx.clContext, C.cl_mem_flags(flags), &format, &desc, dataPtr, &err) - if err != C.CL_SUCCESS { - return nil, toError(err) - } - if clBuffer == nil { - return nil, ErrUnknown - } - return newMemObject(clBuffer, len(data)), nil -} - -func (ctx *Context) CreateImageSimple(flags MemFlag, width, height int, channelOrder ChannelOrder, channelDataType ChannelDataType, data []byte) (*MemObject, error) { - format := ImageFormat{channelOrder, channelDataType} - desc := ImageDescription{ - Type: MemObjectTypeImage2D, - Width: width, - Height: height, - } - return ctx.CreateImage(flags, format, desc, data) -} - -func (ctx *Context) CreateImageFromImage(flags MemFlag, img image.Image) (*MemObject, error) { - switch m := img.(type) { - case *image.Gray: - format := ImageFormat{ChannelOrderIntensity, ChannelDataTypeUNormInt8} - desc := ImageDescription{ - Type: MemObjectTypeImage2D, - Width: m.Bounds().Dx(), - Height: m.Bounds().Dy(), - RowPitch: m.Stride, - } - return ctx.CreateImage(flags, format, desc, m.Pix) - case *image.RGBA: - format := ImageFormat{ChannelOrderRGBA, ChannelDataTypeUNormInt8} - desc := ImageDescription{ - Type: MemObjectTypeImage2D, - Width: m.Bounds().Dx(), - Height: m.Bounds().Dy(), - RowPitch: m.Stride, - } - return ctx.CreateImage(flags, format, desc, m.Pix) - } - - b := img.Bounds() - w := b.Dx() - h := b.Dy() - data := make([]byte, w*h*4) - dataOffset := 0 - for y := 0; y < h; y++ { - for x := 0; x < w; x++ { - c := img.At(x+b.Min.X, y+b.Min.Y) - r, g, b, a := c.RGBA() - data[dataOffset] = uint8(r >> 8) - data[dataOffset+1] = uint8(g >> 8) - data[dataOffset+2] = uint8(b >> 8) - data[dataOffset+3] = uint8(a >> 8) - dataOffset += 4 - } - } - return ctx.CreateImageSimple(flags, w, h, ChannelOrderRGBA, ChannelDataTypeUNormInt8, data) -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel.go deleted file mode 100644 index 894a775e80..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel.go +++ /dev/null @@ -1,127 +0,0 @@ -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" - -import ( - "fmt" - "unsafe" -) - -type ErrUnsupportedArgumentType struct { - Index int - Value interface{} -} - -func (e ErrUnsupportedArgumentType) Error() string { - return fmt.Sprintf("cl: unsupported argument type for index %d: %+v", e.Index, e.Value) -} - -type Kernel struct { - clKernel C.cl_kernel - name string -} - -type LocalBuffer int - -func releaseKernel(k *Kernel) { - if k.clKernel != nil { - C.clReleaseKernel(k.clKernel) - k.clKernel = nil - } -} - -func (k *Kernel) Release() { - releaseKernel(k) -} - -func (k *Kernel) SetArgs(args ...interface{}) error { - for index, arg := range args { - if err := k.SetArg(index, arg); err != nil { - return err - } - } - return nil -} - -func (k *Kernel) SetArg(index int, arg interface{}) error { - switch val := arg.(type) { - case uint8: - return k.SetArgUint8(index, val) - case int8: - return k.SetArgInt8(index, val) - case uint32: - return k.SetArgUint32(index, val) - case uint64: - return k.SetArgUint64(index, val) - case int32: - return k.SetArgInt32(index, val) - case float32: - return k.SetArgFloat32(index, val) - case *MemObject: - return k.SetArgBuffer(index, val) - case LocalBuffer: - return k.SetArgLocal(index, int(val)) - default: - return ErrUnsupportedArgumentType{Index: index, Value: arg} - } -} - -func (k *Kernel) SetArgBuffer(index int, buffer *MemObject) error { - return k.SetArgUnsafe(index, int(unsafe.Sizeof(buffer.clMem)), unsafe.Pointer(&buffer.clMem)) -} - -func (k *Kernel) SetArgFloat32(index int, val float32) error { - return k.SetArgUnsafe(index, int(unsafe.Sizeof(val)), unsafe.Pointer(&val)) -} - -func (k *Kernel) SetArgInt8(index int, val int8) error { - return k.SetArgUnsafe(index, int(unsafe.Sizeof(val)), unsafe.Pointer(&val)) -} - -func (k *Kernel) SetArgUint8(index int, val uint8) error { - return k.SetArgUnsafe(index, int(unsafe.Sizeof(val)), unsafe.Pointer(&val)) -} - -func (k *Kernel) SetArgInt32(index int, val int32) error { - return k.SetArgUnsafe(index, int(unsafe.Sizeof(val)), unsafe.Pointer(&val)) -} - -func (k *Kernel) SetArgUint32(index int, val uint32) error { - return k.SetArgUnsafe(index, int(unsafe.Sizeof(val)), unsafe.Pointer(&val)) -} - -func (k *Kernel) SetArgUint64(index int, val uint64) error { - return k.SetArgUnsafe(index, int(unsafe.Sizeof(val)), unsafe.Pointer(&val)) -} - -func (k *Kernel) SetArgLocal(index int, size int) error { - return k.SetArgUnsafe(index, size, nil) -} - -func (k *Kernel) SetArgUnsafe(index, argSize int, arg unsafe.Pointer) error { - //fmt.Println("FUNKY: ", index, argSize) - return toError(C.clSetKernelArg(k.clKernel, C.cl_uint(index), C.size_t(argSize), arg)) -} - -func (k *Kernel) PreferredWorkGroupSizeMultiple(device *Device) (int, error) { - var size C.size_t - err := C.clGetKernelWorkGroupInfo(k.clKernel, device.nullableId(), C.CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, C.size_t(unsafe.Sizeof(size)), unsafe.Pointer(&size), nil) - return int(size), toError(err) -} - -func (k *Kernel) WorkGroupSize(device *Device) (int, error) { - var size C.size_t - err := C.clGetKernelWorkGroupInfo(k.clKernel, device.nullableId(), C.CL_KERNEL_WORK_GROUP_SIZE, C.size_t(unsafe.Sizeof(size)), unsafe.Pointer(&size), nil) - return int(size), toError(err) -} - -func (k *Kernel) NumArgs() (int, error) { - var num C.cl_uint - err := C.clGetKernelInfo(k.clKernel, C.CL_KERNEL_NUM_ARGS, C.size_t(unsafe.Sizeof(num)), unsafe.Pointer(&num), nil) - return int(num), toError(err) -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel10.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel10.go deleted file mode 100644 index 5799460687..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel10.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build !cl12 - -package cl - -func (k *Kernel) ArgName(index int) (string, error) { - return "", ErrUnsupported -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel12.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel12.go deleted file mode 100644 index d9e6f3546e..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/kernel12.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build cl12 - -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" -import "unsafe" - -func (k *Kernel) ArgName(index int) (string, error) { - var strC [1024]byte - var strN C.size_t - if err := C.clGetKernelArgInfo(k.clKernel, C.cl_uint(index), C.CL_KERNEL_ARG_NAME, 1024, unsafe.Pointer(&strC[0]), &strN); err != C.CL_SUCCESS { - return "", toError(err) - } - return string(strC[:strN]), nil -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/platform.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/platform.go deleted file mode 100644 index fd1d162cfc..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/platform.go +++ /dev/null @@ -1,83 +0,0 @@ -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" - -import "unsafe" - -const maxPlatforms = 32 - -type Platform struct { - id C.cl_platform_id -} - -// Obtain the list of platforms available. -func GetPlatforms() ([]*Platform, error) { - var platformIds [maxPlatforms]C.cl_platform_id - var nPlatforms C.cl_uint - if err := C.clGetPlatformIDs(C.cl_uint(maxPlatforms), &platformIds[0], &nPlatforms); err != C.CL_SUCCESS { - return nil, toError(err) - } - platforms := make([]*Platform, nPlatforms) - for i := 0; i < int(nPlatforms); i++ { - platforms[i] = &Platform{id: platformIds[i]} - } - return platforms, nil -} - -func (p *Platform) GetDevices(deviceType DeviceType) ([]*Device, error) { - return GetDevices(p, deviceType) -} - -func (p *Platform) getInfoString(param C.cl_platform_info) (string, error) { - var strC [2048]byte - var strN C.size_t - if err := C.clGetPlatformInfo(p.id, param, 2048, unsafe.Pointer(&strC[0]), &strN); err != C.CL_SUCCESS { - return "", toError(err) - } - return string(strC[:(strN - 1)]), nil -} - -func (p *Platform) Name() string { - if str, err := p.getInfoString(C.CL_PLATFORM_NAME); err != nil { - panic("Platform.Name() should never fail") - } else { - return str - } -} - -func (p *Platform) Vendor() string { - if str, err := p.getInfoString(C.CL_PLATFORM_VENDOR); err != nil { - panic("Platform.Vendor() should never fail") - } else { - return str - } -} - -func (p *Platform) Profile() string { - if str, err := p.getInfoString(C.CL_PLATFORM_PROFILE); err != nil { - panic("Platform.Profile() should never fail") - } else { - return str - } -} - -func (p *Platform) Version() string { - if str, err := p.getInfoString(C.CL_PLATFORM_VERSION); err != nil { - panic("Platform.Version() should never fail") - } else { - return str - } -} - -func (p *Platform) Extensions() string { - if str, err := p.getInfoString(C.CL_PLATFORM_EXTENSIONS); err != nil { - panic("Platform.Extensions() should never fail") - } else { - return str - } -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/program.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/program.go deleted file mode 100644 index e75f7ee0e2..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/program.go +++ /dev/null @@ -1,105 +0,0 @@ -package cl - -// #include -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" - -import ( - "fmt" - "runtime" - "unsafe" -) - -type BuildError struct { - Message string - Device *Device -} - -func (e BuildError) Error() string { - if e.Device != nil { - return fmt.Sprintf("cl: build error on %q: %s", e.Device.Name(), e.Message) - } else { - return fmt.Sprintf("cl: build error: %s", e.Message) - } -} - -type Program struct { - clProgram C.cl_program - devices []*Device -} - -func releaseProgram(p *Program) { - if p.clProgram != nil { - C.clReleaseProgram(p.clProgram) - p.clProgram = nil - } -} - -func (p *Program) Release() { - releaseProgram(p) -} - -func (p *Program) BuildProgram(devices []*Device, options string) error { - var cOptions *C.char - if options != "" { - cOptions = C.CString(options) - defer C.free(unsafe.Pointer(cOptions)) - } - var deviceList []C.cl_device_id - var deviceListPtr *C.cl_device_id - numDevices := C.cl_uint(len(devices)) - if devices != nil && len(devices) > 0 { - deviceList = buildDeviceIdList(devices) - deviceListPtr = &deviceList[0] - } - if err := C.clBuildProgram(p.clProgram, numDevices, deviceListPtr, cOptions, nil, nil); err != C.CL_SUCCESS { - buffer := make([]byte, 4096) - var bLen C.size_t - var err C.cl_int - - for _, dev := range p.devices { - for i := 2; i >= 0; i-- { - err = C.clGetProgramBuildInfo(p.clProgram, dev.id, C.CL_PROGRAM_BUILD_LOG, C.size_t(len(buffer)), unsafe.Pointer(&buffer[0]), &bLen) - if err == C.CL_INVALID_VALUE && i > 0 && bLen < 1024*1024 { - // INVALID_VALUE probably means our buffer isn't large enough - buffer = make([]byte, bLen) - } else { - break - } - } - if err != C.CL_SUCCESS { - return toError(err) - } - - if bLen > 1 { - return BuildError{ - Device: dev, - Message: string(buffer[:bLen-1]), - } - } - } - - return BuildError{ - Device: nil, - Message: "build failed and produced no log entries", - } - } - return nil -} - -func (p *Program) CreateKernel(name string) (*Kernel, error) { - cName := C.CString(name) - defer C.free(unsafe.Pointer(cName)) - var err C.cl_int - clKernel := C.clCreateKernel(p.clProgram, cName, &err) - if err != C.CL_SUCCESS { - return nil, toError(err) - } - kernel := &Kernel{clKernel: clKernel, name: name} - runtime.SetFinalizer(kernel, releaseKernel) - return kernel, nil -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/queue.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/queue.go deleted file mode 100644 index 7762746da6..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/queue.go +++ /dev/null @@ -1,193 +0,0 @@ -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" - -import "unsafe" - -type CommandQueueProperty int - -const ( - CommandQueueOutOfOrderExecModeEnable CommandQueueProperty = C.CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE - CommandQueueProfilingEnable CommandQueueProperty = C.CL_QUEUE_PROFILING_ENABLE -) - -type CommandQueue struct { - clQueue C.cl_command_queue - device *Device -} - -func releaseCommandQueue(q *CommandQueue) { - if q.clQueue != nil { - C.clReleaseCommandQueue(q.clQueue) - q.clQueue = nil - } -} - -// Call clReleaseCommandQueue on the CommandQueue. Using the CommandQueue after Release will cause a panick. -func (q *CommandQueue) Release() { - releaseCommandQueue(q) -} - -// Blocks until all previously queued OpenCL commands in a command-queue are issued to the associated device and have completed. -func (q *CommandQueue) Finish() error { - return toError(C.clFinish(q.clQueue)) -} - -// Issues all previously queued OpenCL commands in a command-queue to the device associated with the command-queue. -func (q *CommandQueue) Flush() error { - return toError(C.clFlush(q.clQueue)) -} - -// Enqueues a command to map a region of the buffer object given by buffer into the host address space and returns a pointer to this mapped region. -func (q *CommandQueue) EnqueueMapBuffer(buffer *MemObject, blocking bool, flags MapFlag, offset, size int, eventWaitList []*Event) (*MappedMemObject, *Event, error) { - var event C.cl_event - var err C.cl_int - ptr := C.clEnqueueMapBuffer(q.clQueue, buffer.clMem, clBool(blocking), flags.toCl(), C.size_t(offset), C.size_t(size), C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event, &err) - if err != C.CL_SUCCESS { - return nil, nil, toError(err) - } - ev := newEvent(event) - if ptr == nil { - return nil, ev, ErrUnknown - } - return &MappedMemObject{ptr: ptr, size: size}, ev, nil -} - -// Enqueues a command to map a region of an image object into the host address space and returns a pointer to this mapped region. -func (q *CommandQueue) EnqueueMapImage(buffer *MemObject, blocking bool, flags MapFlag, origin, region [3]int, eventWaitList []*Event) (*MappedMemObject, *Event, error) { - cOrigin := sizeT3(origin) - cRegion := sizeT3(region) - var event C.cl_event - var err C.cl_int - var rowPitch, slicePitch C.size_t - ptr := C.clEnqueueMapImage(q.clQueue, buffer.clMem, clBool(blocking), flags.toCl(), &cOrigin[0], &cRegion[0], &rowPitch, &slicePitch, C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event, &err) - if err != C.CL_SUCCESS { - return nil, nil, toError(err) - } - ev := newEvent(event) - if ptr == nil { - return nil, ev, ErrUnknown - } - size := 0 // TODO: could calculate this - return &MappedMemObject{ptr: ptr, size: size, rowPitch: int(rowPitch), slicePitch: int(slicePitch)}, ev, nil -} - -// Enqueues a command to unmap a previously mapped region of a memory object. -func (q *CommandQueue) EnqueueUnmapMemObject(buffer *MemObject, mappedObj *MappedMemObject, eventWaitList []*Event) (*Event, error) { - var event C.cl_event - if err := C.clEnqueueUnmapMemObject(q.clQueue, buffer.clMem, mappedObj.ptr, C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event); err != C.CL_SUCCESS { - return nil, toError(err) - } - return newEvent(event), nil -} - -// Enqueues a command to copy a buffer object to another buffer object. -func (q *CommandQueue) EnqueueCopyBuffer(srcBuffer, dstBuffer *MemObject, srcOffset, dstOffset, byteCount int, eventWaitList []*Event) (*Event, error) { - var event C.cl_event - err := toError(C.clEnqueueCopyBuffer(q.clQueue, srcBuffer.clMem, dstBuffer.clMem, C.size_t(srcOffset), C.size_t(dstOffset), C.size_t(byteCount), C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} - -// Enqueue commands to write to a buffer object from host memory. -func (q *CommandQueue) EnqueueWriteBuffer(buffer *MemObject, blocking bool, offset, dataSize int, dataPtr unsafe.Pointer, eventWaitList []*Event) (*Event, error) { - var event C.cl_event - err := toError(C.clEnqueueWriteBuffer(q.clQueue, buffer.clMem, clBool(blocking), C.size_t(offset), C.size_t(dataSize), dataPtr, C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} - -func (q *CommandQueue) EnqueueWriteBufferFloat32(buffer *MemObject, blocking bool, offset int, data []float32, eventWaitList []*Event) (*Event, error) { - dataPtr := unsafe.Pointer(&data[0]) - dataSize := int(unsafe.Sizeof(data[0])) * len(data) - return q.EnqueueWriteBuffer(buffer, blocking, offset, dataSize, dataPtr, eventWaitList) -} - -// Enqueue commands to read from a buffer object to host memory. -func (q *CommandQueue) EnqueueReadBuffer(buffer *MemObject, blocking bool, offset, dataSize int, dataPtr unsafe.Pointer, eventWaitList []*Event) (*Event, error) { - var event C.cl_event - err := toError(C.clEnqueueReadBuffer(q.clQueue, buffer.clMem, clBool(blocking), C.size_t(offset), C.size_t(dataSize), dataPtr, C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} - -func (q *CommandQueue) EnqueueReadBufferFloat32(buffer *MemObject, blocking bool, offset int, data []float32, eventWaitList []*Event) (*Event, error) { - dataPtr := unsafe.Pointer(&data[0]) - dataSize := int(unsafe.Sizeof(data[0])) * len(data) - return q.EnqueueReadBuffer(buffer, blocking, offset, dataSize, dataPtr, eventWaitList) -} - -// Enqueues a command to execute a kernel on a device. -func (q *CommandQueue) EnqueueNDRangeKernel(kernel *Kernel, globalWorkOffset, globalWorkSize, localWorkSize []int, eventWaitList []*Event) (*Event, error) { - workDim := len(globalWorkSize) - var globalWorkOffsetList []C.size_t - var globalWorkOffsetPtr *C.size_t - if globalWorkOffset != nil { - globalWorkOffsetList = make([]C.size_t, len(globalWorkOffset)) - for i, off := range globalWorkOffset { - globalWorkOffsetList[i] = C.size_t(off) - } - globalWorkOffsetPtr = &globalWorkOffsetList[0] - } - var globalWorkSizeList []C.size_t - var globalWorkSizePtr *C.size_t - if globalWorkSize != nil { - globalWorkSizeList = make([]C.size_t, len(globalWorkSize)) - for i, off := range globalWorkSize { - globalWorkSizeList[i] = C.size_t(off) - } - globalWorkSizePtr = &globalWorkSizeList[0] - } - var localWorkSizeList []C.size_t - var localWorkSizePtr *C.size_t - if localWorkSize != nil { - localWorkSizeList = make([]C.size_t, len(localWorkSize)) - for i, off := range localWorkSize { - localWorkSizeList[i] = C.size_t(off) - } - localWorkSizePtr = &localWorkSizeList[0] - } - var event C.cl_event - err := toError(C.clEnqueueNDRangeKernel(q.clQueue, kernel.clKernel, C.cl_uint(workDim), globalWorkOffsetPtr, globalWorkSizePtr, localWorkSizePtr, C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} - -// Enqueues a command to read from a 2D or 3D image object to host memory. -func (q *CommandQueue) EnqueueReadImage(image *MemObject, blocking bool, origin, region [3]int, rowPitch, slicePitch int, data []byte, eventWaitList []*Event) (*Event, error) { - cOrigin := sizeT3(origin) - cRegion := sizeT3(region) - var event C.cl_event - err := toError(C.clEnqueueReadImage(q.clQueue, image.clMem, clBool(blocking), &cOrigin[0], &cRegion[0], C.size_t(rowPitch), C.size_t(slicePitch), unsafe.Pointer(&data[0]), C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} - -// Enqueues a command to write from a 2D or 3D image object to host memory. -func (q *CommandQueue) EnqueueWriteImage(image *MemObject, blocking bool, origin, region [3]int, rowPitch, slicePitch int, data []byte, eventWaitList []*Event) (*Event, error) { - cOrigin := sizeT3(origin) - cRegion := sizeT3(region) - var event C.cl_event - err := toError(C.clEnqueueWriteImage(q.clQueue, image.clMem, clBool(blocking), &cOrigin[0], &cRegion[0], C.size_t(rowPitch), C.size_t(slicePitch), unsafe.Pointer(&data[0]), C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} - -func (q *CommandQueue) EnqueueFillBuffer(buffer *MemObject, pattern unsafe.Pointer, patternSize, offset, size int, eventWaitList []*Event) (*Event, error) { - var event C.cl_event - err := toError(C.clEnqueueFillBuffer(q.clQueue, buffer.clMem, pattern, C.size_t(patternSize), C.size_t(offset), C.size_t(size), C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} - -// A synchronization point that enqueues a barrier operation. -func (q *CommandQueue) EnqueueBarrierWithWaitList(eventWaitList []*Event) (*Event, error) { - var event C.cl_event - err := toError(C.clEnqueueBarrierWithWaitList(q.clQueue, C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} - -// Enqueues a marker command which waits for either a list of events to complete, or all previously enqueued commands to complete. -func (q *CommandQueue) EnqueueMarkerWithWaitList(eventWaitList []*Event) (*Event, error) { - var event C.cl_event - err := toError(C.clEnqueueMarkerWithWaitList(q.clQueue, C.cl_uint(len(eventWaitList)), eventListPtr(eventWaitList), &event)) - return newEvent(event), err -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types.go deleted file mode 100644 index 00c846ce72..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types.go +++ /dev/null @@ -1,487 +0,0 @@ -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" - -import ( - "errors" - "fmt" - "reflect" - "runtime" - "strings" - "unsafe" -) - -var ( - ErrUnknown = errors.New("cl: unknown error") // Generally an unexpected result from an OpenCL function (e.g. CL_SUCCESS but null pointer) -) - -type ErrOther int - -func (e ErrOther) Error() string { - return fmt.Sprintf("cl: error %d", int(e)) -} - -var ( - ErrDeviceNotFound = errors.New("cl: Device Not Found") - ErrDeviceNotAvailable = errors.New("cl: Device Not Available") - ErrCompilerNotAvailable = errors.New("cl: Compiler Not Available") - ErrMemObjectAllocationFailure = errors.New("cl: Mem Object Allocation Failure") - ErrOutOfResources = errors.New("cl: Out Of Resources") - ErrOutOfHostMemory = errors.New("cl: Out Of Host Memory") - ErrProfilingInfoNotAvailable = errors.New("cl: Profiling Info Not Available") - ErrMemCopyOverlap = errors.New("cl: Mem Copy Overlap") - ErrImageFormatMismatch = errors.New("cl: Image Format Mismatch") - ErrImageFormatNotSupported = errors.New("cl: Image Format Not Supported") - ErrBuildProgramFailure = errors.New("cl: Build Program Failure") - ErrMapFailure = errors.New("cl: Map Failure") - ErrMisalignedSubBufferOffset = errors.New("cl: Misaligned Sub Buffer Offset") - ErrExecStatusErrorForEventsInWaitList = errors.New("cl: Exec Status Error For Events In Wait List") - ErrCompileProgramFailure = errors.New("cl: Compile Program Failure") - ErrLinkerNotAvailable = errors.New("cl: Linker Not Available") - ErrLinkProgramFailure = errors.New("cl: Link Program Failure") - ErrDevicePartitionFailed = errors.New("cl: Device Partition Failed") - ErrKernelArgInfoNotAvailable = errors.New("cl: Kernel Arg Info Not Available") - ErrInvalidValue = errors.New("cl: Invalid Value") - ErrInvalidDeviceType = errors.New("cl: Invalid Device Type") - ErrInvalidPlatform = errors.New("cl: Invalid Platform") - ErrInvalidDevice = errors.New("cl: Invalid Device") - ErrInvalidContext = errors.New("cl: Invalid Context") - ErrInvalidQueueProperties = errors.New("cl: Invalid Queue Properties") - ErrInvalidCommandQueue = errors.New("cl: Invalid Command Queue") - ErrInvalidHostPtr = errors.New("cl: Invalid Host Ptr") - ErrInvalidMemObject = errors.New("cl: Invalid Mem Object") - ErrInvalidImageFormatDescriptor = errors.New("cl: Invalid Image Format Descriptor") - ErrInvalidImageSize = errors.New("cl: Invalid Image Size") - ErrInvalidSampler = errors.New("cl: Invalid Sampler") - ErrInvalidBinary = errors.New("cl: Invalid Binary") - ErrInvalidBuildOptions = errors.New("cl: Invalid Build Options") - ErrInvalidProgram = errors.New("cl: Invalid Program") - ErrInvalidProgramExecutable = errors.New("cl: Invalid Program Executable") - ErrInvalidKernelName = errors.New("cl: Invalid Kernel Name") - ErrInvalidKernelDefinition = errors.New("cl: Invalid Kernel Definition") - ErrInvalidKernel = errors.New("cl: Invalid Kernel") - ErrInvalidArgIndex = errors.New("cl: Invalid Arg Index") - ErrInvalidArgValue = errors.New("cl: Invalid Arg Value") - ErrInvalidArgSize = errors.New("cl: Invalid Arg Size") - ErrInvalidKernelArgs = errors.New("cl: Invalid Kernel Args") - ErrInvalidWorkDimension = errors.New("cl: Invalid Work Dimension") - ErrInvalidWorkGroupSize = errors.New("cl: Invalid Work Group Size") - ErrInvalidWorkItemSize = errors.New("cl: Invalid Work Item Size") - ErrInvalidGlobalOffset = errors.New("cl: Invalid Global Offset") - ErrInvalidEventWaitList = errors.New("cl: Invalid Event Wait List") - ErrInvalidEvent = errors.New("cl: Invalid Event") - ErrInvalidOperation = errors.New("cl: Invalid Operation") - ErrInvalidGlObject = errors.New("cl: Invalid Gl Object") - ErrInvalidBufferSize = errors.New("cl: Invalid Buffer Size") - ErrInvalidMipLevel = errors.New("cl: Invalid Mip Level") - ErrInvalidGlobalWorkSize = errors.New("cl: Invalid Global Work Size") - ErrInvalidProperty = errors.New("cl: Invalid Property") - ErrInvalidImageDescriptor = errors.New("cl: Invalid Image Descriptor") - ErrInvalidCompilerOptions = errors.New("cl: Invalid Compiler Options") - ErrInvalidLinkerOptions = errors.New("cl: Invalid Linker Options") - ErrInvalidDevicePartitionCount = errors.New("cl: Invalid Device Partition Count") -) -var errorMap = map[C.cl_int]error{ - C.CL_SUCCESS: nil, - C.CL_DEVICE_NOT_FOUND: ErrDeviceNotFound, - C.CL_DEVICE_NOT_AVAILABLE: ErrDeviceNotAvailable, - C.CL_COMPILER_NOT_AVAILABLE: ErrCompilerNotAvailable, - C.CL_MEM_OBJECT_ALLOCATION_FAILURE: ErrMemObjectAllocationFailure, - C.CL_OUT_OF_RESOURCES: ErrOutOfResources, - C.CL_OUT_OF_HOST_MEMORY: ErrOutOfHostMemory, - C.CL_PROFILING_INFO_NOT_AVAILABLE: ErrProfilingInfoNotAvailable, - C.CL_MEM_COPY_OVERLAP: ErrMemCopyOverlap, - C.CL_IMAGE_FORMAT_MISMATCH: ErrImageFormatMismatch, - C.CL_IMAGE_FORMAT_NOT_SUPPORTED: ErrImageFormatNotSupported, - C.CL_BUILD_PROGRAM_FAILURE: ErrBuildProgramFailure, - C.CL_MAP_FAILURE: ErrMapFailure, - C.CL_MISALIGNED_SUB_BUFFER_OFFSET: ErrMisalignedSubBufferOffset, - C.CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: ErrExecStatusErrorForEventsInWaitList, - C.CL_INVALID_VALUE: ErrInvalidValue, - C.CL_INVALID_DEVICE_TYPE: ErrInvalidDeviceType, - C.CL_INVALID_PLATFORM: ErrInvalidPlatform, - C.CL_INVALID_DEVICE: ErrInvalidDevice, - C.CL_INVALID_CONTEXT: ErrInvalidContext, - C.CL_INVALID_QUEUE_PROPERTIES: ErrInvalidQueueProperties, - C.CL_INVALID_COMMAND_QUEUE: ErrInvalidCommandQueue, - C.CL_INVALID_HOST_PTR: ErrInvalidHostPtr, - C.CL_INVALID_MEM_OBJECT: ErrInvalidMemObject, - C.CL_INVALID_IMAGE_FORMAT_DESCRIPTOR: ErrInvalidImageFormatDescriptor, - C.CL_INVALID_IMAGE_SIZE: ErrInvalidImageSize, - C.CL_INVALID_SAMPLER: ErrInvalidSampler, - C.CL_INVALID_BINARY: ErrInvalidBinary, - C.CL_INVALID_BUILD_OPTIONS: ErrInvalidBuildOptions, - C.CL_INVALID_PROGRAM: ErrInvalidProgram, - C.CL_INVALID_PROGRAM_EXECUTABLE: ErrInvalidProgramExecutable, - C.CL_INVALID_KERNEL_NAME: ErrInvalidKernelName, - C.CL_INVALID_KERNEL_DEFINITION: ErrInvalidKernelDefinition, - C.CL_INVALID_KERNEL: ErrInvalidKernel, - C.CL_INVALID_ARG_INDEX: ErrInvalidArgIndex, - C.CL_INVALID_ARG_VALUE: ErrInvalidArgValue, - C.CL_INVALID_ARG_SIZE: ErrInvalidArgSize, - C.CL_INVALID_KERNEL_ARGS: ErrInvalidKernelArgs, - C.CL_INVALID_WORK_DIMENSION: ErrInvalidWorkDimension, - C.CL_INVALID_WORK_GROUP_SIZE: ErrInvalidWorkGroupSize, - C.CL_INVALID_WORK_ITEM_SIZE: ErrInvalidWorkItemSize, - C.CL_INVALID_GLOBAL_OFFSET: ErrInvalidGlobalOffset, - C.CL_INVALID_EVENT_WAIT_LIST: ErrInvalidEventWaitList, - C.CL_INVALID_EVENT: ErrInvalidEvent, - C.CL_INVALID_OPERATION: ErrInvalidOperation, - C.CL_INVALID_GL_OBJECT: ErrInvalidGlObject, - C.CL_INVALID_BUFFER_SIZE: ErrInvalidBufferSize, - C.CL_INVALID_MIP_LEVEL: ErrInvalidMipLevel, - C.CL_INVALID_GLOBAL_WORK_SIZE: ErrInvalidGlobalWorkSize, - C.CL_INVALID_PROPERTY: ErrInvalidProperty, -} - -func toError(code C.cl_int) error { - if err, ok := errorMap[code]; ok { - return err - } - return ErrOther(code) -} - -type LocalMemType int - -const ( - LocalMemTypeNone LocalMemType = C.CL_NONE - LocalMemTypeGlobal LocalMemType = C.CL_GLOBAL - LocalMemTypeLocal LocalMemType = C.CL_LOCAL -) - -var localMemTypeMap = map[LocalMemType]string{ - LocalMemTypeNone: "None", - LocalMemTypeGlobal: "Global", - LocalMemTypeLocal: "Local", -} - -func (t LocalMemType) String() string { - name := localMemTypeMap[t] - if name == "" { - name = "Unknown" - } - return name -} - -type ExecCapability int - -const ( - ExecCapabilityKernel ExecCapability = C.CL_EXEC_KERNEL // The OpenCL device can execute OpenCL kernels. - ExecCapabilityNativeKernel ExecCapability = C.CL_EXEC_NATIVE_KERNEL // The OpenCL device can execute native kernels. -) - -func (ec ExecCapability) String() string { - var parts []string - if ec&ExecCapabilityKernel != 0 { - parts = append(parts, "Kernel") - } - if ec&ExecCapabilityNativeKernel != 0 { - parts = append(parts, "NativeKernel") - } - if parts == nil { - return "" - } - return strings.Join(parts, "|") -} - -type MemCacheType int - -const ( - MemCacheTypeNone MemCacheType = C.CL_NONE - MemCacheTypeReadOnlyCache MemCacheType = C.CL_READ_ONLY_CACHE - MemCacheTypeReadWriteCache MemCacheType = C.CL_READ_WRITE_CACHE -) - -func (ct MemCacheType) String() string { - switch ct { - case MemCacheTypeNone: - return "None" - case MemCacheTypeReadOnlyCache: - return "ReadOnly" - case MemCacheTypeReadWriteCache: - return "ReadWrite" - } - return fmt.Sprintf("Unknown(%x)", int(ct)) -} - -type MemFlag int - -const ( - MemReadWrite MemFlag = C.CL_MEM_READ_WRITE - MemWriteOnly MemFlag = C.CL_MEM_WRITE_ONLY - MemReadOnly MemFlag = C.CL_MEM_READ_ONLY - MemUseHostPtr MemFlag = C.CL_MEM_USE_HOST_PTR - MemAllocHostPtr MemFlag = C.CL_MEM_ALLOC_HOST_PTR - MemCopyHostPtr MemFlag = C.CL_MEM_COPY_HOST_PTR - - MemWriteOnlyHost MemFlag = C.CL_MEM_HOST_WRITE_ONLY - MemReadOnlyHost MemFlag = C.CL_MEM_HOST_READ_ONLY - MemNoAccessHost MemFlag = C.CL_MEM_HOST_NO_ACCESS -) - -type MemObjectType int - -const ( - MemObjectTypeBuffer MemObjectType = C.CL_MEM_OBJECT_BUFFER - MemObjectTypeImage2D MemObjectType = C.CL_MEM_OBJECT_IMAGE2D - MemObjectTypeImage3D MemObjectType = C.CL_MEM_OBJECT_IMAGE3D -) - -type MapFlag int - -const ( - // This flag specifies that the region being mapped in the memory object is being mapped for reading. - MapFlagRead MapFlag = C.CL_MAP_READ - MapFlagWrite MapFlag = C.CL_MAP_WRITE - MapFlagWriteInvalidateRegion MapFlag = C.CL_MAP_WRITE_INVALIDATE_REGION -) - -func (mf MapFlag) toCl() C.cl_map_flags { - return C.cl_map_flags(mf) -} - -type ChannelOrder int - -const ( - ChannelOrderR ChannelOrder = C.CL_R - ChannelOrderA ChannelOrder = C.CL_A - ChannelOrderRG ChannelOrder = C.CL_RG - ChannelOrderRA ChannelOrder = C.CL_RA - ChannelOrderRGB ChannelOrder = C.CL_RGB - ChannelOrderRGBA ChannelOrder = C.CL_RGBA - ChannelOrderBGRA ChannelOrder = C.CL_BGRA - ChannelOrderARGB ChannelOrder = C.CL_ARGB - ChannelOrderIntensity ChannelOrder = C.CL_INTENSITY - ChannelOrderLuminance ChannelOrder = C.CL_LUMINANCE - ChannelOrderRx ChannelOrder = C.CL_Rx - ChannelOrderRGx ChannelOrder = C.CL_RGx - ChannelOrderRGBx ChannelOrder = C.CL_RGBx -) - -var channelOrderNameMap = map[ChannelOrder]string{ - ChannelOrderR: "R", - ChannelOrderA: "A", - ChannelOrderRG: "RG", - ChannelOrderRA: "RA", - ChannelOrderRGB: "RGB", - ChannelOrderRGBA: "RGBA", - ChannelOrderBGRA: "BGRA", - ChannelOrderARGB: "ARGB", - ChannelOrderIntensity: "Intensity", - ChannelOrderLuminance: "Luminance", - ChannelOrderRx: "Rx", - ChannelOrderRGx: "RGx", - ChannelOrderRGBx: "RGBx", -} - -func (co ChannelOrder) String() string { - name := channelOrderNameMap[co] - if name == "" { - name = fmt.Sprintf("Unknown(%x)", int(co)) - } - return name -} - -type ChannelDataType int - -const ( - ChannelDataTypeSNormInt8 ChannelDataType = C.CL_SNORM_INT8 - ChannelDataTypeSNormInt16 ChannelDataType = C.CL_SNORM_INT16 - ChannelDataTypeUNormInt8 ChannelDataType = C.CL_UNORM_INT8 - ChannelDataTypeUNormInt16 ChannelDataType = C.CL_UNORM_INT16 - ChannelDataTypeUNormShort565 ChannelDataType = C.CL_UNORM_SHORT_565 - ChannelDataTypeUNormShort555 ChannelDataType = C.CL_UNORM_SHORT_555 - ChannelDataTypeUNormInt101010 ChannelDataType = C.CL_UNORM_INT_101010 - ChannelDataTypeSignedInt8 ChannelDataType = C.CL_SIGNED_INT8 - ChannelDataTypeSignedInt16 ChannelDataType = C.CL_SIGNED_INT16 - ChannelDataTypeSignedInt32 ChannelDataType = C.CL_SIGNED_INT32 - ChannelDataTypeUnsignedInt8 ChannelDataType = C.CL_UNSIGNED_INT8 - ChannelDataTypeUnsignedInt16 ChannelDataType = C.CL_UNSIGNED_INT16 - ChannelDataTypeUnsignedInt32 ChannelDataType = C.CL_UNSIGNED_INT32 - ChannelDataTypeHalfFloat ChannelDataType = C.CL_HALF_FLOAT - ChannelDataTypeFloat ChannelDataType = C.CL_FLOAT -) - -var channelDataTypeNameMap = map[ChannelDataType]string{ - ChannelDataTypeSNormInt8: "SNormInt8", - ChannelDataTypeSNormInt16: "SNormInt16", - ChannelDataTypeUNormInt8: "UNormInt8", - ChannelDataTypeUNormInt16: "UNormInt16", - ChannelDataTypeUNormShort565: "UNormShort565", - ChannelDataTypeUNormShort555: "UNormShort555", - ChannelDataTypeUNormInt101010: "UNormInt101010", - ChannelDataTypeSignedInt8: "SignedInt8", - ChannelDataTypeSignedInt16: "SignedInt16", - ChannelDataTypeSignedInt32: "SignedInt32", - ChannelDataTypeUnsignedInt8: "UnsignedInt8", - ChannelDataTypeUnsignedInt16: "UnsignedInt16", - ChannelDataTypeUnsignedInt32: "UnsignedInt32", - ChannelDataTypeHalfFloat: "HalfFloat", - ChannelDataTypeFloat: "Float", -} - -func (ct ChannelDataType) String() string { - name := channelDataTypeNameMap[ct] - if name == "" { - name = fmt.Sprintf("Unknown(%x)", int(ct)) - } - return name -} - -type ImageFormat struct { - ChannelOrder ChannelOrder - ChannelDataType ChannelDataType -} - -func (f ImageFormat) toCl() C.cl_image_format { - var format C.cl_image_format - format.image_channel_order = C.cl_channel_order(f.ChannelOrder) - format.image_channel_data_type = C.cl_channel_type(f.ChannelDataType) - return format -} - -type ProfilingInfo int - -const ( - // A 64-bit value that describes the current device time counter in - // nanoseconds when the command identified by event is enqueued in - // a command-queue by the host. - ProfilingInfoCommandQueued ProfilingInfo = C.CL_PROFILING_COMMAND_QUEUED - // A 64-bit value that describes the current device time counter in - // nanoseconds when the command identified by event that has been - // enqueued is submitted by the host to the device associated with the command-queue. - ProfilingInfoCommandSubmit ProfilingInfo = C.CL_PROFILING_COMMAND_SUBMIT - // A 64-bit value that describes the current device time counter in - // nanoseconds when the command identified by event starts execution on the device. - ProfilingInfoCommandStart ProfilingInfo = C.CL_PROFILING_COMMAND_START - // A 64-bit value that describes the current device time counter in - // nanoseconds when the command identified by event has finished - // execution on the device. - ProfilingInfoCommandEnd ProfilingInfo = C.CL_PROFILING_COMMAND_END -) - -type CommmandExecStatus int - -const ( - CommmandExecStatusComplete CommmandExecStatus = C.CL_COMPLETE - CommmandExecStatusRunning CommmandExecStatus = C.CL_RUNNING - CommmandExecStatusSubmitted CommmandExecStatus = C.CL_SUBMITTED - CommmandExecStatusQueued CommmandExecStatus = C.CL_QUEUED -) - -type Event struct { - clEvent C.cl_event -} - -func releaseEvent(ev *Event) { - if ev.clEvent != nil { - C.clReleaseEvent(ev.clEvent) - ev.clEvent = nil - } -} - -func (e *Event) Release() { - releaseEvent(e) -} - -func (e *Event) GetEventProfilingInfo(paramName ProfilingInfo) (int64, error) { - var paramValue C.cl_ulong - if err := C.clGetEventProfilingInfo(e.clEvent, C.cl_profiling_info(paramName), C.size_t(unsafe.Sizeof(paramValue)), unsafe.Pointer(¶mValue), nil); err != C.CL_SUCCESS { - return 0, toError(err) - } - return int64(paramValue), nil -} - -// Sets the execution status of a user event object. -// -// `status` specifies the new execution status to be set and -// can be CL_COMPLETE or a negative integer value to indicate -// an error. A negative integer value causes all enqueued commands -// that wait on this user event to be terminated. clSetUserEventStatus -// can only be called once to change the execution status of event. -func (e *Event) SetUserEventStatus(status int) error { - return toError(C.clSetUserEventStatus(e.clEvent, C.cl_int(status))) -} - -// Waits on the host thread for commands identified by event objects in -// events to complete. A command is considered complete if its execution -// status is CL_COMPLETE or a negative value. The events specified in -// event_list act as synchronization points. -// -// If the cl_khr_gl_event extension is enabled, event objects can also be -// used to reflect the status of an OpenGL sync object. The sync object -// in turn refers to a fence command executing in an OpenGL command -// stream. This provides another method of coordinating sharing of buffers -// and images between OpenGL and OpenCL. -func WaitForEvents(events []*Event) error { - return toError(C.clWaitForEvents(C.cl_uint(len(events)), eventListPtr(events))) -} - -func newEvent(clEvent C.cl_event) *Event { - ev := &Event{clEvent: clEvent} - runtime.SetFinalizer(ev, releaseEvent) - return ev -} - -func eventListPtr(el []*Event) *C.cl_event { - if el == nil { - return nil - } - elist := make([]C.cl_event, len(el)) - for i, e := range el { - elist[i] = e.clEvent - } - return (*C.cl_event)(&elist[0]) -} - -func clBool(b bool) C.cl_bool { - if b { - return C.CL_TRUE - } - return C.CL_FALSE -} - -func sizeT3(i3 [3]int) [3]C.size_t { - var val [3]C.size_t - val[0] = C.size_t(i3[0]) - val[1] = C.size_t(i3[1]) - val[2] = C.size_t(i3[2]) - return val -} - -type MappedMemObject struct { - ptr unsafe.Pointer - size int - rowPitch int - slicePitch int -} - -func (mb *MappedMemObject) ByteSlice() []byte { - var byteSlice []byte - sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&byteSlice)) - sliceHeader.Cap = mb.size - sliceHeader.Len = mb.size - sliceHeader.Data = uintptr(mb.ptr) - return byteSlice -} - -func (mb *MappedMemObject) Ptr() unsafe.Pointer { - return mb.ptr -} - -func (mb *MappedMemObject) Size() int { - return mb.size -} - -func (mb *MappedMemObject) RowPitch() int { - return mb.rowPitch -} - -func (mb *MappedMemObject) SlicePitch() int { - return mb.slicePitch -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types12.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types12.go deleted file mode 100644 index 58023cb607..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types12.go +++ /dev/null @@ -1,71 +0,0 @@ -// +build cl12 - -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" - -const ( - ChannelDataTypeUNormInt24 ChannelDataType = C.CL_UNORM_INT24 - ChannelOrderDepth ChannelOrder = C.CL_DEPTH - ChannelOrderDepthStencil ChannelOrder = C.CL_DEPTH_STENCIL - MemHostNoAccess MemFlag = C.CL_MEM_HOST_NO_ACCESS // OpenCL 1.2 - MemHostReadOnly MemFlag = C.CL_MEM_HOST_READ_ONLY // OpenCL 1.2 - MemHostWriteOnly MemFlag = C.CL_MEM_HOST_WRITE_ONLY // OpenCL 1.2 - MemObjectTypeImage1D MemObjectType = C.CL_MEM_OBJECT_IMAGE1D - MemObjectTypeImage1DArray MemObjectType = C.CL_MEM_OBJECT_IMAGE1D_ARRAY - MemObjectTypeImage1DBuffer MemObjectType = C.CL_MEM_OBJECT_IMAGE1D_BUFFER - MemObjectTypeImage2DArray MemObjectType = C.CL_MEM_OBJECT_IMAGE2D_ARRAY - // This flag specifies that the region being mapped in the memory object is being mapped for writing. - // - // The contents of the region being mapped are to be discarded. This is typically the case when the - // region being mapped is overwritten by the host. This flag allows the implementation to no longer - // guarantee that the pointer returned by clEnqueueMapBuffer or clEnqueueMapImage contains the - // latest bits in the region being mapped which can be a significant performance enhancement. - MapFlagWriteInvalidateRegion MapFlag = C.CL_MAP_WRITE_INVALIDATE_REGION -) - -func init() { - errorMap[C.CL_COMPILE_PROGRAM_FAILURE] = ErrCompileProgramFailure - errorMap[C.CL_DEVICE_PARTITION_FAILED] = ErrDevicePartitionFailed - errorMap[C.CL_INVALID_COMPILER_OPTIONS] = ErrInvalidCompilerOptions - errorMap[C.CL_INVALID_DEVICE_PARTITION_COUNT] = ErrInvalidDevicePartitionCount - errorMap[C.CL_INVALID_IMAGE_DESCRIPTOR] = ErrInvalidImageDescriptor - errorMap[C.CL_INVALID_LINKER_OPTIONS] = ErrInvalidLinkerOptions - errorMap[C.CL_KERNEL_ARG_INFO_NOT_AVAILABLE] = ErrKernelArgInfoNotAvailable - errorMap[C.CL_LINK_PROGRAM_FAILURE] = ErrLinkProgramFailure - errorMap[C.CL_LINKER_NOT_AVAILABLE] = ErrLinkerNotAvailable - channelOrderNameMap[ChannelOrderDepth] = "Depth" - channelOrderNameMap[ChannelOrderDepthStencil] = "DepthStencil" - channelDataTypeNameMap[ChannelDataTypeUNormInt24] = "UNormInt24" -} - -type ImageDescription struct { - Type MemObjectType - Width, Height, Depth int - ArraySize, RowPitch, SlicePitch int - NumMipLevels, NumSamples int - Buffer *MemObject -} - -func (d ImageDescription) toCl() C.cl_image_desc { - var desc C.cl_image_desc - desc.image_type = C.cl_mem_object_type(d.Type) - desc.image_width = C.size_t(d.Width) - desc.image_height = C.size_t(d.Height) - desc.image_depth = C.size_t(d.Depth) - desc.image_array_size = C.size_t(d.ArraySize) - desc.image_row_pitch = C.size_t(d.RowPitch) - desc.image_slice_pitch = C.size_t(d.SlicePitch) - desc.num_mip_levels = C.cl_uint(d.NumMipLevels) - desc.num_samples = C.cl_uint(d.NumSamples) - desc.buffer = nil - if d.Buffer != nil { - desc.buffer = d.Buffer.clMem - } - return desc -} diff --git a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types_darwin.go b/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types_darwin.go deleted file mode 100644 index ddcf749062..0000000000 --- a/Godeps/_workspace/src/github.com/Gustav-Simonsson/go-opencl/cl/types_darwin.go +++ /dev/null @@ -1,45 +0,0 @@ -package cl - -// #ifdef __APPLE__ -// #include "OpenCL/opencl.h" -// #else -// #include "cl.h" -// #endif -import "C" - -// Extension: cl_APPLE_fixed_alpha_channel_orders -// -// These selectors may be passed to clCreateImage2D() in the cl_image_format.image_channel_order field. -// They are like CL_BGRA and CL_ARGB except that the alpha channel to be ignored. On calls to read_imagef, -// the alpha will be 0xff (1.0f) if the sample falls in the image and 0 if it does not fall in the image. -// On calls to write_imagef, the alpha value is ignored and 0xff (1.0f) is written. These formats are -// currently only available for the CL_UNORM_INT8 cl_channel_type. They are intended to support legacy -// image formats. -const ( - ChannelOrder1RGBApple ChannelOrder = C.CL_1RGB_APPLE // Introduced in MacOS X.7. - ChannelOrderBGR1Apple ChannelOrder = C.CL_BGR1_APPLE // Introduced in MacOS X.7. -) - -// Extension: cl_APPLE_biased_fixed_point_image_formats -// -// This selector may be passed to clCreateImage2D() in the cl_image_format.image_channel_data_type field. -// It defines a biased signed 1.14 fixed point storage format, with range [-1, 3). The conversion from -// float to this fixed point format is defined as follows: -// -// ushort float_to_sfixed14( float x ){ -// int i = convert_int_sat_rte( x * 0x1.0p14f ); // scale [-1, 3.0) to [-16384, 3*16384), round to nearest integer -// i = add_sat( i, 0x4000 ); // apply bias, to convert to [0, 65535) range -// return convert_ushort_sat(i); // clamp to destination size -// } -// -// The inverse conversion is the reverse process. The formats are currently only available on the CPU with -// the CL_RGBA channel layout. -const ( - ChannelDataTypeSFixed14Apple ChannelDataType = C.CL_SFIXED14_APPLE // Introduced in MacOS X.7. -) - -func init() { - channelOrderNameMap[ChannelOrder1RGBApple] = "1RGBApple" - channelOrderNameMap[ChannelOrderBGR1Apple] = "RGB1Apple" - channelDataTypeNameMap[ChannelDataTypeSFixed14Apple] = "SFixed14Apple" -} diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_opencl.go b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_opencl.go deleted file mode 100644 index 451049eaee..0000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_opencl.go +++ /dev/null @@ -1,628 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build opencl - -package ethash - -//#cgo LDFLAGS: -w -//#include -//#include -//#include "src/libethash/internal.h" -import "C" - -import ( - crand "crypto/rand" - "encoding/binary" - "fmt" - "math" - "math/big" - mrand "math/rand" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - "unsafe" - - "github.com/Gustav-Simonsson/go-opencl/cl" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/pow" -) - -/* - - This code have two main entry points: - - 1. The initCL(...) function configures one or more OpenCL device - (for now only GPU) and loads the Ethash DAG onto device memory - - 2. The Search(...) function loads a Ethash nonce into device(s) memory and - executes the Ethash OpenCL kernel. - - Throughout the code, we refer to "host memory" and "device memory". - For most systems (e.g. regular PC GPU miner) the host memory is RAM and - device memory is the GPU global memory (e.g. GDDR5). - - References mentioned in code comments: - - 1. https://github.com/ethereum/wiki/wiki/Ethash - 2. https://github.com/ethereum/cpp-ethereum/blob/develop/libethash-cl/ethash_cl_miner.cpp - 3. https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/ - 4. http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_OpenCL_Programming_User_Guide.pdf - -*/ - -type OpenCLDevice struct { - deviceId int - device *cl.Device - openCL11 bool // OpenCL version 1.1 and 1.2 are handled a bit different - openCL12 bool - - dagBuf *cl.MemObject // Ethash full DAG in device mem - headerBuf *cl.MemObject // Hash of block-to-mine in device mem - searchBuffers []*cl.MemObject - - searchKernel *cl.Kernel - hashKernel *cl.Kernel - - queue *cl.CommandQueue - ctx *cl.Context - workGroupSize int - - nonceRand *mrand.Rand // seeded by crypto/rand, see comments where it's initialised - result common.Hash -} - -type OpenCLMiner struct { - mu sync.Mutex - - ethash *Ethash // Ethash full DAG & cache in host mem - - deviceIds []int - devices []*OpenCLDevice - - dagSize uint64 - - hashRate int32 // Go atomics & uint64 have some issues; int32 is supported on all platforms -} - -type pendingSearch struct { - bufIndex uint32 - startNonce uint64 -} - -const ( - SIZEOF_UINT32 = 4 - - // See [1] - ethashMixBytesLen = 128 - ethashAccesses = 64 - - // See [4] - workGroupSize = 32 // must be multiple of 8 - maxSearchResults = 63 - searchBufSize = 2 - globalWorkSize = 1024 * 256 -) - -func NewCL(deviceIds []int) *OpenCLMiner { - ids := make([]int, len(deviceIds)) - copy(ids, deviceIds) - return &OpenCLMiner{ - ethash: New(), - dagSize: 0, // to see if we need to update DAG. - deviceIds: ids, - } -} - -func PrintDevices() { - fmt.Println("=============================================") - fmt.Println("============ OpenCL Device Info =============") - fmt.Println("=============================================") - - var found []*cl.Device - - platforms, err := cl.GetPlatforms() - if err != nil { - fmt.Println("Plaform error (check your OpenCL installation):", err) - return - } - - for i, p := range platforms { - fmt.Println("Platform id ", i) - fmt.Println("Platform Name ", p.Name()) - fmt.Println("Platform Vendor ", p.Vendor()) - fmt.Println("Platform Version ", p.Version()) - fmt.Println("Platform Extensions ", p.Extensions()) - fmt.Println("Platform Profile ", p.Profile()) - fmt.Println("") - - devices, err := cl.GetDevices(p, cl.DeviceTypeGPU) - if err != nil { - fmt.Println("Device error (check your GPU drivers) :", err) - return - } - - for _, d := range devices { - fmt.Println("Device OpenCL id ", i) - fmt.Println("Device id for mining ", len(found)) - fmt.Println("Device Name ", d.Name()) - fmt.Println("Vendor ", d.Vendor()) - fmt.Println("Version ", d.Version()) - fmt.Println("Driver version ", d.DriverVersion()) - fmt.Println("Address bits ", d.AddressBits()) - fmt.Println("Max clock freq ", d.MaxClockFrequency()) - fmt.Println("Global mem size ", d.GlobalMemSize()) - fmt.Println("Max constant buffer size", d.MaxConstantBufferSize()) - fmt.Println("Max mem alloc size ", d.MaxMemAllocSize()) - fmt.Println("Max compute units ", d.MaxComputeUnits()) - fmt.Println("Max work group size ", d.MaxWorkGroupSize()) - fmt.Println("Max work item sizes ", d.MaxWorkItemSizes()) - fmt.Println("=============================================") - - found = append(found, d) - } - } - if len(found) == 0 { - fmt.Println("Found no GPU(s). Check that your OS can see the GPU(s)") - } else { - var idsFormat string - for i := 0; i < len(found); i++ { - idsFormat += strconv.Itoa(i) - if i != len(found)-1 { - idsFormat += "," - } - } - fmt.Printf("Found %v devices. Benchmark first GPU: geth gpubench 0\n", len(found)) - fmt.Printf("Mine using all GPUs: geth --minegpu %v\n", idsFormat) - } -} - -// See [2]. We basically do the same here, but the Go OpenCL bindings -// are at a slightly higher abtraction level. -func InitCL(blockNum uint64, c *OpenCLMiner) error { - platforms, err := cl.GetPlatforms() - if err != nil { - return fmt.Errorf("Plaform error: %v\nCheck your OpenCL installation and then run geth gpuinfo", err) - } - - var devices []*cl.Device - for _, p := range platforms { - ds, err := cl.GetDevices(p, cl.DeviceTypeGPU) - if err != nil { - return fmt.Errorf("Devices error: %v\nCheck your GPU drivers and then run geth gpuinfo", err) - } - for _, d := range ds { - devices = append(devices, d) - } - } - - pow := New() - _ = pow.getDAG(blockNum) // generates DAG if we don't have it - pow.Light.getCache(blockNum) // and cache - - c.ethash = pow - dagSize := uint64(C.ethash_get_datasize(C.uint64_t(blockNum))) - c.dagSize = dagSize - - for _, id := range c.deviceIds { - if id > len(devices)-1 { - return fmt.Errorf("Device id not found. See available device ids with: geth gpuinfo") - } else { - err := initCLDevice(id, devices[id], c) - if err != nil { - return err - } - } - } - if len(c.devices) == 0 { - return fmt.Errorf("No GPU devices found") - } - return nil -} - -func initCLDevice(deviceId int, device *cl.Device, c *OpenCLMiner) error { - devMaxAlloc := uint64(device.MaxMemAllocSize()) - devGlobalMem := uint64(device.GlobalMemSize()) - - // TODO: more fine grained version logic - if device.Version() == "OpenCL 1.0" { - fmt.Println("Device OpenCL version not supported: ", device.Version()) - return fmt.Errorf("opencl version not supported") - } - - var cl11, cl12 bool - if device.Version() == "OpenCL 1.1" { - cl11 = true - } - if device.Version() == "OpenCL 1.2" { - cl12 = true - } - - // log warnings but carry on; some device drivers report inaccurate values - if c.dagSize > devGlobalMem { - fmt.Printf("WARNING: device memory may be insufficient: %v. DAG size: %v.\n", devGlobalMem, c.dagSize) - } - - if c.dagSize > devMaxAlloc { - fmt.Printf("WARNING: DAG size (%v) larger than device max memory allocation size (%v).\n", c.dagSize, devMaxAlloc) - fmt.Printf("You probably have to export GPU_MAX_ALLOC_PERCENT=95\n") - } - - fmt.Printf("Initialising device %v: %v\n", deviceId, device.Name()) - - context, err := cl.CreateContext([]*cl.Device{device}) - if err != nil { - return fmt.Errorf("failed creating context: %v", err) - } - - // TODO: test running with CL_QUEUE_PROFILING_ENABLE for profiling? - queue, err := context.CreateCommandQueue(device, 0) - if err != nil { - return fmt.Errorf("command queue err: %v", err) - } - - // See [4] section 3.2 and [3] "clBuildProgram". - // The OpenCL kernel code is compiled at run-time. - kvs := make(map[string]string, 4) - kvs["GROUP_SIZE"] = strconv.FormatUint(workGroupSize, 10) - kvs["DAG_SIZE"] = strconv.FormatUint(c.dagSize/ethashMixBytesLen, 10) - kvs["ACCESSES"] = strconv.FormatUint(ethashAccesses, 10) - kvs["MAX_OUTPUTS"] = strconv.FormatUint(maxSearchResults, 10) - kernelCode := replaceWords(kernel, kvs) - - program, err := context.CreateProgramWithSource([]string{kernelCode}) - if err != nil { - return fmt.Errorf("program err: %v", err) - } - - /* if using AMD OpenCL impl, you can set this to debug on x86 CPU device. - see AMD OpenCL programming guide section 4.2 - - export in shell before running: - export AMD_OCL_BUILD_OPTIONS_APPEND="-g -O0" - export CPU_MAX_COMPUTE_UNITS=1 - - buildOpts := "-g -cl-opt-disable" - - */ - buildOpts := "" - err = program.BuildProgram([]*cl.Device{device}, buildOpts) - if err != nil { - return fmt.Errorf("program build err: %v", err) - } - - var searchKernelName, hashKernelName string - searchKernelName = "ethash_search" - hashKernelName = "ethash_hash" - - searchKernel, err := program.CreateKernel(searchKernelName) - hashKernel, err := program.CreateKernel(hashKernelName) - if err != nil { - return fmt.Errorf("kernel err: %v", err) - } - - // TODO: when this DAG size appears, patch the Go bindings - // (context.go) to work with uint64 as size_t - if c.dagSize > math.MaxInt32 { - fmt.Println("DAG too large for allocation.") - return fmt.Errorf("DAG too large for alloc") - } - - // TODO: patch up Go bindings to work with size_t, will overflow if > maxint32 - // TODO: fuck. shit's gonna overflow around 2017-06-09 12:17:02 - dagBuf := *(new(*cl.MemObject)) - dagBuf, err = context.CreateEmptyBuffer(cl.MemReadOnly, int(c.dagSize)) - if err != nil { - return fmt.Errorf("allocating dag buf failed: %v", err) - } - - // write DAG to device mem - dagPtr := unsafe.Pointer(c.ethash.Full.current.ptr.data) - _, err = queue.EnqueueWriteBuffer(dagBuf, true, 0, int(c.dagSize), dagPtr, nil) - if err != nil { - return fmt.Errorf("writing to dag buf failed: %v", err) - } - - searchBuffers := make([]*cl.MemObject, searchBufSize) - for i := 0; i < searchBufSize; i++ { - searchBuff, err := context.CreateEmptyBuffer(cl.MemWriteOnly, (1+maxSearchResults)*SIZEOF_UINT32) - if err != nil { - return fmt.Errorf("search buffer err: %v", err) - } - searchBuffers[i] = searchBuff - } - - headerBuf, err := context.CreateEmptyBuffer(cl.MemReadOnly, 32) - if err != nil { - return fmt.Errorf("header buffer err: %v", err) - } - - // Unique, random nonces are crucial for mining efficieny. - // While we do not need cryptographically secure PRNG for nonces, - // we want to have uniform distribution and minimal repetition of nonces. - // We could guarantee strict uniqueness of nonces by generating unique ranges, - // but a int64 seed from crypto/rand should be good enough. - // we then use math/rand for speed and to avoid draining OS entropy pool - seed, err := crand.Int(crand.Reader, big.NewInt(math.MaxInt64)) - if err != nil { - return err - } - nonceRand := mrand.New(mrand.NewSource(seed.Int64())) - - deviceStruct := &OpenCLDevice{ - deviceId: deviceId, - device: device, - openCL11: cl11, - openCL12: cl12, - - dagBuf: dagBuf, - headerBuf: headerBuf, - searchBuffers: searchBuffers, - - searchKernel: searchKernel, - hashKernel: hashKernel, - - queue: queue, - ctx: context, - - workGroupSize: workGroupSize, - - nonceRand: nonceRand, - } - c.devices = append(c.devices, deviceStruct) - - return nil -} - -func (c *OpenCLMiner) Search(block pow.Block, stop <-chan struct{}, index int) (uint64, []byte) { - c.mu.Lock() - newDagSize := uint64(C.ethash_get_datasize(C.uint64_t(block.NumberU64()))) - if newDagSize > c.dagSize { - // TODO: clean up buffers from previous DAG? - err := InitCL(block.NumberU64(), c) - if err != nil { - fmt.Println("OpenCL init error: ", err) - return 0, []byte{0} - } - } - defer c.mu.Unlock() - - // Avoid unneeded OpenCL initialisation if we received stop while running InitCL - select { - case <-stop: - return 0, []byte{0} - default: - } - - headerHash := block.HashNoNonce() - diff := block.Difficulty() - target256 := new(big.Int).Div(maxUint256, diff) - target64 := new(big.Int).Rsh(target256, 192).Uint64() - var zero uint32 = 0 - - d := c.devices[index] - - _, err := d.queue.EnqueueWriteBuffer(d.headerBuf, false, 0, 32, unsafe.Pointer(&headerHash[0]), nil) - if err != nil { - fmt.Println("Error in Search clEnqueueWriterBuffer : ", err) - return 0, []byte{0} - } - - for i := 0; i < searchBufSize; i++ { - _, err := d.queue.EnqueueWriteBuffer(d.searchBuffers[i], false, 0, 4, unsafe.Pointer(&zero), nil) - if err != nil { - fmt.Println("Error in Search clEnqueueWriterBuffer : ", err) - return 0, []byte{0} - } - } - - // wait for all search buffers to complete - err = d.queue.Finish() - if err != nil { - fmt.Println("Error in Search clFinish : ", err) - return 0, []byte{0} - } - - err = d.searchKernel.SetArg(1, d.headerBuf) - if err != nil { - fmt.Println("Error in Search clSetKernelArg : ", err) - return 0, []byte{0} - } - - err = d.searchKernel.SetArg(2, d.dagBuf) - if err != nil { - fmt.Println("Error in Search clSetKernelArg : ", err) - return 0, []byte{0} - } - - err = d.searchKernel.SetArg(4, target64) - if err != nil { - fmt.Println("Error in Search clSetKernelArg : ", err) - return 0, []byte{0} - } - err = d.searchKernel.SetArg(5, uint32(math.MaxUint32)) - if err != nil { - fmt.Println("Error in Search clSetKernelArg : ", err) - return 0, []byte{0} - } - - // wait on this before returning - var preReturnEvent *cl.Event - if d.openCL12 { - preReturnEvent, err = d.ctx.CreateUserEvent() - if err != nil { - fmt.Println("Error in Search create CL user event : ", err) - return 0, []byte{0} - } - } - - pending := make([]pendingSearch, 0, searchBufSize) - var p *pendingSearch - searchBufIndex := uint32(0) - var checkNonce uint64 - loops := int64(0) - prevHashRate := int32(0) - start := time.Now().UnixNano() - // we grab a single random nonce and sets this as argument to the kernel search function - // the device will then add each local threads gid to the nonce, creating a unique nonce - // for each device computing unit executing in parallel - initNonce := uint64(d.nonceRand.Int63()) - for nonce := initNonce; ; nonce += uint64(globalWorkSize) { - select { - case <-stop: - - /* - if d.openCL12 { - err = cl.WaitForEvents([]*cl.Event{preReturnEvent}) - if err != nil { - fmt.Println("Error in Search WaitForEvents: ", err) - } - } - */ - - atomic.AddInt32(&c.hashRate, -prevHashRate) - return 0, []byte{0} - default: - } - - if (loops % (1 << 7)) == 0 { - elapsed := time.Now().UnixNano() - start - // TODO: verify if this is correct hash rate calculation - hashes := (float64(1e9) / float64(elapsed)) * float64(loops*1024*256) - hashrateDiff := int32(hashes) - prevHashRate - prevHashRate = int32(hashes) - atomic.AddInt32(&c.hashRate, hashrateDiff) - } - loops++ - - err = d.searchKernel.SetArg(0, d.searchBuffers[searchBufIndex]) - if err != nil { - fmt.Println("Error in Search clSetKernelArg : ", err) - return 0, []byte{0} - } - err = d.searchKernel.SetArg(3, nonce) - if err != nil { - fmt.Println("Error in Search clSetKernelArg : ", err) - return 0, []byte{0} - } - - // execute kernel - _, err := d.queue.EnqueueNDRangeKernel( - d.searchKernel, - []int{0}, - []int{globalWorkSize}, - []int{d.workGroupSize}, - nil) - if err != nil { - fmt.Println("Error in Search clEnqueueNDRangeKernel : ", err) - return 0, []byte{0} - } - - pending = append(pending, pendingSearch{bufIndex: searchBufIndex, startNonce: nonce}) - searchBufIndex = (searchBufIndex + 1) % searchBufSize - - if len(pending) == searchBufSize { - p = &(pending[searchBufIndex]) - cres, _, err := d.queue.EnqueueMapBuffer(d.searchBuffers[p.bufIndex], true, - cl.MapFlagRead, 0, (1+maxSearchResults)*SIZEOF_UINT32, - nil) - if err != nil { - fmt.Println("Error in Search clEnqueueMapBuffer: ", err) - return 0, []byte{0} - } - - results := cres.ByteSlice() - nfound := binary.LittleEndian.Uint32(results) - nfound = uint32(math.Min(float64(nfound), float64(maxSearchResults))) - // OpenCL returns the offsets from the start nonce - for i := uint32(0); i < nfound; i++ { - lo := (i + 1) * SIZEOF_UINT32 - hi := (i + 2) * SIZEOF_UINT32 - upperNonce := uint64(binary.LittleEndian.Uint32(results[lo:hi])) - checkNonce = p.startNonce + upperNonce - if checkNonce != 0 { - // We verify that the nonce is indeed a solution by - // executing the Ethash verification function (on the CPU). - cache := c.ethash.Light.getCache(block.NumberU64()) - ok, mixDigest, result := cache.compute(c.dagSize, headerHash, checkNonce) - - // TODO: return result first - if ok && result.Big().Cmp(target256) <= 0 { - _, err = d.queue.EnqueueUnmapMemObject(d.searchBuffers[p.bufIndex], cres, nil) - if err != nil { - fmt.Println("Error in Search clEnqueueUnmapMemObject: ", err) - } - if d.openCL12 { - err = cl.WaitForEvents([]*cl.Event{preReturnEvent}) - if err != nil { - fmt.Println("Error in Search WaitForEvents: ", err) - } - } - return checkNonce, mixDigest.Bytes() - } - _, err := d.queue.EnqueueWriteBuffer(d.searchBuffers[p.bufIndex], false, 0, 4, unsafe.Pointer(&zero), nil) - if err != nil { - fmt.Println("Error in Search cl: EnqueueWriteBuffer", err) - return 0, []byte{0} - } - } - } - _, err = d.queue.EnqueueUnmapMemObject(d.searchBuffers[p.bufIndex], cres, nil) - if err != nil { - fmt.Println("Error in Search clEnqueueUnMapMemObject: ", err) - return 0, []byte{0} - } - pending = append(pending[:searchBufIndex], pending[searchBufIndex+1:]...) - } - } - if d.openCL12 { - err := cl.WaitForEvents([]*cl.Event{preReturnEvent}) - if err != nil { - fmt.Println("Error in Search clWaitForEvents: ", err) - return 0, []byte{0} - } - } - return 0, []byte{0} -} - -func (c *OpenCLMiner) Verify(block pow.Block) bool { - return c.ethash.Light.Verify(block) -} -func (c *OpenCLMiner) GetHashrate() int64 { - return int64(atomic.LoadInt32(&c.hashRate)) -} -func (c *OpenCLMiner) Turbo(on bool) { - // This is GPU mining. Always be turbo. -} - -func replaceWords(text string, kvs map[string]string) string { - for k, v := range kvs { - text = strings.Replace(text, k, v, -1) - } - return text -} - -func logErr(err error) { - if err != nil { - fmt.Println("Error in OpenCL call:", err) - } -} - -func argErr(err error) error { - return fmt.Errorf("arg err: %v", err) -} diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_opencl_kernel_go_str.go b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_opencl_kernel_go_str.go deleted file mode 100644 index 695ff18299..0000000000 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_opencl_kernel_go_str.go +++ /dev/null @@ -1,600 +0,0 @@ -package ethash - -/* DO NOT EDIT!!! - - This code is version controlled at - https://github.com/ethereum/cpp-ethereum/blob/develop/libethash-cl/ethash_cl_miner_kernel.cl - - If needed change it there first, then copy over here. -*/ - -const kernel = ` -// author Tim Hughes -// Tested on Radeon HD 7850 -// Hashrate: 15940347 hashes/s -// Bandwidth: 124533 MB/s -// search kernel should fit in <= 84 VGPRS (3 wavefronts) - -#define THREADS_PER_HASH (128 / 16) -#define HASHES_PER_LOOP (GROUP_SIZE / THREADS_PER_HASH) - -#define FNV_PRIME 0x01000193 - -__constant uint2 const Keccak_f1600_RC[24] = { - (uint2)(0x00000001, 0x00000000), - (uint2)(0x00008082, 0x00000000), - (uint2)(0x0000808a, 0x80000000), - (uint2)(0x80008000, 0x80000000), - (uint2)(0x0000808b, 0x00000000), - (uint2)(0x80000001, 0x00000000), - (uint2)(0x80008081, 0x80000000), - (uint2)(0x00008009, 0x80000000), - (uint2)(0x0000008a, 0x00000000), - (uint2)(0x00000088, 0x00000000), - (uint2)(0x80008009, 0x00000000), - (uint2)(0x8000000a, 0x00000000), - (uint2)(0x8000808b, 0x00000000), - (uint2)(0x0000008b, 0x80000000), - (uint2)(0x00008089, 0x80000000), - (uint2)(0x00008003, 0x80000000), - (uint2)(0x00008002, 0x80000000), - (uint2)(0x00000080, 0x80000000), - (uint2)(0x0000800a, 0x00000000), - (uint2)(0x8000000a, 0x80000000), - (uint2)(0x80008081, 0x80000000), - (uint2)(0x00008080, 0x80000000), - (uint2)(0x80000001, 0x00000000), - (uint2)(0x80008008, 0x80000000), -}; - -void keccak_f1600_round(uint2* a, uint r, uint out_size) -{ - #if !__ENDIAN_LITTLE__ - for (uint i = 0; i != 25; ++i) - a[i] = a[i].yx; - #endif - - uint2 b[25]; - uint2 t; - - // Theta - b[0] = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]; - b[1] = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]; - b[2] = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]; - b[3] = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]; - b[4] = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]; - t = b[4] ^ (uint2)(b[1].x << 1 | b[1].y >> 31, b[1].y << 1 | b[1].x >> 31); - a[0] ^= t; - a[5] ^= t; - a[10] ^= t; - a[15] ^= t; - a[20] ^= t; - t = b[0] ^ (uint2)(b[2].x << 1 | b[2].y >> 31, b[2].y << 1 | b[2].x >> 31); - a[1] ^= t; - a[6] ^= t; - a[11] ^= t; - a[16] ^= t; - a[21] ^= t; - t = b[1] ^ (uint2)(b[3].x << 1 | b[3].y >> 31, b[3].y << 1 | b[3].x >> 31); - a[2] ^= t; - a[7] ^= t; - a[12] ^= t; - a[17] ^= t; - a[22] ^= t; - t = b[2] ^ (uint2)(b[4].x << 1 | b[4].y >> 31, b[4].y << 1 | b[4].x >> 31); - a[3] ^= t; - a[8] ^= t; - a[13] ^= t; - a[18] ^= t; - a[23] ^= t; - t = b[3] ^ (uint2)(b[0].x << 1 | b[0].y >> 31, b[0].y << 1 | b[0].x >> 31); - a[4] ^= t; - a[9] ^= t; - a[14] ^= t; - a[19] ^= t; - a[24] ^= t; - - // Rho Pi - b[0] = a[0]; - b[10] = (uint2)(a[1].x << 1 | a[1].y >> 31, a[1].y << 1 | a[1].x >> 31); - b[7] = (uint2)(a[10].x << 3 | a[10].y >> 29, a[10].y << 3 | a[10].x >> 29); - b[11] = (uint2)(a[7].x << 6 | a[7].y >> 26, a[7].y << 6 | a[7].x >> 26); - b[17] = (uint2)(a[11].x << 10 | a[11].y >> 22, a[11].y << 10 | a[11].x >> 22); - b[18] = (uint2)(a[17].x << 15 | a[17].y >> 17, a[17].y << 15 | a[17].x >> 17); - b[3] = (uint2)(a[18].x << 21 | a[18].y >> 11, a[18].y << 21 | a[18].x >> 11); - b[5] = (uint2)(a[3].x << 28 | a[3].y >> 4, a[3].y << 28 | a[3].x >> 4); - b[16] = (uint2)(a[5].y << 4 | a[5].x >> 28, a[5].x << 4 | a[5].y >> 28); - b[8] = (uint2)(a[16].y << 13 | a[16].x >> 19, a[16].x << 13 | a[16].y >> 19); - b[21] = (uint2)(a[8].y << 23 | a[8].x >> 9, a[8].x << 23 | a[8].y >> 9); - b[24] = (uint2)(a[21].x << 2 | a[21].y >> 30, a[21].y << 2 | a[21].x >> 30); - b[4] = (uint2)(a[24].x << 14 | a[24].y >> 18, a[24].y << 14 | a[24].x >> 18); - b[15] = (uint2)(a[4].x << 27 | a[4].y >> 5, a[4].y << 27 | a[4].x >> 5); - b[23] = (uint2)(a[15].y << 9 | a[15].x >> 23, a[15].x << 9 | a[15].y >> 23); - b[19] = (uint2)(a[23].y << 24 | a[23].x >> 8, a[23].x << 24 | a[23].y >> 8); - b[13] = (uint2)(a[19].x << 8 | a[19].y >> 24, a[19].y << 8 | a[19].x >> 24); - b[12] = (uint2)(a[13].x << 25 | a[13].y >> 7, a[13].y << 25 | a[13].x >> 7); - b[2] = (uint2)(a[12].y << 11 | a[12].x >> 21, a[12].x << 11 | a[12].y >> 21); - b[20] = (uint2)(a[2].y << 30 | a[2].x >> 2, a[2].x << 30 | a[2].y >> 2); - b[14] = (uint2)(a[20].x << 18 | a[20].y >> 14, a[20].y << 18 | a[20].x >> 14); - b[22] = (uint2)(a[14].y << 7 | a[14].x >> 25, a[14].x << 7 | a[14].y >> 25); - b[9] = (uint2)(a[22].y << 29 | a[22].x >> 3, a[22].x << 29 | a[22].y >> 3); - b[6] = (uint2)(a[9].x << 20 | a[9].y >> 12, a[9].y << 20 | a[9].x >> 12); - b[1] = (uint2)(a[6].y << 12 | a[6].x >> 20, a[6].x << 12 | a[6].y >> 20); - - // Chi - a[0] = bitselect(b[0] ^ b[2], b[0], b[1]); - a[1] = bitselect(b[1] ^ b[3], b[1], b[2]); - a[2] = bitselect(b[2] ^ b[4], b[2], b[3]); - a[3] = bitselect(b[3] ^ b[0], b[3], b[4]); - if (out_size >= 4) - { - a[4] = bitselect(b[4] ^ b[1], b[4], b[0]); - a[5] = bitselect(b[5] ^ b[7], b[5], b[6]); - a[6] = bitselect(b[6] ^ b[8], b[6], b[7]); - a[7] = bitselect(b[7] ^ b[9], b[7], b[8]); - a[8] = bitselect(b[8] ^ b[5], b[8], b[9]); - if (out_size >= 8) - { - a[9] = bitselect(b[9] ^ b[6], b[9], b[5]); - a[10] = bitselect(b[10] ^ b[12], b[10], b[11]); - a[11] = bitselect(b[11] ^ b[13], b[11], b[12]); - a[12] = bitselect(b[12] ^ b[14], b[12], b[13]); - a[13] = bitselect(b[13] ^ b[10], b[13], b[14]); - a[14] = bitselect(b[14] ^ b[11], b[14], b[10]); - a[15] = bitselect(b[15] ^ b[17], b[15], b[16]); - a[16] = bitselect(b[16] ^ b[18], b[16], b[17]); - a[17] = bitselect(b[17] ^ b[19], b[17], b[18]); - a[18] = bitselect(b[18] ^ b[15], b[18], b[19]); - a[19] = bitselect(b[19] ^ b[16], b[19], b[15]); - a[20] = bitselect(b[20] ^ b[22], b[20], b[21]); - a[21] = bitselect(b[21] ^ b[23], b[21], b[22]); - a[22] = bitselect(b[22] ^ b[24], b[22], b[23]); - a[23] = bitselect(b[23] ^ b[20], b[23], b[24]); - a[24] = bitselect(b[24] ^ b[21], b[24], b[20]); - } - } - - // Iota - a[0] ^= Keccak_f1600_RC[r]; - - #if !__ENDIAN_LITTLE__ - for (uint i = 0; i != 25; ++i) - a[i] = a[i].yx; - #endif -} - -void keccak_f1600_no_absorb(ulong* a, uint in_size, uint out_size, uint isolate) -{ - for (uint i = in_size; i != 25; ++i) - { - a[i] = 0; - } -#if __ENDIAN_LITTLE__ - a[in_size] ^= 0x0000000000000001; - a[24-out_size*2] ^= 0x8000000000000000; -#else - a[in_size] ^= 0x0100000000000000; - a[24-out_size*2] ^= 0x0000000000000080; -#endif - - // Originally I unrolled the first and last rounds to interface - // better with surrounding code, however I haven't done this - // without causing the AMD compiler to blow up the VGPR usage. - uint r = 0; - do - { - // This dynamic branch stops the AMD compiler unrolling the loop - // and additionally saves about 33% of the VGPRs, enough to gain another - // wavefront. Ideally we'd get 4 in flight, but 3 is the best I can - // massage out of the compiler. It doesn't really seem to matter how - // much we try and help the compiler save VGPRs because it seems to throw - // that information away, hence the implementation of keccak here - // doesn't bother. - if (isolate) - { - keccak_f1600_round((uint2*)a, r++, 25); - } - } - while (r < 23); - - // final round optimised for digest size - keccak_f1600_round((uint2*)a, r++, out_size); -} - -#define copy(dst, src, count) for (uint i = 0; i != count; ++i) { (dst)[i] = (src)[i]; } - -#define countof(x) (sizeof(x) / sizeof(x[0])) - -uint fnv(uint x, uint y) -{ - return x * FNV_PRIME ^ y; -} - -uint4 fnv4(uint4 x, uint4 y) -{ - return x * FNV_PRIME ^ y; -} - -uint fnv_reduce(uint4 v) -{ - return fnv(fnv(fnv(v.x, v.y), v.z), v.w); -} - -typedef union -{ - ulong ulongs[32 / sizeof(ulong)]; - uint uints[32 / sizeof(uint)]; -} hash32_t; - -typedef union -{ - ulong ulongs[64 / sizeof(ulong)]; - uint4 uint4s[64 / sizeof(uint4)]; -} hash64_t; - -typedef union -{ - uint uints[128 / sizeof(uint)]; - uint4 uint4s[128 / sizeof(uint4)]; -} hash128_t; - -hash64_t init_hash(__constant hash32_t const* header, ulong nonce, uint isolate) -{ - hash64_t init; - uint const init_size = countof(init.ulongs); - uint const hash_size = countof(header->ulongs); - - // sha3_512(header .. nonce) - ulong state[25]; - copy(state, header->ulongs, hash_size); - state[hash_size] = nonce; - keccak_f1600_no_absorb(state, hash_size + 1, init_size, isolate); - - copy(init.ulongs, state, init_size); - return init; -} - -uint inner_loop_chunks(uint4 init, uint thread_id, __local uint* share, __global hash128_t const* g_dag, __global hash128_t const* g_dag1, __global hash128_t const* g_dag2, __global hash128_t const* g_dag3, uint isolate) -{ - uint4 mix = init; - - // share init0 - if (thread_id == 0) - *share = mix.x; - barrier(CLK_LOCAL_MEM_FENCE); - uint init0 = *share; - - uint a = 0; - do - { - bool update_share = thread_id == (a/4) % THREADS_PER_HASH; - - #pragma unroll - for (uint i = 0; i != 4; ++i) - { - if (update_share) - { - uint m[4] = { mix.x, mix.y, mix.z, mix.w }; - *share = fnv(init0 ^ (a+i), m[i]) % DAG_SIZE; - } - barrier(CLK_LOCAL_MEM_FENCE); - - mix = fnv4(mix, *share>=3 * DAG_SIZE / 4 ? g_dag3[*share - 3 * DAG_SIZE / 4].uint4s[thread_id] : *share>=DAG_SIZE / 2 ? g_dag2[*share - DAG_SIZE / 2].uint4s[thread_id] : *share>=DAG_SIZE / 4 ? g_dag1[*share - DAG_SIZE / 4].uint4s[thread_id]:g_dag[*share].uint4s[thread_id]); - } - } while ((a += 4) != (ACCESSES & isolate)); - - return fnv_reduce(mix); -} - - - -uint inner_loop(uint4 init, uint thread_id, __local uint* share, __global hash128_t const* g_dag, uint isolate) -{ - uint4 mix = init; - - // share init0 - if (thread_id == 0) - *share = mix.x; - barrier(CLK_LOCAL_MEM_FENCE); - uint init0 = *share; - - uint a = 0; - do - { - bool update_share = thread_id == (a/4) % THREADS_PER_HASH; - - #pragma unroll - for (uint i = 0; i != 4; ++i) - { - if (update_share) - { - uint m[4] = { mix.x, mix.y, mix.z, mix.w }; - *share = fnv(init0 ^ (a+i), m[i]) % DAG_SIZE; - } - barrier(CLK_LOCAL_MEM_FENCE); - - mix = fnv4(mix, g_dag[*share].uint4s[thread_id]); - } - } - while ((a += 4) != (ACCESSES & isolate)); - - return fnv_reduce(mix); -} - - -hash32_t final_hash(hash64_t const* init, hash32_t const* mix, uint isolate) -{ - ulong state[25]; - - hash32_t hash; - uint const hash_size = countof(hash.ulongs); - uint const init_size = countof(init->ulongs); - uint const mix_size = countof(mix->ulongs); - - // keccak_256(keccak_512(header..nonce) .. mix); - copy(state, init->ulongs, init_size); - copy(state + init_size, mix->ulongs, mix_size); - keccak_f1600_no_absorb(state, init_size+mix_size, hash_size, isolate); - - // copy out - copy(hash.ulongs, state, hash_size); - return hash; -} - -hash32_t compute_hash_simple( - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - ulong nonce, - uint isolate - ) -{ - hash64_t init = init_hash(g_header, nonce, isolate); - - hash128_t mix; - for (uint i = 0; i != countof(mix.uint4s); ++i) - { - mix.uint4s[i] = init.uint4s[i % countof(init.uint4s)]; - } - - uint mix_val = mix.uints[0]; - uint init0 = mix.uints[0]; - uint a = 0; - do - { - uint pi = fnv(init0 ^ a, mix_val) % DAG_SIZE; - uint n = (a+1) % countof(mix.uints); - - #pragma unroll - for (uint i = 0; i != countof(mix.uints); ++i) - { - mix.uints[i] = fnv(mix.uints[i], g_dag[pi].uints[i]); - mix_val = i == n ? mix.uints[i] : mix_val; - } - } - while (++a != (ACCESSES & isolate)); - - // reduce to output - hash32_t fnv_mix; - for (uint i = 0; i != countof(fnv_mix.uints); ++i) - { - fnv_mix.uints[i] = fnv_reduce(mix.uint4s[i]); - } - - return final_hash(&init, &fnv_mix, isolate); -} - -typedef union -{ - struct - { - hash64_t init; - uint pad; // avoid lds bank conflicts - }; - hash32_t mix; -} compute_hash_share; - - -hash32_t compute_hash( - __local compute_hash_share* share, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - ulong nonce, - uint isolate - ) -{ - uint const gid = get_global_id(0); - - // Compute one init hash per work item. - hash64_t init = init_hash(g_header, nonce, isolate); - - // Threads work together in this phase in groups of 8. - uint const thread_id = gid % THREADS_PER_HASH; - uint const hash_id = (gid % GROUP_SIZE) / THREADS_PER_HASH; - - hash32_t mix; - uint i = 0; - do - { - // share init with other threads - if (i == thread_id) - share[hash_id].init = init; - barrier(CLK_LOCAL_MEM_FENCE); - - uint4 thread_init = share[hash_id].init.uint4s[thread_id % (64 / sizeof(uint4))]; - barrier(CLK_LOCAL_MEM_FENCE); - - uint thread_mix = inner_loop(thread_init, thread_id, share[hash_id].mix.uints, g_dag, isolate); - - share[hash_id].mix.uints[thread_id] = thread_mix; - barrier(CLK_LOCAL_MEM_FENCE); - - if (i == thread_id) - mix = share[hash_id].mix; - barrier(CLK_LOCAL_MEM_FENCE); - } - while (++i != (THREADS_PER_HASH & isolate)); - - return final_hash(&init, &mix, isolate); -} - - -hash32_t compute_hash_chunks( - __local compute_hash_share* share, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - __global hash128_t const* g_dag1, - __global hash128_t const* g_dag2, - __global hash128_t const* g_dag3, - ulong nonce, - uint isolate - ) -{ - uint const gid = get_global_id(0); - - // Compute one init hash per work item. - hash64_t init = init_hash(g_header, nonce, isolate); - - // Threads work together in this phase in groups of 8. - uint const thread_id = gid % THREADS_PER_HASH; - uint const hash_id = (gid % GROUP_SIZE) / THREADS_PER_HASH; - - hash32_t mix; - uint i = 0; - do - { - // share init with other threads - if (i == thread_id) - share[hash_id].init = init; - barrier(CLK_LOCAL_MEM_FENCE); - - uint4 thread_init = share[hash_id].init.uint4s[thread_id % (64 / sizeof(uint4))]; - barrier(CLK_LOCAL_MEM_FENCE); - - uint thread_mix = inner_loop_chunks(thread_init, thread_id, share[hash_id].mix.uints, g_dag, g_dag1, g_dag2, g_dag3, isolate); - - share[hash_id].mix.uints[thread_id] = thread_mix; - barrier(CLK_LOCAL_MEM_FENCE); - - if (i == thread_id) - mix = share[hash_id].mix; - barrier(CLK_LOCAL_MEM_FENCE); - } - while (++i != (THREADS_PER_HASH & isolate)); - - return final_hash(&init, &mix, isolate); -} - -__attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) -__kernel void ethash_hash_simple( - __global hash32_t* g_hashes, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - ulong start_nonce, - uint isolate - ) -{ - uint const gid = get_global_id(0); - g_hashes[gid] = compute_hash_simple(g_header, g_dag, start_nonce + gid, isolate); -} - -__attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) -__kernel void ethash_search_simple( - __global volatile uint* restrict g_output, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - ulong start_nonce, - ulong target, - uint isolate - ) -{ - uint const gid = get_global_id(0); - hash32_t hash = compute_hash_simple(g_header, g_dag, start_nonce + gid, isolate); - - if (hash.ulongs[countof(hash.ulongs)-1] < target) - { - uint slot = min(convert_uint(MAX_OUTPUTS), convert_uint(atomic_inc(&g_output[0]) + 1)); - g_output[slot] = gid; - } -} - - -__attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) -__kernel void ethash_hash( - __global hash32_t* g_hashes, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - ulong start_nonce, - uint isolate - ) -{ - __local compute_hash_share share[HASHES_PER_LOOP]; - - uint const gid = get_global_id(0); - g_hashes[gid] = compute_hash(share, g_header, g_dag, start_nonce + gid, isolate); -} - -__attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) -__kernel void ethash_search( - __global volatile uint* restrict g_output, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - ulong start_nonce, - ulong target, - uint isolate - ) -{ - __local compute_hash_share share[HASHES_PER_LOOP]; - - uint const gid = get_global_id(0); - hash32_t hash = compute_hash(share, g_header, g_dag, start_nonce + gid, isolate); - - if (as_ulong(as_uchar8(hash.ulongs[0]).s76543210) < target) - { - uint slot = min((uint)MAX_OUTPUTS, atomic_inc(&g_output[0]) + 1); - g_output[slot] = gid; - } -} - -__attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) -__kernel void ethash_hash_chunks( - __global hash32_t* g_hashes, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - __global hash128_t const* g_dag1, - __global hash128_t const* g_dag2, - __global hash128_t const* g_dag3, - ulong start_nonce, - uint isolate - ) -{ - __local compute_hash_share share[HASHES_PER_LOOP]; - - uint const gid = get_global_id(0); - g_hashes[gid] = compute_hash_chunks(share, g_header, g_dag, g_dag1, g_dag2, g_dag3,start_nonce + gid, isolate); -} - -__attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) -__kernel void ethash_search_chunks( - __global volatile uint* restrict g_output, - __constant hash32_t const* g_header, - __global hash128_t const* g_dag, - __global hash128_t const* g_dag1, - __global hash128_t const* g_dag2, - __global hash128_t const* g_dag3, - ulong start_nonce, - ulong target, - uint isolate - ) -{ - __local compute_hash_share share[HASHES_PER_LOOP]; - - uint const gid = get_global_id(0); - hash32_t hash = compute_hash_chunks(share, g_header, g_dag, g_dag1, g_dag2, g_dag3, start_nonce + gid, isolate); - - if (as_ulong(as_uchar8(hash.ulongs[0]).s76543210) < target) - { - uint slot = min(convert_uint(MAX_OUTPUTS), convert_uint(atomic_inc(&g_output[0]) + 1)); - g_output[slot] = gid; - } -} -` diff --git a/Godeps/_workspace/src/github.com/fatih/color/.travis.yml b/Godeps/_workspace/src/github.com/fatih/color/.travis.yml deleted file mode 100644 index 2405aef3a8..0000000000 --- a/Godeps/_workspace/src/github.com/fatih/color/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: go -go: 1.3 - diff --git a/Godeps/_workspace/src/github.com/gizak/termui/debug/debuger.go b/Godeps/_workspace/src/github.com/gizak/termui/debug/debuger.go deleted file mode 100644 index f723b9686c..0000000000 --- a/Godeps/_workspace/src/github.com/gizak/termui/debug/debuger.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2016 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package debug - -import ( - "fmt" - "net/http" - - "golang.org/x/net/websocket" -) - -type Server struct { - Port string - Addr string - Path string - Msg chan string - chs []chan string -} - -type Client struct { - Port string - Addr string - Path string - ws *websocket.Conn -} - -var defaultPort = ":8080" - -func NewServer() *Server { - return &Server{ - Port: defaultPort, - Addr: "localhost", - Path: "/echo", - Msg: make(chan string), - chs: make([]chan string, 0), - } -} - -func NewClient() Client { - return Client{ - Port: defaultPort, - Addr: "localhost", - Path: "/echo", - } -} - -func (c Client) ConnectAndListen() error { - ws, err := websocket.Dial("ws://"+c.Addr+c.Port+c.Path, "", "http://"+c.Addr) - if err != nil { - return err - } - defer ws.Close() - - var m string - for { - err := websocket.Message.Receive(ws, &m) - if err != nil { - fmt.Print(err) - return err - } - fmt.Print(m) - } -} - -func (s *Server) ListenAndServe() error { - http.Handle(s.Path, websocket.Handler(func(ws *websocket.Conn) { - defer ws.Close() - - mc := make(chan string) - s.chs = append(s.chs, mc) - - for m := range mc { - websocket.Message.Send(ws, m) - } - })) - - go func() { - for msg := range s.Msg { - for _, c := range s.chs { - go func(a chan string) { - a <- msg - }(c) - } - } - }() - - return http.ListenAndServe(s.Port, nil) -} - -func (s *Server) Log(msg string) { - go func() { s.Msg <- msg }() -} - -func (s *Server) Logf(format string, a ...interface{}) { - s.Log(fmt.Sprintf(format, a...)) -} - -var DefaultServer = NewServer() -var DefaultClient = NewClient() - -func ListenAndServe() error { - return DefaultServer.ListenAndServe() -} - -func ConnectAndListen() error { - return DefaultClient.ConnectAndListen() -} - -func Log(msg string) { - DefaultServer.Log(msg) -} - -func Logf(format string, a ...interface{}) { - DefaultServer.Logf(format, a...) -} diff --git a/Godeps/_workspace/src/github.com/gizak/termui/test/runtest.go b/Godeps/_workspace/src/github.com/gizak/termui/test/runtest.go deleted file mode 100644 index 99794c4dbd..0000000000 --- a/Godeps/_workspace/src/github.com/gizak/termui/test/runtest.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2016 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package main - -import ( - "fmt" - "os" - - "github.com/gizak/termui" - "github.com/gizak/termui/debug" -) - -func main() { - // run as client - if len(os.Args) > 1 { - fmt.Print(debug.ConnectAndListen()) - return - } - - // run as server - go func() { panic(debug.ListenAndServe()) }() - - if err := termui.Init(); err != nil { - panic(err) - } - defer termui.Close() - - //termui.UseTheme("helloworld") - b := termui.NewBlock() - b.Width = 20 - b.Height = 20 - b.Float = termui.AlignCenter - b.BorderLabel = "[HELLO](fg-red,bg-white) [WORLD](fg-blue,bg-green)" - - termui.Render(b) - - termui.Handle("/sys", func(e termui.Event) { - k, ok := e.Data.(termui.EvtKbd) - debug.Logf("->%v\n", e) - if ok && k.KeyStr == "q" { - termui.StopLoop() - } - }) - - termui.Handle(("/usr"), func(e termui.Event) { - debug.Logf("->%v\n", e) - }) - - termui.Handle("/timer/1s", func(e termui.Event) { - t := e.Data.(termui.EvtTimer) - termui.SendCustomEvt("/usr/t", t.Count) - - if t.Count%2 == 0 { - b.BorderLabel = "[HELLO](fg-red,bg-green) [WORLD](fg-blue,bg-white)" - } else { - b.BorderLabel = "[HELLO](fg-blue,bg-white) [WORLD](fg-red,bg-green)" - } - - termui.Render(b) - - }) - - termui.Loop() -} diff --git a/Godeps/_workspace/src/github.com/golang/snappy/README b/Godeps/_workspace/src/github.com/golang/snappy/README deleted file mode 100644 index 5074bbab8d..0000000000 --- a/Godeps/_workspace/src/github.com/golang/snappy/README +++ /dev/null @@ -1,7 +0,0 @@ -The Snappy compression format in the Go programming language. - -To download and install from source: -$ go get github.com/golang/snappy - -Unless otherwise noted, the Snappy-Go source files are distributed -under the BSD-style license found in the LICENSE file. diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_httpu_serving/example_httpu_serving.go b/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_httpu_serving/example_httpu_serving.go deleted file mode 100644 index d9d9daa936..0000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_httpu_serving/example_httpu_serving.go +++ /dev/null @@ -1,20 +0,0 @@ -package main - -import ( - "log" - "net/http" - - "github.com/huin/goupnp/httpu" -) - -func main() { - srv := httpu.Server{ - Addr: "239.255.255.250:1900", - Multicast: true, - Handler: httpu.HandlerFunc(func(r *http.Request) { - log.Printf("Got %s %s message from %v: %v", r.Method, r.URL.Path, r.RemoteAddr, r.Header) - }), - } - err := srv.ListenAndServe() - log.Printf("Serving failed with error: %v", err) -} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_internetgateway1/example_internetgateway1.go b/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_internetgateway1/example_internetgateway1.go deleted file mode 100644 index 29e8adc8b0..0000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_internetgateway1/example_internetgateway1.go +++ /dev/null @@ -1,67 +0,0 @@ -package main - -import ( - "fmt" - "log" - - "github.com/huin/goupnp/dcps/internetgateway1" -) - -func main() { - clients, errors, err := internetgateway1.NewWANPPPConnection1Clients() - if err != nil { - log.Fatal(err) - } - - fmt.Printf("Got %d errors finding servers and %d successfully discovered.\n", - len(errors), len(clients)) - for i, e := range errors { - fmt.Printf("Error finding server #%d: %v\n", i+1, e) - } - - for _, c := range clients { - dev := &c.ServiceClient.RootDevice.Device - srv := c.ServiceClient.Service - fmt.Println(dev.FriendlyName, " :: ", srv.String()) - scpd, err := srv.RequestSCDP() - if err != nil { - fmt.Printf(" Error requesting service SCPD: %v\n", err) - } else { - fmt.Println(" Available actions:") - for _, action := range scpd.Actions { - fmt.Printf(" * %s\n", action.Name) - for _, arg := range action.Arguments { - var varDesc string - if stateVar := scpd.GetStateVariable(arg.RelatedStateVariable); stateVar != nil { - varDesc = fmt.Sprintf(" (%s)", stateVar.DataType.Name) - } - fmt.Printf(" * [%s] %s%s\n", arg.Direction, arg.Name, varDesc) - } - } - } - - if scpd == nil || scpd.GetAction("GetExternalIPAddress") != nil { - ip, err := c.GetExternalIPAddress() - fmt.Println("GetExternalIPAddress: ", ip, err) - } - - if scpd == nil || scpd.GetAction("GetStatusInfo") != nil { - status, lastErr, uptime, err := c.GetStatusInfo() - fmt.Println("GetStatusInfo: ", status, lastErr, uptime, err) - } - - if scpd == nil || scpd.GetAction("GetIdleDisconnectTime") != nil { - idleTime, err := c.GetIdleDisconnectTime() - fmt.Println("GetIdleDisconnectTime: ", idleTime, err) - } - - if scpd == nil || scpd.GetAction("AddPortMapping") != nil { - err := c.AddPortMapping("", 5000, "TCP", 5001, "192.168.1.2", true, "Test port mapping", 0) - fmt.Println("AddPortMapping: ", err) - } - if scpd == nil || scpd.GetAction("DeletePortMapping") != nil { - err := c.DeletePortMapping("", 5000, "TCP") - fmt.Println("DeletePortMapping: ", err) - } - } -} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_ssdp_registry/example_ssdp_registry.go b/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_ssdp_registry/example_ssdp_registry.go deleted file mode 100644 index 05f0df0037..0000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_ssdp_registry/example_ssdp_registry.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "log" - - "github.com/huin/goupnp/ssdp" -) - -func main() { - c := make(chan ssdp.Update) - srv, reg := ssdp.NewServerAndRegistry() - reg.AddListener(c) - go listener(c) - if err := srv.ListenAndServe(); err != nil { - log.Print("ListenAndServe failed: ", err) - } -} - -func listener(c <-chan ssdp.Update) { - for u := range c { - if u.Entry != nil { - log.Printf("Event: %v USN: %s Entry: %#v", u.EventType, u.USN, *u.Entry) - } else { - log.Printf("Event: %v USN: %s Entry: ", u.EventType, u.USN) - } - } -} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/av1/av1.go b/Godeps/_workspace/src/github.com/huin/goupnp/dcps/av1/av1.go deleted file mode 100644 index 5f9683d1f6..0000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/av1/av1.go +++ /dev/null @@ -1,8452 +0,0 @@ -// Client for UPnP Device Control Protocol MediaServer v1 and MediaRenderer v1. -// -// This DCP is documented in detail at: http://upnp.org/specs/av/av1/ -// -// Typically, use one of the New* functions to create clients for services. -package av1 - -// Generated file - do not edit by hand. See README.md - -import ( - "net/url" - "time" - - "github.com/huin/goupnp" - "github.com/huin/goupnp/soap" -) - -// Hack to avoid Go complaining if time isn't used. -var _ time.Time - -// Device URNs: -const () - -// Service URNs: -const ( - URN_AVTransport_1 = "urn:schemas-upnp-org:service:AVTransport:1" - URN_AVTransport_2 = "urn:schemas-upnp-org:service:AVTransport:2" - URN_ConnectionManager_1 = "urn:schemas-upnp-org:service:ConnectionManager:1" - URN_ConnectionManager_2 = "urn:schemas-upnp-org:service:ConnectionManager:2" - URN_ContentDirectory_1 = "urn:schemas-upnp-org:service:ContentDirectory:1" - URN_ContentDirectory_2 = "urn:schemas-upnp-org:service:ContentDirectory:2" - URN_ContentDirectory_3 = "urn:schemas-upnp-org:service:ContentDirectory:3" - URN_RenderingControl_1 = "urn:schemas-upnp-org:service:RenderingControl:1" - URN_RenderingControl_2 = "urn:schemas-upnp-org:service:RenderingControl:2" - URN_ScheduledRecording_1 = "urn:schemas-upnp-org:service:ScheduledRecording:1" - URN_ScheduledRecording_2 = "urn:schemas-upnp-org:service:ScheduledRecording:2" -) - -// AVTransport1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:AVTransport:1". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type AVTransport1 struct { - goupnp.ServiceClient -} - -// NewAVTransport1Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewAVTransport1Clients() (clients []*AVTransport1, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_1); err != nil { - return - } - clients = newAVTransport1ClientsFromGenericClients(genericClients) - return -} - -// NewAVTransport1ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewAVTransport1ClientsByURL(loc *url.URL) ([]*AVTransport1, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_1) - if err != nil { - return nil, err - } - return newAVTransport1ClientsFromGenericClients(genericClients), nil -} - -// NewAVTransport1ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewAVTransport1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*AVTransport1, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_AVTransport_1) - if err != nil { - return nil, err - } - return newAVTransport1ClientsFromGenericClients(genericClients), nil -} - -func newAVTransport1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*AVTransport1 { - clients := make([]*AVTransport1, len(genericClients)) - for i := range genericClients { - clients[i] = &AVTransport1{genericClients[i]} - } - return clients -} - -func (client *AVTransport1) SetAVTransportURI(InstanceID uint32, CurrentURI string, CurrentURIMetaData string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - CurrentURI string - - CurrentURIMetaData string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.CurrentURI, err = soap.MarshalString(CurrentURI); err != nil { - return - } - if request.CurrentURIMetaData, err = soap.MarshalString(CurrentURIMetaData); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "SetAVTransportURI", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) SetNextAVTransportURI(InstanceID uint32, NextURI string, NextURIMetaData string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - NextURI string - - NextURIMetaData string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.NextURI, err = soap.MarshalString(NextURI); err != nil { - return - } - if request.NextURIMetaData, err = soap.MarshalString(NextURIMetaData); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "SetNextAVTransportURI", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * NrTracks: allowed value range: minimum=0 -func (client *AVTransport1) GetMediaInfo(InstanceID uint32) (NrTracks uint32, MediaDuration string, CurrentURI string, CurrentURIMetaData string, NextURI string, NextURIMetaData string, PlayMedium string, RecordMedium string, WriteStatus string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - NrTracks string - - MediaDuration string - - CurrentURI string - - CurrentURIMetaData string - - NextURI string - - NextURIMetaData string - - PlayMedium string - - RecordMedium string - - WriteStatus string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetMediaInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if NrTracks, err = soap.UnmarshalUi4(response.NrTracks); err != nil { - return - } - if MediaDuration, err = soap.UnmarshalString(response.MediaDuration); err != nil { - return - } - if CurrentURI, err = soap.UnmarshalString(response.CurrentURI); err != nil { - return - } - if CurrentURIMetaData, err = soap.UnmarshalString(response.CurrentURIMetaData); err != nil { - return - } - if NextURI, err = soap.UnmarshalString(response.NextURI); err != nil { - return - } - if NextURIMetaData, err = soap.UnmarshalString(response.NextURIMetaData); err != nil { - return - } - if PlayMedium, err = soap.UnmarshalString(response.PlayMedium); err != nil { - return - } - if RecordMedium, err = soap.UnmarshalString(response.RecordMedium); err != nil { - return - } - if WriteStatus, err = soap.UnmarshalString(response.WriteStatus); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentTransportState: allowed values: STOPPED, PLAYING -// -// * CurrentTransportStatus: allowed values: OK, ERROR_OCCURRED -// -// * CurrentSpeed: allowed values: 1 -func (client *AVTransport1) GetTransportInfo(InstanceID uint32) (CurrentTransportState string, CurrentTransportStatus string, CurrentSpeed string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentTransportState string - - CurrentTransportStatus string - - CurrentSpeed string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetTransportInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentTransportState, err = soap.UnmarshalString(response.CurrentTransportState); err != nil { - return - } - if CurrentTransportStatus, err = soap.UnmarshalString(response.CurrentTransportStatus); err != nil { - return - } - if CurrentSpeed, err = soap.UnmarshalString(response.CurrentSpeed); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * Track: allowed value range: minimum=0, step=1 -func (client *AVTransport1) GetPositionInfo(InstanceID uint32) (Track uint32, TrackDuration string, TrackMetaData string, TrackURI string, RelTime string, AbsTime string, RelCount int32, AbsCount int32, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Track string - - TrackDuration string - - TrackMetaData string - - TrackURI string - - RelTime string - - AbsTime string - - RelCount string - - AbsCount string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetPositionInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Track, err = soap.UnmarshalUi4(response.Track); err != nil { - return - } - if TrackDuration, err = soap.UnmarshalString(response.TrackDuration); err != nil { - return - } - if TrackMetaData, err = soap.UnmarshalString(response.TrackMetaData); err != nil { - return - } - if TrackURI, err = soap.UnmarshalString(response.TrackURI); err != nil { - return - } - if RelTime, err = soap.UnmarshalString(response.RelTime); err != nil { - return - } - if AbsTime, err = soap.UnmarshalString(response.AbsTime); err != nil { - return - } - if RelCount, err = soap.UnmarshalI4(response.RelCount); err != nil { - return - } - if AbsCount, err = soap.UnmarshalI4(response.AbsCount); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) GetDeviceCapabilities(InstanceID uint32) (PlayMedia string, RecMedia string, RecQualityModes string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - PlayMedia string - - RecMedia string - - RecQualityModes string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetDeviceCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if PlayMedia, err = soap.UnmarshalString(response.PlayMedia); err != nil { - return - } - if RecMedia, err = soap.UnmarshalString(response.RecMedia); err != nil { - return - } - if RecQualityModes, err = soap.UnmarshalString(response.RecQualityModes); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * PlayMode: allowed values: NORMAL -func (client *AVTransport1) GetTransportSettings(InstanceID uint32) (PlayMode string, RecQualityMode string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - PlayMode string - - RecQualityMode string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetTransportSettings", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if PlayMode, err = soap.UnmarshalString(response.PlayMode); err != nil { - return - } - if RecQualityMode, err = soap.UnmarshalString(response.RecQualityMode); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) Stop(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Stop", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Speed: allowed values: 1 - -func (client *AVTransport1) Play(InstanceID uint32, Speed string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Speed string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Speed, err = soap.MarshalString(Speed); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Play", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) Pause(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Pause", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) Record(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Record", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Unit: allowed values: TRACK_NR - -func (client *AVTransport1) Seek(InstanceID uint32, Unit string, Target string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Unit string - - Target string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Unit, err = soap.MarshalString(Unit); err != nil { - return - } - if request.Target, err = soap.MarshalString(Target); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Seek", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) Next(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Next", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) Previous(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Previous", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * NewPlayMode: allowed values: NORMAL - -func (client *AVTransport1) SetPlayMode(InstanceID uint32, NewPlayMode string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - NewPlayMode string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.NewPlayMode, err = soap.MarshalString(NewPlayMode); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "SetPlayMode", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) SetRecordQualityMode(InstanceID uint32, NewRecordQualityMode string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - NewRecordQualityMode string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.NewRecordQualityMode, err = soap.MarshalString(NewRecordQualityMode); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "SetRecordQualityMode", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport1) GetCurrentTransportActions(InstanceID uint32) (Actions string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Actions string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetCurrentTransportActions", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Actions, err = soap.UnmarshalString(response.Actions); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// AVTransport2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:AVTransport:2". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type AVTransport2 struct { - goupnp.ServiceClient -} - -// NewAVTransport2Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewAVTransport2Clients() (clients []*AVTransport2, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_2); err != nil { - return - } - clients = newAVTransport2ClientsFromGenericClients(genericClients) - return -} - -// NewAVTransport2ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewAVTransport2ClientsByURL(loc *url.URL) ([]*AVTransport2, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_2) - if err != nil { - return nil, err - } - return newAVTransport2ClientsFromGenericClients(genericClients), nil -} - -// NewAVTransport2ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewAVTransport2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*AVTransport2, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_AVTransport_2) - if err != nil { - return nil, err - } - return newAVTransport2ClientsFromGenericClients(genericClients), nil -} - -func newAVTransport2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*AVTransport2 { - clients := make([]*AVTransport2, len(genericClients)) - for i := range genericClients { - clients[i] = &AVTransport2{genericClients[i]} - } - return clients -} - -func (client *AVTransport2) SetAVTransportURI(InstanceID uint32, CurrentURI string, CurrentURIMetaData string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - CurrentURI string - - CurrentURIMetaData string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.CurrentURI, err = soap.MarshalString(CurrentURI); err != nil { - return - } - if request.CurrentURIMetaData, err = soap.MarshalString(CurrentURIMetaData); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetAVTransportURI", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) SetNextAVTransportURI(InstanceID uint32, NextURI string, NextURIMetaData string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - NextURI string - - NextURIMetaData string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.NextURI, err = soap.MarshalString(NextURI); err != nil { - return - } - if request.NextURIMetaData, err = soap.MarshalString(NextURIMetaData); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetNextAVTransportURI", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * NrTracks: allowed value range: minimum=0 -func (client *AVTransport2) GetMediaInfo(InstanceID uint32) (NrTracks uint32, MediaDuration string, CurrentURI string, CurrentURIMetaData string, NextURI string, NextURIMetaData string, PlayMedium string, RecordMedium string, WriteStatus string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - NrTracks string - - MediaDuration string - - CurrentURI string - - CurrentURIMetaData string - - NextURI string - - NextURIMetaData string - - PlayMedium string - - RecordMedium string - - WriteStatus string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetMediaInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if NrTracks, err = soap.UnmarshalUi4(response.NrTracks); err != nil { - return - } - if MediaDuration, err = soap.UnmarshalString(response.MediaDuration); err != nil { - return - } - if CurrentURI, err = soap.UnmarshalString(response.CurrentURI); err != nil { - return - } - if CurrentURIMetaData, err = soap.UnmarshalString(response.CurrentURIMetaData); err != nil { - return - } - if NextURI, err = soap.UnmarshalString(response.NextURI); err != nil { - return - } - if NextURIMetaData, err = soap.UnmarshalString(response.NextURIMetaData); err != nil { - return - } - if PlayMedium, err = soap.UnmarshalString(response.PlayMedium); err != nil { - return - } - if RecordMedium, err = soap.UnmarshalString(response.RecordMedium); err != nil { - return - } - if WriteStatus, err = soap.UnmarshalString(response.WriteStatus); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentType: allowed values: NO_MEDIA, TRACK_AWARE, TRACK_UNAWARE -// -// * NrTracks: allowed value range: minimum=0 -func (client *AVTransport2) GetMediaInfo_Ext(InstanceID uint32) (CurrentType string, NrTracks uint32, MediaDuration string, CurrentURI string, CurrentURIMetaData string, NextURI string, NextURIMetaData string, PlayMedium string, RecordMedium string, WriteStatus string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentType string - - NrTracks string - - MediaDuration string - - CurrentURI string - - CurrentURIMetaData string - - NextURI string - - NextURIMetaData string - - PlayMedium string - - RecordMedium string - - WriteStatus string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetMediaInfo_Ext", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentType, err = soap.UnmarshalString(response.CurrentType); err != nil { - return - } - if NrTracks, err = soap.UnmarshalUi4(response.NrTracks); err != nil { - return - } - if MediaDuration, err = soap.UnmarshalString(response.MediaDuration); err != nil { - return - } - if CurrentURI, err = soap.UnmarshalString(response.CurrentURI); err != nil { - return - } - if CurrentURIMetaData, err = soap.UnmarshalString(response.CurrentURIMetaData); err != nil { - return - } - if NextURI, err = soap.UnmarshalString(response.NextURI); err != nil { - return - } - if NextURIMetaData, err = soap.UnmarshalString(response.NextURIMetaData); err != nil { - return - } - if PlayMedium, err = soap.UnmarshalString(response.PlayMedium); err != nil { - return - } - if RecordMedium, err = soap.UnmarshalString(response.RecordMedium); err != nil { - return - } - if WriteStatus, err = soap.UnmarshalString(response.WriteStatus); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentTransportState: allowed values: STOPPED, PLAYING -// -// * CurrentTransportStatus: allowed values: OK, ERROR_OCCURRED -// -// * CurrentSpeed: allowed values: 1 -func (client *AVTransport2) GetTransportInfo(InstanceID uint32) (CurrentTransportState string, CurrentTransportStatus string, CurrentSpeed string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentTransportState string - - CurrentTransportStatus string - - CurrentSpeed string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetTransportInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentTransportState, err = soap.UnmarshalString(response.CurrentTransportState); err != nil { - return - } - if CurrentTransportStatus, err = soap.UnmarshalString(response.CurrentTransportStatus); err != nil { - return - } - if CurrentSpeed, err = soap.UnmarshalString(response.CurrentSpeed); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * Track: allowed value range: minimum=0, step=1 -func (client *AVTransport2) GetPositionInfo(InstanceID uint32) (Track uint32, TrackDuration string, TrackMetaData string, TrackURI string, RelTime string, AbsTime string, RelCount int32, AbsCount int32, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Track string - - TrackDuration string - - TrackMetaData string - - TrackURI string - - RelTime string - - AbsTime string - - RelCount string - - AbsCount string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetPositionInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Track, err = soap.UnmarshalUi4(response.Track); err != nil { - return - } - if TrackDuration, err = soap.UnmarshalString(response.TrackDuration); err != nil { - return - } - if TrackMetaData, err = soap.UnmarshalString(response.TrackMetaData); err != nil { - return - } - if TrackURI, err = soap.UnmarshalString(response.TrackURI); err != nil { - return - } - if RelTime, err = soap.UnmarshalString(response.RelTime); err != nil { - return - } - if AbsTime, err = soap.UnmarshalString(response.AbsTime); err != nil { - return - } - if RelCount, err = soap.UnmarshalI4(response.RelCount); err != nil { - return - } - if AbsCount, err = soap.UnmarshalI4(response.AbsCount); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) GetDeviceCapabilities(InstanceID uint32) (PlayMedia string, RecMedia string, RecQualityModes string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - PlayMedia string - - RecMedia string - - RecQualityModes string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetDeviceCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if PlayMedia, err = soap.UnmarshalString(response.PlayMedia); err != nil { - return - } - if RecMedia, err = soap.UnmarshalString(response.RecMedia); err != nil { - return - } - if RecQualityModes, err = soap.UnmarshalString(response.RecQualityModes); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * PlayMode: allowed values: NORMAL -func (client *AVTransport2) GetTransportSettings(InstanceID uint32) (PlayMode string, RecQualityMode string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - PlayMode string - - RecQualityMode string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetTransportSettings", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if PlayMode, err = soap.UnmarshalString(response.PlayMode); err != nil { - return - } - if RecQualityMode, err = soap.UnmarshalString(response.RecQualityMode); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) Stop(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Stop", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Speed: allowed values: 1 - -func (client *AVTransport2) Play(InstanceID uint32, Speed string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Speed string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Speed, err = soap.MarshalString(Speed); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Play", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) Pause(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Pause", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) Record(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Record", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Unit: allowed values: TRACK_NR - -func (client *AVTransport2) Seek(InstanceID uint32, Unit string, Target string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Unit string - - Target string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Unit, err = soap.MarshalString(Unit); err != nil { - return - } - if request.Target, err = soap.MarshalString(Target); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Seek", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) Next(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Next", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) Previous(InstanceID uint32) (err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Previous", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * NewPlayMode: allowed values: NORMAL - -func (client *AVTransport2) SetPlayMode(InstanceID uint32, NewPlayMode string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - NewPlayMode string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.NewPlayMode, err = soap.MarshalString(NewPlayMode); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetPlayMode", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) SetRecordQualityMode(InstanceID uint32, NewRecordQualityMode string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - NewRecordQualityMode string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.NewRecordQualityMode, err = soap.MarshalString(NewRecordQualityMode); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetRecordQualityMode", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) GetCurrentTransportActions(InstanceID uint32) (Actions string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Actions string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetCurrentTransportActions", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Actions, err = soap.UnmarshalString(response.Actions); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentDRMState: allowed values: OK -func (client *AVTransport2) GetDRMState(InstanceID uint32) (CurrentDRMState string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentDRMState string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetDRMState", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentDRMState, err = soap.UnmarshalString(response.CurrentDRMState); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) GetStateVariables(InstanceID uint32, StateVariableList string) (StateVariableValuePairs string, err error) { - // Request structure. - request := &struct { - InstanceID string - - StateVariableList string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.StateVariableList, err = soap.MarshalString(StateVariableList); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - StateVariableValuePairs string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetStateVariables", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if StateVariableValuePairs, err = soap.UnmarshalString(response.StateVariableValuePairs); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *AVTransport2) SetStateVariables(InstanceID uint32, AVTransportUDN string, ServiceType string, ServiceId string, StateVariableValuePairs string) (StateVariableList string, err error) { - // Request structure. - request := &struct { - InstanceID string - - AVTransportUDN string - - ServiceType string - - ServiceId string - - StateVariableValuePairs string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.AVTransportUDN, err = soap.MarshalString(AVTransportUDN); err != nil { - return - } - if request.ServiceType, err = soap.MarshalString(ServiceType); err != nil { - return - } - if request.ServiceId, err = soap.MarshalString(ServiceId); err != nil { - return - } - if request.StateVariableValuePairs, err = soap.MarshalString(StateVariableValuePairs); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - StateVariableList string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetStateVariables", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if StateVariableList, err = soap.UnmarshalString(response.StateVariableList); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// ConnectionManager1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ConnectionManager:1". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type ConnectionManager1 struct { - goupnp.ServiceClient -} - -// NewConnectionManager1Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewConnectionManager1Clients() (clients []*ConnectionManager1, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_1); err != nil { - return - } - clients = newConnectionManager1ClientsFromGenericClients(genericClients) - return -} - -// NewConnectionManager1ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewConnectionManager1ClientsByURL(loc *url.URL) ([]*ConnectionManager1, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_1) - if err != nil { - return nil, err - } - return newConnectionManager1ClientsFromGenericClients(genericClients), nil -} - -// NewConnectionManager1ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewConnectionManager1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ConnectionManager1, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ConnectionManager_1) - if err != nil { - return nil, err - } - return newConnectionManager1ClientsFromGenericClients(genericClients), nil -} - -func newConnectionManager1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ConnectionManager1 { - clients := make([]*ConnectionManager1, len(genericClients)) - for i := range genericClients { - clients[i] = &ConnectionManager1{genericClients[i]} - } - return clients -} - -func (client *ConnectionManager1) GetProtocolInfo() (Source string, Sink string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Source string - - Sink string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "GetProtocolInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Source, err = soap.UnmarshalString(response.Source); err != nil { - return - } - if Sink, err = soap.UnmarshalString(response.Sink); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Direction: allowed values: Input, Output - -func (client *ConnectionManager1) PrepareForConnection(RemoteProtocolInfo string, PeerConnectionManager string, PeerConnectionID int32, Direction string) (ConnectionID int32, AVTransportID int32, RcsID int32, err error) { - // Request structure. - request := &struct { - RemoteProtocolInfo string - - PeerConnectionManager string - - PeerConnectionID string - - Direction string - }{} - // BEGIN Marshal arguments into request. - - if request.RemoteProtocolInfo, err = soap.MarshalString(RemoteProtocolInfo); err != nil { - return - } - if request.PeerConnectionManager, err = soap.MarshalString(PeerConnectionManager); err != nil { - return - } - if request.PeerConnectionID, err = soap.MarshalI4(PeerConnectionID); err != nil { - return - } - if request.Direction, err = soap.MarshalString(Direction); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - ConnectionID string - - AVTransportID string - - RcsID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "PrepareForConnection", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if ConnectionID, err = soap.UnmarshalI4(response.ConnectionID); err != nil { - return - } - if AVTransportID, err = soap.UnmarshalI4(response.AVTransportID); err != nil { - return - } - if RcsID, err = soap.UnmarshalI4(response.RcsID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ConnectionManager1) ConnectionComplete(ConnectionID int32) (err error) { - // Request structure. - request := &struct { - ConnectionID string - }{} - // BEGIN Marshal arguments into request. - - if request.ConnectionID, err = soap.MarshalI4(ConnectionID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "ConnectionComplete", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ConnectionManager1) GetCurrentConnectionIDs() (ConnectionIDs string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - ConnectionIDs string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "GetCurrentConnectionIDs", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if ConnectionIDs, err = soap.UnmarshalString(response.ConnectionIDs); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * Direction: allowed values: Input, Output -// -// * Status: allowed values: OK, ContentFormatMismatch, InsufficientBandwidth, UnreliableChannel, Unknown -func (client *ConnectionManager1) GetCurrentConnectionInfo(ConnectionID int32) (RcsID int32, AVTransportID int32, ProtocolInfo string, PeerConnectionManager string, PeerConnectionID int32, Direction string, Status string, err error) { - // Request structure. - request := &struct { - ConnectionID string - }{} - // BEGIN Marshal arguments into request. - - if request.ConnectionID, err = soap.MarshalI4(ConnectionID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - RcsID string - - AVTransportID string - - ProtocolInfo string - - PeerConnectionManager string - - PeerConnectionID string - - Direction string - - Status string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "GetCurrentConnectionInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if RcsID, err = soap.UnmarshalI4(response.RcsID); err != nil { - return - } - if AVTransportID, err = soap.UnmarshalI4(response.AVTransportID); err != nil { - return - } - if ProtocolInfo, err = soap.UnmarshalString(response.ProtocolInfo); err != nil { - return - } - if PeerConnectionManager, err = soap.UnmarshalString(response.PeerConnectionManager); err != nil { - return - } - if PeerConnectionID, err = soap.UnmarshalI4(response.PeerConnectionID); err != nil { - return - } - if Direction, err = soap.UnmarshalString(response.Direction); err != nil { - return - } - if Status, err = soap.UnmarshalString(response.Status); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// ConnectionManager2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ConnectionManager:2". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type ConnectionManager2 struct { - goupnp.ServiceClient -} - -// NewConnectionManager2Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewConnectionManager2Clients() (clients []*ConnectionManager2, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_2); err != nil { - return - } - clients = newConnectionManager2ClientsFromGenericClients(genericClients) - return -} - -// NewConnectionManager2ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewConnectionManager2ClientsByURL(loc *url.URL) ([]*ConnectionManager2, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_2) - if err != nil { - return nil, err - } - return newConnectionManager2ClientsFromGenericClients(genericClients), nil -} - -// NewConnectionManager2ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewConnectionManager2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ConnectionManager2, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ConnectionManager_2) - if err != nil { - return nil, err - } - return newConnectionManager2ClientsFromGenericClients(genericClients), nil -} - -func newConnectionManager2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ConnectionManager2 { - clients := make([]*ConnectionManager2, len(genericClients)) - for i := range genericClients { - clients[i] = &ConnectionManager2{genericClients[i]} - } - return clients -} - -func (client *ConnectionManager2) GetProtocolInfo() (Source string, Sink string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Source string - - Sink string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "GetProtocolInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Source, err = soap.UnmarshalString(response.Source); err != nil { - return - } - if Sink, err = soap.UnmarshalString(response.Sink); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Direction: allowed values: Input, Output - -func (client *ConnectionManager2) PrepareForConnection(RemoteProtocolInfo string, PeerConnectionManager string, PeerConnectionID int32, Direction string) (ConnectionID int32, AVTransportID int32, RcsID int32, err error) { - // Request structure. - request := &struct { - RemoteProtocolInfo string - - PeerConnectionManager string - - PeerConnectionID string - - Direction string - }{} - // BEGIN Marshal arguments into request. - - if request.RemoteProtocolInfo, err = soap.MarshalString(RemoteProtocolInfo); err != nil { - return - } - if request.PeerConnectionManager, err = soap.MarshalString(PeerConnectionManager); err != nil { - return - } - if request.PeerConnectionID, err = soap.MarshalI4(PeerConnectionID); err != nil { - return - } - if request.Direction, err = soap.MarshalString(Direction); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - ConnectionID string - - AVTransportID string - - RcsID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "PrepareForConnection", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if ConnectionID, err = soap.UnmarshalI4(response.ConnectionID); err != nil { - return - } - if AVTransportID, err = soap.UnmarshalI4(response.AVTransportID); err != nil { - return - } - if RcsID, err = soap.UnmarshalI4(response.RcsID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ConnectionManager2) ConnectionComplete(ConnectionID int32) (err error) { - // Request structure. - request := &struct { - ConnectionID string - }{} - // BEGIN Marshal arguments into request. - - if request.ConnectionID, err = soap.MarshalI4(ConnectionID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "ConnectionComplete", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ConnectionManager2) GetCurrentConnectionIDs() (ConnectionIDs string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - ConnectionIDs string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "GetCurrentConnectionIDs", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if ConnectionIDs, err = soap.UnmarshalString(response.ConnectionIDs); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * Direction: allowed values: Input, Output -// -// * Status: allowed values: OK, ContentFormatMismatch, InsufficientBandwidth, UnreliableChannel, Unknown -func (client *ConnectionManager2) GetCurrentConnectionInfo(ConnectionID int32) (RcsID int32, AVTransportID int32, ProtocolInfo string, PeerConnectionManager string, PeerConnectionID int32, Direction string, Status string, err error) { - // Request structure. - request := &struct { - ConnectionID string - }{} - // BEGIN Marshal arguments into request. - - if request.ConnectionID, err = soap.MarshalI4(ConnectionID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - RcsID string - - AVTransportID string - - ProtocolInfo string - - PeerConnectionManager string - - PeerConnectionID string - - Direction string - - Status string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "GetCurrentConnectionInfo", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if RcsID, err = soap.UnmarshalI4(response.RcsID); err != nil { - return - } - if AVTransportID, err = soap.UnmarshalI4(response.AVTransportID); err != nil { - return - } - if ProtocolInfo, err = soap.UnmarshalString(response.ProtocolInfo); err != nil { - return - } - if PeerConnectionManager, err = soap.UnmarshalString(response.PeerConnectionManager); err != nil { - return - } - if PeerConnectionID, err = soap.UnmarshalI4(response.PeerConnectionID); err != nil { - return - } - if Direction, err = soap.UnmarshalString(response.Direction); err != nil { - return - } - if Status, err = soap.UnmarshalString(response.Status); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// ContentDirectory1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ContentDirectory:1". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type ContentDirectory1 struct { - goupnp.ServiceClient -} - -// NewContentDirectory1Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewContentDirectory1Clients() (clients []*ContentDirectory1, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_1); err != nil { - return - } - clients = newContentDirectory1ClientsFromGenericClients(genericClients) - return -} - -// NewContentDirectory1ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewContentDirectory1ClientsByURL(loc *url.URL) ([]*ContentDirectory1, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_1) - if err != nil { - return nil, err - } - return newContentDirectory1ClientsFromGenericClients(genericClients), nil -} - -// NewContentDirectory1ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewContentDirectory1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ContentDirectory1, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ContentDirectory_1) - if err != nil { - return nil, err - } - return newContentDirectory1ClientsFromGenericClients(genericClients), nil -} - -func newContentDirectory1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ContentDirectory1 { - clients := make([]*ContentDirectory1, len(genericClients)) - for i := range genericClients { - clients[i] = &ContentDirectory1{genericClients[i]} - } - return clients -} - -func (client *ContentDirectory1) GetSearchCapabilities() (SearchCaps string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SearchCaps string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "GetSearchCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SearchCaps, err = soap.UnmarshalString(response.SearchCaps); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) GetSortCapabilities() (SortCaps string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SortCaps string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "GetSortCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) GetSystemUpdateID() (Id uint32, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Id string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "GetSystemUpdateID", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Id, err = soap.UnmarshalUi4(response.Id); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * BrowseFlag: allowed values: BrowseMetadata, BrowseDirectChildren - -func (client *ContentDirectory1) Browse(ObjectID string, BrowseFlag string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - ObjectID string - - BrowseFlag string - - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - if request.BrowseFlag, err = soap.MarshalString(BrowseFlag); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "Browse", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) Search(ContainerID string, SearchCriteria string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - ContainerID string - - SearchCriteria string - - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.SearchCriteria, err = soap.MarshalString(SearchCriteria); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "Search", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) CreateObject(ContainerID string, Elements string) (ObjectID string, Result string, err error) { - // Request structure. - request := &struct { - ContainerID string - - Elements string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.Elements, err = soap.MarshalString(Elements); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - ObjectID string - - Result string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "CreateObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if ObjectID, err = soap.UnmarshalString(response.ObjectID); err != nil { - return - } - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) DestroyObject(ObjectID string) (err error) { - // Request structure. - request := &struct { - ObjectID string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "DestroyObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) UpdateObject(ObjectID string, CurrentTagValue string, NewTagValue string) (err error) { - // Request structure. - request := &struct { - ObjectID string - - CurrentTagValue string - - NewTagValue string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - if request.CurrentTagValue, err = soap.MarshalString(CurrentTagValue); err != nil { - return - } - if request.NewTagValue, err = soap.MarshalString(NewTagValue); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "UpdateObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) ImportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { - // Request structure. - request := &struct { - SourceURI string - - DestinationURI string - }{} - // BEGIN Marshal arguments into request. - - if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { - return - } - if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "ImportResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) ExportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { - // Request structure. - request := &struct { - SourceURI string - - DestinationURI string - }{} - // BEGIN Marshal arguments into request. - - if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { - return - } - if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "ExportResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) StopTransferResource(TransferID uint32) (err error) { - // Request structure. - request := &struct { - TransferID string - }{} - // BEGIN Marshal arguments into request. - - if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "StopTransferResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * TransferStatus: allowed values: COMPLETED, ERROR, IN_PROGRESS, STOPPED -func (client *ContentDirectory1) GetTransferProgress(TransferID uint32) (TransferStatus string, TransferLength string, TransferTotal string, err error) { - // Request structure. - request := &struct { - TransferID string - }{} - // BEGIN Marshal arguments into request. - - if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferStatus string - - TransferLength string - - TransferTotal string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "GetTransferProgress", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferStatus, err = soap.UnmarshalString(response.TransferStatus); err != nil { - return - } - if TransferLength, err = soap.UnmarshalString(response.TransferLength); err != nil { - return - } - if TransferTotal, err = soap.UnmarshalString(response.TransferTotal); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) DeleteResource(ResourceURI *url.URL) (err error) { - // Request structure. - request := &struct { - ResourceURI string - }{} - // BEGIN Marshal arguments into request. - - if request.ResourceURI, err = soap.MarshalURI(ResourceURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "DeleteResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory1) CreateReference(ContainerID string, ObjectID string) (NewID string, err error) { - // Request structure. - request := &struct { - ContainerID string - - ObjectID string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - NewID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "CreateReference", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if NewID, err = soap.UnmarshalString(response.NewID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// ContentDirectory2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ContentDirectory:2". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type ContentDirectory2 struct { - goupnp.ServiceClient -} - -// NewContentDirectory2Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewContentDirectory2Clients() (clients []*ContentDirectory2, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_2); err != nil { - return - } - clients = newContentDirectory2ClientsFromGenericClients(genericClients) - return -} - -// NewContentDirectory2ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewContentDirectory2ClientsByURL(loc *url.URL) ([]*ContentDirectory2, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_2) - if err != nil { - return nil, err - } - return newContentDirectory2ClientsFromGenericClients(genericClients), nil -} - -// NewContentDirectory2ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewContentDirectory2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ContentDirectory2, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ContentDirectory_2) - if err != nil { - return nil, err - } - return newContentDirectory2ClientsFromGenericClients(genericClients), nil -} - -func newContentDirectory2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ContentDirectory2 { - clients := make([]*ContentDirectory2, len(genericClients)) - for i := range genericClients { - clients[i] = &ContentDirectory2{genericClients[i]} - } - return clients -} - -func (client *ContentDirectory2) GetSearchCapabilities() (SearchCaps string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SearchCaps string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetSearchCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SearchCaps, err = soap.UnmarshalString(response.SearchCaps); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) GetSortCapabilities() (SortCaps string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SortCaps string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetSortCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) GetSortExtensionCapabilities() (SortExtensionCaps string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SortExtensionCaps string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetSortExtensionCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SortExtensionCaps, err = soap.UnmarshalString(response.SortExtensionCaps); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) GetFeatureList() (FeatureList string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - FeatureList string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetFeatureList", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if FeatureList, err = soap.UnmarshalString(response.FeatureList); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) GetSystemUpdateID() (Id uint32, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Id string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetSystemUpdateID", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Id, err = soap.UnmarshalUi4(response.Id); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * BrowseFlag: allowed values: BrowseMetadata, BrowseDirectChildren - -func (client *ContentDirectory2) Browse(ObjectID string, BrowseFlag string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - ObjectID string - - BrowseFlag string - - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - if request.BrowseFlag, err = soap.MarshalString(BrowseFlag); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "Browse", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) Search(ContainerID string, SearchCriteria string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - ContainerID string - - SearchCriteria string - - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.SearchCriteria, err = soap.MarshalString(SearchCriteria); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "Search", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) CreateObject(ContainerID string, Elements string) (ObjectID string, Result string, err error) { - // Request structure. - request := &struct { - ContainerID string - - Elements string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.Elements, err = soap.MarshalString(Elements); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - ObjectID string - - Result string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "CreateObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if ObjectID, err = soap.UnmarshalString(response.ObjectID); err != nil { - return - } - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) DestroyObject(ObjectID string) (err error) { - // Request structure. - request := &struct { - ObjectID string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "DestroyObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) UpdateObject(ObjectID string, CurrentTagValue string, NewTagValue string) (err error) { - // Request structure. - request := &struct { - ObjectID string - - CurrentTagValue string - - NewTagValue string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - if request.CurrentTagValue, err = soap.MarshalString(CurrentTagValue); err != nil { - return - } - if request.NewTagValue, err = soap.MarshalString(NewTagValue); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "UpdateObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) MoveObject(ObjectID string, NewParentID string) (NewObjectID string, err error) { - // Request structure. - request := &struct { - ObjectID string - - NewParentID string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - if request.NewParentID, err = soap.MarshalString(NewParentID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - NewObjectID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "MoveObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if NewObjectID, err = soap.UnmarshalString(response.NewObjectID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) ImportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { - // Request structure. - request := &struct { - SourceURI string - - DestinationURI string - }{} - // BEGIN Marshal arguments into request. - - if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { - return - } - if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "ImportResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) ExportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { - // Request structure. - request := &struct { - SourceURI string - - DestinationURI string - }{} - // BEGIN Marshal arguments into request. - - if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { - return - } - if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "ExportResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) DeleteResource(ResourceURI *url.URL) (err error) { - // Request structure. - request := &struct { - ResourceURI string - }{} - // BEGIN Marshal arguments into request. - - if request.ResourceURI, err = soap.MarshalURI(ResourceURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "DeleteResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) StopTransferResource(TransferID uint32) (err error) { - // Request structure. - request := &struct { - TransferID string - }{} - // BEGIN Marshal arguments into request. - - if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "StopTransferResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * TransferStatus: allowed values: COMPLETED, ERROR, IN_PROGRESS, STOPPED -func (client *ContentDirectory2) GetTransferProgress(TransferID uint32) (TransferStatus string, TransferLength string, TransferTotal string, err error) { - // Request structure. - request := &struct { - TransferID string - }{} - // BEGIN Marshal arguments into request. - - if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferStatus string - - TransferLength string - - TransferTotal string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetTransferProgress", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferStatus, err = soap.UnmarshalString(response.TransferStatus); err != nil { - return - } - if TransferLength, err = soap.UnmarshalString(response.TransferLength); err != nil { - return - } - if TransferTotal, err = soap.UnmarshalString(response.TransferTotal); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory2) CreateReference(ContainerID string, ObjectID string) (NewID string, err error) { - // Request structure. - request := &struct { - ContainerID string - - ObjectID string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - NewID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "CreateReference", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if NewID, err = soap.UnmarshalString(response.NewID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// ContentDirectory3 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ContentDirectory:3". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type ContentDirectory3 struct { - goupnp.ServiceClient -} - -// NewContentDirectory3Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewContentDirectory3Clients() (clients []*ContentDirectory3, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_3); err != nil { - return - } - clients = newContentDirectory3ClientsFromGenericClients(genericClients) - return -} - -// NewContentDirectory3ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewContentDirectory3ClientsByURL(loc *url.URL) ([]*ContentDirectory3, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_3) - if err != nil { - return nil, err - } - return newContentDirectory3ClientsFromGenericClients(genericClients), nil -} - -// NewContentDirectory3ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewContentDirectory3ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ContentDirectory3, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ContentDirectory_3) - if err != nil { - return nil, err - } - return newContentDirectory3ClientsFromGenericClients(genericClients), nil -} - -func newContentDirectory3ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ContentDirectory3 { - clients := make([]*ContentDirectory3, len(genericClients)) - for i := range genericClients { - clients[i] = &ContentDirectory3{genericClients[i]} - } - return clients -} - -func (client *ContentDirectory3) GetSearchCapabilities() (SearchCaps string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SearchCaps string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetSearchCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SearchCaps, err = soap.UnmarshalString(response.SearchCaps); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) GetSortCapabilities() (SortCaps string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SortCaps string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetSortCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) GetSortExtensionCapabilities() (SortExtensionCaps string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SortExtensionCaps string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetSortExtensionCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SortExtensionCaps, err = soap.UnmarshalString(response.SortExtensionCaps); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) GetFeatureList() (FeatureList string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - FeatureList string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetFeatureList", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if FeatureList, err = soap.UnmarshalString(response.FeatureList); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) GetSystemUpdateID() (Id uint32, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Id string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetSystemUpdateID", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Id, err = soap.UnmarshalUi4(response.Id); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) GetServiceResetToken() (ResetToken string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - ResetToken string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetServiceResetToken", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if ResetToken, err = soap.UnmarshalString(response.ResetToken); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * BrowseFlag: allowed values: BrowseMetadata, BrowseDirectChildren - -func (client *ContentDirectory3) Browse(ObjectID string, BrowseFlag string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - ObjectID string - - BrowseFlag string - - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - if request.BrowseFlag, err = soap.MarshalString(BrowseFlag); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "Browse", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) Search(ContainerID string, SearchCriteria string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - ContainerID string - - SearchCriteria string - - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.SearchCriteria, err = soap.MarshalString(SearchCriteria); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "Search", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) CreateObject(ContainerID string, Elements string) (ObjectID string, Result string, err error) { - // Request structure. - request := &struct { - ContainerID string - - Elements string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.Elements, err = soap.MarshalString(Elements); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - ObjectID string - - Result string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "CreateObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if ObjectID, err = soap.UnmarshalString(response.ObjectID); err != nil { - return - } - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) DestroyObject(ObjectID string) (err error) { - // Request structure. - request := &struct { - ObjectID string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "DestroyObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) UpdateObject(ObjectID string, CurrentTagValue string, NewTagValue string) (err error) { - // Request structure. - request := &struct { - ObjectID string - - CurrentTagValue string - - NewTagValue string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - if request.CurrentTagValue, err = soap.MarshalString(CurrentTagValue); err != nil { - return - } - if request.NewTagValue, err = soap.MarshalString(NewTagValue); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "UpdateObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) MoveObject(ObjectID string, NewParentID string) (NewObjectID string, err error) { - // Request structure. - request := &struct { - ObjectID string - - NewParentID string - }{} - // BEGIN Marshal arguments into request. - - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - if request.NewParentID, err = soap.MarshalString(NewParentID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - NewObjectID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "MoveObject", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if NewObjectID, err = soap.UnmarshalString(response.NewObjectID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) ImportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { - // Request structure. - request := &struct { - SourceURI string - - DestinationURI string - }{} - // BEGIN Marshal arguments into request. - - if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { - return - } - if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "ImportResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) ExportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { - // Request structure. - request := &struct { - SourceURI string - - DestinationURI string - }{} - // BEGIN Marshal arguments into request. - - if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { - return - } - if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "ExportResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) DeleteResource(ResourceURI *url.URL) (err error) { - // Request structure. - request := &struct { - ResourceURI string - }{} - // BEGIN Marshal arguments into request. - - if request.ResourceURI, err = soap.MarshalURI(ResourceURI); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "DeleteResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) StopTransferResource(TransferID uint32) (err error) { - // Request structure. - request := &struct { - TransferID string - }{} - // BEGIN Marshal arguments into request. - - if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "StopTransferResource", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * TransferStatus: allowed values: COMPLETED, ERROR, IN_PROGRESS, STOPPED -func (client *ContentDirectory3) GetTransferProgress(TransferID uint32) (TransferStatus string, TransferLength string, TransferTotal string, err error) { - // Request structure. - request := &struct { - TransferID string - }{} - // BEGIN Marshal arguments into request. - - if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - TransferStatus string - - TransferLength string - - TransferTotal string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetTransferProgress", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if TransferStatus, err = soap.UnmarshalString(response.TransferStatus); err != nil { - return - } - if TransferLength, err = soap.UnmarshalString(response.TransferLength); err != nil { - return - } - if TransferTotal, err = soap.UnmarshalString(response.TransferTotal); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) CreateReference(ContainerID string, ObjectID string) (NewID string, err error) { - // Request structure. - request := &struct { - ContainerID string - - ObjectID string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - NewID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "CreateReference", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if NewID, err = soap.UnmarshalString(response.NewID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) FreeFormQuery(ContainerID string, CDSView uint32, QueryRequest string) (QueryResult string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - ContainerID string - - CDSView string - - QueryRequest string - }{} - // BEGIN Marshal arguments into request. - - if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { - return - } - if request.CDSView, err = soap.MarshalUi4(CDSView); err != nil { - return - } - if request.QueryRequest, err = soap.MarshalString(QueryRequest); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - QueryResult string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "FreeFormQuery", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if QueryResult, err = soap.UnmarshalString(response.QueryResult); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ContentDirectory3) GetFreeFormQueryCapabilities() (FFQCapabilities string, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - FFQCapabilities string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetFreeFormQueryCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if FFQCapabilities, err = soap.UnmarshalString(response.FFQCapabilities); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// RenderingControl1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:RenderingControl:1". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type RenderingControl1 struct { - goupnp.ServiceClient -} - -// NewRenderingControl1Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewRenderingControl1Clients() (clients []*RenderingControl1, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_1); err != nil { - return - } - clients = newRenderingControl1ClientsFromGenericClients(genericClients) - return -} - -// NewRenderingControl1ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewRenderingControl1ClientsByURL(loc *url.URL) ([]*RenderingControl1, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_1) - if err != nil { - return nil, err - } - return newRenderingControl1ClientsFromGenericClients(genericClients), nil -} - -// NewRenderingControl1ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewRenderingControl1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*RenderingControl1, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_RenderingControl_1) - if err != nil { - return nil, err - } - return newRenderingControl1ClientsFromGenericClients(genericClients), nil -} - -func newRenderingControl1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*RenderingControl1 { - clients := make([]*RenderingControl1, len(genericClients)) - for i := range genericClients { - clients[i] = &RenderingControl1{genericClients[i]} - } - return clients -} - -func (client *RenderingControl1) ListPresets(InstanceID uint32) (CurrentPresetNameList string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentPresetNameList string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "ListPresets", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentPresetNameList, err = soap.UnmarshalString(response.CurrentPresetNameList); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * PresetName: allowed values: FactoryDefaults - -func (client *RenderingControl1) SelectPreset(InstanceID uint32, PresetName string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - PresetName string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.PresetName, err = soap.MarshalString(PresetName); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SelectPreset", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentBrightness: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetBrightness(InstanceID uint32) (CurrentBrightness uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentBrightness string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetBrightness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentBrightness, err = soap.UnmarshalUi2(response.CurrentBrightness); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredBrightness: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetBrightness(InstanceID uint32, DesiredBrightness uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredBrightness string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredBrightness, err = soap.MarshalUi2(DesiredBrightness); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetBrightness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentContrast: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetContrast(InstanceID uint32) (CurrentContrast uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentContrast string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetContrast", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentContrast, err = soap.UnmarshalUi2(response.CurrentContrast); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredContrast: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetContrast(InstanceID uint32, DesiredContrast uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredContrast string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredContrast, err = soap.MarshalUi2(DesiredContrast); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetContrast", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentSharpness: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetSharpness(InstanceID uint32) (CurrentSharpness uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentSharpness string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetSharpness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentSharpness, err = soap.UnmarshalUi2(response.CurrentSharpness); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredSharpness: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetSharpness(InstanceID uint32, DesiredSharpness uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredSharpness string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredSharpness, err = soap.MarshalUi2(DesiredSharpness); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetSharpness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *RenderingControl1) GetRedVideoGain(InstanceID uint32) (CurrentRedVideoGain uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentRedVideoGain string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetRedVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentRedVideoGain, err = soap.UnmarshalUi2(response.CurrentRedVideoGain); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *RenderingControl1) SetRedVideoGain(InstanceID uint32, DesiredRedVideoGain uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredRedVideoGain string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredRedVideoGain, err = soap.MarshalUi2(DesiredRedVideoGain); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetRedVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentGreenVideoGain: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetGreenVideoGain(InstanceID uint32) (CurrentGreenVideoGain uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentGreenVideoGain string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetGreenVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentGreenVideoGain, err = soap.UnmarshalUi2(response.CurrentGreenVideoGain); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredGreenVideoGain: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetGreenVideoGain(InstanceID uint32, DesiredGreenVideoGain uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredGreenVideoGain string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredGreenVideoGain, err = soap.MarshalUi2(DesiredGreenVideoGain); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetGreenVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentBlueVideoGain: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetBlueVideoGain(InstanceID uint32) (CurrentBlueVideoGain uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentBlueVideoGain string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetBlueVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentBlueVideoGain, err = soap.UnmarshalUi2(response.CurrentBlueVideoGain); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredBlueVideoGain: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetBlueVideoGain(InstanceID uint32, DesiredBlueVideoGain uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredBlueVideoGain string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredBlueVideoGain, err = soap.MarshalUi2(DesiredBlueVideoGain); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetBlueVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentRedVideoBlackLevel: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetRedVideoBlackLevel(InstanceID uint32) (CurrentRedVideoBlackLevel uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentRedVideoBlackLevel string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetRedVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentRedVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentRedVideoBlackLevel); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredRedVideoBlackLevel: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetRedVideoBlackLevel(InstanceID uint32, DesiredRedVideoBlackLevel uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredRedVideoBlackLevel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredRedVideoBlackLevel, err = soap.MarshalUi2(DesiredRedVideoBlackLevel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetRedVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentGreenVideoBlackLevel: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetGreenVideoBlackLevel(InstanceID uint32) (CurrentGreenVideoBlackLevel uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentGreenVideoBlackLevel string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetGreenVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentGreenVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentGreenVideoBlackLevel); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredGreenVideoBlackLevel: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetGreenVideoBlackLevel(InstanceID uint32, DesiredGreenVideoBlackLevel uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredGreenVideoBlackLevel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredGreenVideoBlackLevel, err = soap.MarshalUi2(DesiredGreenVideoBlackLevel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetGreenVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentBlueVideoBlackLevel: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetBlueVideoBlackLevel(InstanceID uint32) (CurrentBlueVideoBlackLevel uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentBlueVideoBlackLevel string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetBlueVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentBlueVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentBlueVideoBlackLevel); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredBlueVideoBlackLevel: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetBlueVideoBlackLevel(InstanceID uint32, DesiredBlueVideoBlackLevel uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredBlueVideoBlackLevel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredBlueVideoBlackLevel, err = soap.MarshalUi2(DesiredBlueVideoBlackLevel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetBlueVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentColorTemperature: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetColorTemperature(InstanceID uint32) (CurrentColorTemperature uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentColorTemperature string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetColorTemperature", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentColorTemperature, err = soap.UnmarshalUi2(response.CurrentColorTemperature); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredColorTemperature: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetColorTemperature(InstanceID uint32, DesiredColorTemperature uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredColorTemperature string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredColorTemperature, err = soap.MarshalUi2(DesiredColorTemperature); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetColorTemperature", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentHorizontalKeystone: allowed value range: step=1 -func (client *RenderingControl1) GetHorizontalKeystone(InstanceID uint32) (CurrentHorizontalKeystone int16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentHorizontalKeystone string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetHorizontalKeystone", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentHorizontalKeystone, err = soap.UnmarshalI2(response.CurrentHorizontalKeystone); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredHorizontalKeystone: allowed value range: step=1 - -func (client *RenderingControl1) SetHorizontalKeystone(InstanceID uint32, DesiredHorizontalKeystone int16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredHorizontalKeystone string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredHorizontalKeystone, err = soap.MarshalI2(DesiredHorizontalKeystone); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetHorizontalKeystone", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentVerticalKeystone: allowed value range: step=1 -func (client *RenderingControl1) GetVerticalKeystone(InstanceID uint32) (CurrentVerticalKeystone int16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentVerticalKeystone string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetVerticalKeystone", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentVerticalKeystone, err = soap.UnmarshalI2(response.CurrentVerticalKeystone); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredVerticalKeystone: allowed value range: step=1 - -func (client *RenderingControl1) SetVerticalKeystone(InstanceID uint32, DesiredVerticalKeystone int16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredVerticalKeystone string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredVerticalKeystone, err = soap.MarshalI2(DesiredVerticalKeystone); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetVerticalKeystone", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl1) GetMute(InstanceID uint32, Channel string) (CurrentMute bool, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentMute string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetMute", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentMute, err = soap.UnmarshalBoolean(response.CurrentMute); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl1) SetMute(InstanceID uint32, Channel string, DesiredMute bool) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - - DesiredMute string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - if request.DesiredMute, err = soap.MarshalBoolean(DesiredMute); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetMute", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -// -// Return values: -// -// * CurrentVolume: allowed value range: minimum=0, step=1 -func (client *RenderingControl1) GetVolume(InstanceID uint32, Channel string) (CurrentVolume uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentVolume string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetVolume", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentVolume, err = soap.UnmarshalUi2(response.CurrentVolume); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master -// -// * DesiredVolume: allowed value range: minimum=0, step=1 - -func (client *RenderingControl1) SetVolume(InstanceID uint32, Channel string, DesiredVolume uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - - DesiredVolume string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - if request.DesiredVolume, err = soap.MarshalUi2(DesiredVolume); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetVolume", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl1) GetVolumeDB(InstanceID uint32, Channel string) (CurrentVolume int16, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentVolume string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetVolumeDB", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentVolume, err = soap.UnmarshalI2(response.CurrentVolume); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl1) SetVolumeDB(InstanceID uint32, Channel string, DesiredVolume int16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - - DesiredVolume string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - if request.DesiredVolume, err = soap.MarshalI2(DesiredVolume); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetVolumeDB", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl1) GetVolumeDBRange(InstanceID uint32, Channel string) (MinValue int16, MaxValue int16, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - MinValue string - - MaxValue string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetVolumeDBRange", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if MinValue, err = soap.UnmarshalI2(response.MinValue); err != nil { - return - } - if MaxValue, err = soap.UnmarshalI2(response.MaxValue); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl1) GetLoudness(InstanceID uint32, Channel string) (CurrentLoudness bool, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentLoudness string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetLoudness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentLoudness, err = soap.UnmarshalBoolean(response.CurrentLoudness); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl1) SetLoudness(InstanceID uint32, Channel string, DesiredLoudness bool) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - - DesiredLoudness string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - if request.DesiredLoudness, err = soap.MarshalBoolean(DesiredLoudness); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetLoudness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// RenderingControl2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:RenderingControl:2". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type RenderingControl2 struct { - goupnp.ServiceClient -} - -// NewRenderingControl2Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewRenderingControl2Clients() (clients []*RenderingControl2, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_2); err != nil { - return - } - clients = newRenderingControl2ClientsFromGenericClients(genericClients) - return -} - -// NewRenderingControl2ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewRenderingControl2ClientsByURL(loc *url.URL) ([]*RenderingControl2, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_2) - if err != nil { - return nil, err - } - return newRenderingControl2ClientsFromGenericClients(genericClients), nil -} - -// NewRenderingControl2ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewRenderingControl2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*RenderingControl2, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_RenderingControl_2) - if err != nil { - return nil, err - } - return newRenderingControl2ClientsFromGenericClients(genericClients), nil -} - -func newRenderingControl2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*RenderingControl2 { - clients := make([]*RenderingControl2, len(genericClients)) - for i := range genericClients { - clients[i] = &RenderingControl2{genericClients[i]} - } - return clients -} - -func (client *RenderingControl2) ListPresets(InstanceID uint32) (CurrentPresetNameList string, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentPresetNameList string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "ListPresets", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentPresetNameList, err = soap.UnmarshalString(response.CurrentPresetNameList); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * PresetName: allowed values: FactoryDefaults - -func (client *RenderingControl2) SelectPreset(InstanceID uint32, PresetName string) (err error) { - // Request structure. - request := &struct { - InstanceID string - - PresetName string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.PresetName, err = soap.MarshalString(PresetName); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SelectPreset", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentBrightness: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetBrightness(InstanceID uint32) (CurrentBrightness uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentBrightness string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetBrightness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentBrightness, err = soap.UnmarshalUi2(response.CurrentBrightness); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredBrightness: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetBrightness(InstanceID uint32, DesiredBrightness uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredBrightness string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredBrightness, err = soap.MarshalUi2(DesiredBrightness); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetBrightness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentContrast: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetContrast(InstanceID uint32) (CurrentContrast uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentContrast string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetContrast", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentContrast, err = soap.UnmarshalUi2(response.CurrentContrast); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredContrast: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetContrast(InstanceID uint32, DesiredContrast uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredContrast string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredContrast, err = soap.MarshalUi2(DesiredContrast); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetContrast", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentSharpness: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetSharpness(InstanceID uint32) (CurrentSharpness uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentSharpness string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetSharpness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentSharpness, err = soap.UnmarshalUi2(response.CurrentSharpness); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredSharpness: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetSharpness(InstanceID uint32, DesiredSharpness uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredSharpness string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredSharpness, err = soap.MarshalUi2(DesiredSharpness); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetSharpness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentRedVideoGain: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetRedVideoGain(InstanceID uint32) (CurrentRedVideoGain uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentRedVideoGain string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetRedVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentRedVideoGain, err = soap.UnmarshalUi2(response.CurrentRedVideoGain); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredRedVideoGain: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetRedVideoGain(InstanceID uint32, DesiredRedVideoGain uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredRedVideoGain string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredRedVideoGain, err = soap.MarshalUi2(DesiredRedVideoGain); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetRedVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentGreenVideoGain: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetGreenVideoGain(InstanceID uint32) (CurrentGreenVideoGain uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentGreenVideoGain string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetGreenVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentGreenVideoGain, err = soap.UnmarshalUi2(response.CurrentGreenVideoGain); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredGreenVideoGain: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetGreenVideoGain(InstanceID uint32, DesiredGreenVideoGain uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredGreenVideoGain string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredGreenVideoGain, err = soap.MarshalUi2(DesiredGreenVideoGain); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetGreenVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentBlueVideoGain: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetBlueVideoGain(InstanceID uint32) (CurrentBlueVideoGain uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentBlueVideoGain string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetBlueVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentBlueVideoGain, err = soap.UnmarshalUi2(response.CurrentBlueVideoGain); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredBlueVideoGain: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetBlueVideoGain(InstanceID uint32, DesiredBlueVideoGain uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredBlueVideoGain string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredBlueVideoGain, err = soap.MarshalUi2(DesiredBlueVideoGain); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetBlueVideoGain", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentRedVideoBlackLevel: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetRedVideoBlackLevel(InstanceID uint32) (CurrentRedVideoBlackLevel uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentRedVideoBlackLevel string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetRedVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentRedVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentRedVideoBlackLevel); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredRedVideoBlackLevel: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetRedVideoBlackLevel(InstanceID uint32, DesiredRedVideoBlackLevel uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredRedVideoBlackLevel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredRedVideoBlackLevel, err = soap.MarshalUi2(DesiredRedVideoBlackLevel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetRedVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentGreenVideoBlackLevel: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetGreenVideoBlackLevel(InstanceID uint32) (CurrentGreenVideoBlackLevel uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentGreenVideoBlackLevel string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetGreenVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentGreenVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentGreenVideoBlackLevel); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredGreenVideoBlackLevel: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetGreenVideoBlackLevel(InstanceID uint32, DesiredGreenVideoBlackLevel uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredGreenVideoBlackLevel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredGreenVideoBlackLevel, err = soap.MarshalUi2(DesiredGreenVideoBlackLevel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetGreenVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentBlueVideoBlackLevel: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetBlueVideoBlackLevel(InstanceID uint32) (CurrentBlueVideoBlackLevel uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentBlueVideoBlackLevel string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetBlueVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentBlueVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentBlueVideoBlackLevel); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredBlueVideoBlackLevel: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetBlueVideoBlackLevel(InstanceID uint32, DesiredBlueVideoBlackLevel uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredBlueVideoBlackLevel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredBlueVideoBlackLevel, err = soap.MarshalUi2(DesiredBlueVideoBlackLevel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetBlueVideoBlackLevel", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentColorTemperature: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetColorTemperature(InstanceID uint32) (CurrentColorTemperature uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentColorTemperature string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetColorTemperature", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentColorTemperature, err = soap.UnmarshalUi2(response.CurrentColorTemperature); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredColorTemperature: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetColorTemperature(InstanceID uint32, DesiredColorTemperature uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredColorTemperature string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredColorTemperature, err = soap.MarshalUi2(DesiredColorTemperature); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetColorTemperature", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentHorizontalKeystone: allowed value range: step=1 -func (client *RenderingControl2) GetHorizontalKeystone(InstanceID uint32) (CurrentHorizontalKeystone int16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentHorizontalKeystone string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetHorizontalKeystone", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentHorizontalKeystone, err = soap.UnmarshalI2(response.CurrentHorizontalKeystone); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredHorizontalKeystone: allowed value range: step=1 - -func (client *RenderingControl2) SetHorizontalKeystone(InstanceID uint32, DesiredHorizontalKeystone int16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredHorizontalKeystone string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredHorizontalKeystone, err = soap.MarshalI2(DesiredHorizontalKeystone); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetHorizontalKeystone", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Return values: -// -// * CurrentVerticalKeystone: allowed value range: step=1 -func (client *RenderingControl2) GetVerticalKeystone(InstanceID uint32) (CurrentVerticalKeystone int16, err error) { - // Request structure. - request := &struct { - InstanceID string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentVerticalKeystone string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetVerticalKeystone", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentVerticalKeystone, err = soap.UnmarshalI2(response.CurrentVerticalKeystone); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DesiredVerticalKeystone: allowed value range: step=1 - -func (client *RenderingControl2) SetVerticalKeystone(InstanceID uint32, DesiredVerticalKeystone int16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - DesiredVerticalKeystone string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.DesiredVerticalKeystone, err = soap.MarshalI2(DesiredVerticalKeystone); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetVerticalKeystone", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl2) GetMute(InstanceID uint32, Channel string) (CurrentMute bool, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentMute string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetMute", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentMute, err = soap.UnmarshalBoolean(response.CurrentMute); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl2) SetMute(InstanceID uint32, Channel string, DesiredMute bool) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - - DesiredMute string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - if request.DesiredMute, err = soap.MarshalBoolean(DesiredMute); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetMute", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -// -// Return values: -// -// * CurrentVolume: allowed value range: minimum=0, step=1 -func (client *RenderingControl2) GetVolume(InstanceID uint32, Channel string) (CurrentVolume uint16, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentVolume string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetVolume", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentVolume, err = soap.UnmarshalUi2(response.CurrentVolume); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master -// -// * DesiredVolume: allowed value range: minimum=0, step=1 - -func (client *RenderingControl2) SetVolume(InstanceID uint32, Channel string, DesiredVolume uint16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - - DesiredVolume string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - if request.DesiredVolume, err = soap.MarshalUi2(DesiredVolume); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetVolume", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl2) GetVolumeDB(InstanceID uint32, Channel string) (CurrentVolume int16, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentVolume string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetVolumeDB", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentVolume, err = soap.UnmarshalI2(response.CurrentVolume); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl2) SetVolumeDB(InstanceID uint32, Channel string, DesiredVolume int16) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - - DesiredVolume string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - if request.DesiredVolume, err = soap.MarshalI2(DesiredVolume); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetVolumeDB", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl2) GetVolumeDBRange(InstanceID uint32, Channel string) (MinValue int16, MaxValue int16, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - MinValue string - - MaxValue string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetVolumeDBRange", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if MinValue, err = soap.UnmarshalI2(response.MinValue); err != nil { - return - } - if MaxValue, err = soap.UnmarshalI2(response.MaxValue); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl2) GetLoudness(InstanceID uint32, Channel string) (CurrentLoudness bool, err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - CurrentLoudness string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetLoudness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if CurrentLoudness, err = soap.UnmarshalBoolean(response.CurrentLoudness); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * Channel: allowed values: Master - -func (client *RenderingControl2) SetLoudness(InstanceID uint32, Channel string, DesiredLoudness bool) (err error) { - // Request structure. - request := &struct { - InstanceID string - - Channel string - - DesiredLoudness string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.Channel, err = soap.MarshalString(Channel); err != nil { - return - } - if request.DesiredLoudness, err = soap.MarshalBoolean(DesiredLoudness); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetLoudness", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *RenderingControl2) GetStateVariables(InstanceID uint32, StateVariableList string) (StateVariableValuePairs string, err error) { - // Request structure. - request := &struct { - InstanceID string - - StateVariableList string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.StateVariableList, err = soap.MarshalString(StateVariableList); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - StateVariableValuePairs string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetStateVariables", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if StateVariableValuePairs, err = soap.UnmarshalString(response.StateVariableValuePairs); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *RenderingControl2) SetStateVariables(InstanceID uint32, RenderingControlUDN string, ServiceType string, ServiceId string, StateVariableValuePairs string) (StateVariableList string, err error) { - // Request structure. - request := &struct { - InstanceID string - - RenderingControlUDN string - - ServiceType string - - ServiceId string - - StateVariableValuePairs string - }{} - // BEGIN Marshal arguments into request. - - if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { - return - } - if request.RenderingControlUDN, err = soap.MarshalString(RenderingControlUDN); err != nil { - return - } - if request.ServiceType, err = soap.MarshalString(ServiceType); err != nil { - return - } - if request.ServiceId, err = soap.MarshalString(ServiceId); err != nil { - return - } - if request.StateVariableValuePairs, err = soap.MarshalString(StateVariableValuePairs); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - StateVariableList string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetStateVariables", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if StateVariableList, err = soap.UnmarshalString(response.StateVariableList); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// ScheduledRecording1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ScheduledRecording:1". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type ScheduledRecording1 struct { - goupnp.ServiceClient -} - -// NewScheduledRecording1Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewScheduledRecording1Clients() (clients []*ScheduledRecording1, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_1); err != nil { - return - } - clients = newScheduledRecording1ClientsFromGenericClients(genericClients) - return -} - -// NewScheduledRecording1ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewScheduledRecording1ClientsByURL(loc *url.URL) ([]*ScheduledRecording1, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_1) - if err != nil { - return nil, err - } - return newScheduledRecording1ClientsFromGenericClients(genericClients), nil -} - -// NewScheduledRecording1ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewScheduledRecording1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ScheduledRecording1, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ScheduledRecording_1) - if err != nil { - return nil, err - } - return newScheduledRecording1ClientsFromGenericClients(genericClients), nil -} - -func newScheduledRecording1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ScheduledRecording1 { - clients := make([]*ScheduledRecording1, len(genericClients)) - for i := range genericClients { - clients[i] = &ScheduledRecording1{genericClients[i]} - } - return clients -} - -func (client *ScheduledRecording1) GetSortCapabilities() (SortCaps string, SortLevelCap uint32, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SortCaps string - - SortLevelCap string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetSortCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { - return - } - if SortLevelCap, err = soap.UnmarshalUi4(response.SortLevelCap); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DataTypeID: allowed values: A_ARG_TYPE_RecordSchedule, A_ARG_TYPE_RecordTask, A_ARG_TYPE_RecordScheduleParts - -func (client *ScheduledRecording1) GetPropertyList(DataTypeID string) (PropertyList string, err error) { - // Request structure. - request := &struct { - DataTypeID string - }{} - // BEGIN Marshal arguments into request. - - if request.DataTypeID, err = soap.MarshalString(DataTypeID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - PropertyList string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetPropertyList", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if PropertyList, err = soap.UnmarshalString(response.PropertyList); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DataTypeID: allowed values: A_ARG_TYPE_RecordSchedule, A_ARG_TYPE_RecordTask, A_ARG_TYPE_RecordScheduleParts - -func (client *ScheduledRecording1) GetAllowedValues(DataTypeID string, Filter string) (PropertyInfo string, err error) { - // Request structure. - request := &struct { - DataTypeID string - - Filter string - }{} - // BEGIN Marshal arguments into request. - - if request.DataTypeID, err = soap.MarshalString(DataTypeID); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - PropertyInfo string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetAllowedValues", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if PropertyInfo, err = soap.UnmarshalString(response.PropertyInfo); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) GetStateUpdateID() (Id uint32, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Id string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetStateUpdateID", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Id, err = soap.UnmarshalUi4(response.Id); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) BrowseRecordSchedules(Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "BrowseRecordSchedules", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) BrowseRecordTasks(RecordScheduleID string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordScheduleID string - - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "BrowseRecordTasks", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) CreateRecordSchedule(Elements string) (RecordScheduleID string, Result string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - Elements string - }{} - // BEGIN Marshal arguments into request. - - if request.Elements, err = soap.MarshalString(Elements); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - RecordScheduleID string - - Result string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "CreateRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if RecordScheduleID, err = soap.UnmarshalString(response.RecordScheduleID); err != nil { - return - } - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) DeleteRecordSchedule(RecordScheduleID string) (err error) { - // Request structure. - request := &struct { - RecordScheduleID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "DeleteRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) GetRecordSchedule(RecordScheduleID string, Filter string) (Result string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordScheduleID string - - Filter string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) EnableRecordSchedule(RecordScheduleID string) (err error) { - // Request structure. - request := &struct { - RecordScheduleID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "EnableRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) DisableRecordSchedule(RecordScheduleID string) (err error) { - // Request structure. - request := &struct { - RecordScheduleID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "DisableRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) DeleteRecordTask(RecordTaskID string) (err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "DeleteRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) GetRecordTask(RecordTaskID string, Filter string) (Result string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordTaskID string - - Filter string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) EnableRecordTask(RecordTaskID string) (err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "EnableRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) DisableRecordTask(RecordTaskID string) (err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "DisableRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) ResetRecordTask(RecordTaskID string) (err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "ResetRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) GetRecordScheduleConflicts(RecordScheduleID string) (RecordScheduleConflictIDList string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordScheduleID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - RecordScheduleConflictIDList string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetRecordScheduleConflicts", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if RecordScheduleConflictIDList, err = soap.UnmarshalString(response.RecordScheduleConflictIDList); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording1) GetRecordTaskConflicts(RecordTaskID string) (RecordTaskConflictIDList string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - RecordTaskConflictIDList string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetRecordTaskConflicts", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if RecordTaskConflictIDList, err = soap.UnmarshalString(response.RecordTaskConflictIDList); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// ScheduledRecording2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ScheduledRecording:2". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type ScheduledRecording2 struct { - goupnp.ServiceClient -} - -// NewScheduledRecording2Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func NewScheduledRecording2Clients() (clients []*ScheduledRecording2, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_2); err != nil { - return - } - clients = newScheduledRecording2ClientsFromGenericClients(genericClients) - return -} - -// NewScheduledRecording2ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func NewScheduledRecording2ClientsByURL(loc *url.URL) ([]*ScheduledRecording2, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_2) - if err != nil { - return nil, err - } - return newScheduledRecording2ClientsFromGenericClients(genericClients), nil -} - -// NewScheduledRecording2ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func NewScheduledRecording2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ScheduledRecording2, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ScheduledRecording_2) - if err != nil { - return nil, err - } - return newScheduledRecording2ClientsFromGenericClients(genericClients), nil -} - -func newScheduledRecording2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ScheduledRecording2 { - clients := make([]*ScheduledRecording2, len(genericClients)) - for i := range genericClients { - clients[i] = &ScheduledRecording2{genericClients[i]} - } - return clients -} - -func (client *ScheduledRecording2) GetSortCapabilities() (SortCaps string, SortLevelCap uint32, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - SortCaps string - - SortLevelCap string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetSortCapabilities", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { - return - } - if SortLevelCap, err = soap.UnmarshalUi4(response.SortLevelCap); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DataTypeID: allowed values: A_ARG_TYPE_RecordSchedule, A_ARG_TYPE_RecordTask, A_ARG_TYPE_RecordScheduleParts - -func (client *ScheduledRecording2) GetPropertyList(DataTypeID string) (PropertyList string, err error) { - // Request structure. - request := &struct { - DataTypeID string - }{} - // BEGIN Marshal arguments into request. - - if request.DataTypeID, err = soap.MarshalString(DataTypeID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - PropertyList string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetPropertyList", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if PropertyList, err = soap.UnmarshalString(response.PropertyList); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -// -// Arguments: -// -// * DataTypeID: allowed values: A_ARG_TYPE_RecordSchedule, A_ARG_TYPE_RecordTask, A_ARG_TYPE_RecordScheduleParts - -func (client *ScheduledRecording2) GetAllowedValues(DataTypeID string, Filter string) (PropertyInfo string, err error) { - // Request structure. - request := &struct { - DataTypeID string - - Filter string - }{} - // BEGIN Marshal arguments into request. - - if request.DataTypeID, err = soap.MarshalString(DataTypeID); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - PropertyInfo string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetAllowedValues", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if PropertyInfo, err = soap.UnmarshalString(response.PropertyInfo); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) GetStateUpdateID() (Id uint32, err error) { - // Request structure. - request := interface{}(nil) - // BEGIN Marshal arguments into request. - - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Id string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetStateUpdateID", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Id, err = soap.UnmarshalUi4(response.Id); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) BrowseRecordSchedules(Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "BrowseRecordSchedules", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) BrowseRecordTasks(RecordScheduleID string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordScheduleID string - - Filter string - - StartingIndex string - - RequestedCount string - - SortCriteria string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { - return - } - if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { - return - } - if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - NumberReturned string - - TotalMatches string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "BrowseRecordTasks", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { - return - } - if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) CreateRecordSchedule(Elements string) (RecordScheduleID string, Result string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - Elements string - }{} - // BEGIN Marshal arguments into request. - - if request.Elements, err = soap.MarshalString(Elements); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - RecordScheduleID string - - Result string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "CreateRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if RecordScheduleID, err = soap.UnmarshalString(response.RecordScheduleID); err != nil { - return - } - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) DeleteRecordSchedule(RecordScheduleID string) (err error) { - // Request structure. - request := &struct { - RecordScheduleID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "DeleteRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) GetRecordSchedule(RecordScheduleID string, Filter string) (Result string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordScheduleID string - - Filter string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) EnableRecordSchedule(RecordScheduleID string) (err error) { - // Request structure. - request := &struct { - RecordScheduleID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "EnableRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) DisableRecordSchedule(RecordScheduleID string) (err error) { - // Request structure. - request := &struct { - RecordScheduleID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "DisableRecordSchedule", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) DeleteRecordTask(RecordTaskID string) (err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "DeleteRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) GetRecordTask(RecordTaskID string, Filter string) (Result string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordTaskID string - - Filter string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - if request.Filter, err = soap.MarshalString(Filter); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - Result string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if Result, err = soap.UnmarshalString(response.Result); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) EnableRecordTask(RecordTaskID string) (err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "EnableRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) DisableRecordTask(RecordTaskID string) (err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "DisableRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) ResetRecordTask(RecordTaskID string) (err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := interface{}(nil) - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "ResetRecordTask", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) GetRecordScheduleConflicts(RecordScheduleID string) (RecordScheduleConflictIDList string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordScheduleID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - RecordScheduleConflictIDList string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetRecordScheduleConflicts", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if RecordScheduleConflictIDList, err = soap.UnmarshalString(response.RecordScheduleConflictIDList); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} - -func (client *ScheduledRecording2) GetRecordTaskConflicts(RecordTaskID string) (RecordTaskConflictIDList string, UpdateID uint32, err error) { - // Request structure. - request := &struct { - RecordTaskID string - }{} - // BEGIN Marshal arguments into request. - - if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { - return - } - // END Marshal arguments into request. - - // Response structure. - response := &struct { - RecordTaskConflictIDList string - - UpdateID string - }{} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetRecordTaskConflicts", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. - - if RecordTaskConflictIDList, err = soap.UnmarshalString(response.RecordTaskConflictIDList); err != nil { - return - } - if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { - return - } - // END Unmarshal arguments from response. - return -} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/example/example.go b/Godeps/_workspace/src/github.com/huin/goupnp/example/example.go deleted file mode 100644 index df74202268..0000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/example/example.go +++ /dev/null @@ -1,6 +0,0 @@ -// Serves as examples of using the goupnp library. -// -// To run examples and see the output for your local network, run the following -// command (specifically including the -v flag): -// go test -v github.com/huin/goupnp/example -package example diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/gotasks/specgen_task.go b/Godeps/_workspace/src/github.com/huin/goupnp/gotasks/specgen_task.go deleted file mode 100644 index 921e8c8570..0000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/gotasks/specgen_task.go +++ /dev/null @@ -1,603 +0,0 @@ -// +build gotask - -package gotasks - -import ( - "archive/zip" - "encoding/xml" - "fmt" - "io" - "log" - "net/http" - "os" - "path" - "path/filepath" - "regexp" - "strings" - "text/template" - - "github.com/huin/goupnp" - "github.com/huin/goupnp/scpd" - "github.com/huin/goutil/codegen" - "github.com/jingweno/gotask/tasking" -) - -var ( - deviceURNPrefix = "urn:schemas-upnp-org:device:" - serviceURNPrefix = "urn:schemas-upnp-org:service:" -) - -// DCP contains extra metadata to use when generating DCP source files. -type DCPMetadata struct { - Name string // What to name the Go DCP package. - OfficialName string // Official name for the DCP. - DocURL string // Optional - URL for futher documentation about the DCP. - XMLSpecURL string // Where to download the XML spec from. - // Any special-case functions to run against the DCP before writing it out. - Hacks []DCPHackFn -} - -var dcpMetadata = []DCPMetadata{ - { - Name: "internetgateway1", - OfficialName: "Internet Gateway Device v1", - DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf", - XMLSpecURL: "http://upnp.org/specs/gw/UPnP-gw-IGD-TestFiles-20010921.zip", - }, - { - Name: "internetgateway2", - OfficialName: "Internet Gateway Device v2", - DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v2-Device.pdf", - XMLSpecURL: "http://upnp.org/specs/gw/UPnP-gw-IGD-Testfiles-20110224.zip", - Hacks: []DCPHackFn{ - func(dcp *DCP) error { - missingURN := "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1" - if _, ok := dcp.ServiceTypes[missingURN]; ok { - return nil - } - urnParts, err := extractURNParts(missingURN, serviceURNPrefix) - if err != nil { - return err - } - dcp.ServiceTypes[missingURN] = urnParts - return nil - }, - }, - }, - { - Name: "av1", - OfficialName: "MediaServer v1 and MediaRenderer v1", - DocURL: "http://upnp.org/specs/av/av1/", - XMLSpecURL: "http://upnp.org/specs/av/UPnP-av-TestFiles-20070927.zip", - }, -} - -type DCPHackFn func(*DCP) error - -// NAME -// specgen - generates Go code from the UPnP specification files. -// -// DESCRIPTION -// The specification is available for download from: -// -// OPTIONS -// -s, --specs_dir= -// Path to the specification storage directory. This is used to find (and download if not present) the specification ZIP files. Defaults to 'specs' -// -o, --out_dir= -// Path to the output directory. This is is where the DCP source files will be placed. Should normally correspond to the directory for github.com/huin/goupnp/dcps. Defaults to '../dcps' -// --nogofmt -// Disable passing the output through gofmt. Do this if debugging code output problems and needing to see the generated code prior to being passed through gofmt. -func TaskSpecgen(t *tasking.T) { - specsDir := fallbackStrValue("specs", t.Flags.String("specs_dir"), t.Flags.String("s")) - if err := os.MkdirAll(specsDir, os.ModePerm); err != nil { - t.Fatalf("Could not create specs-dir %q: %v\n", specsDir, err) - } - outDir := fallbackStrValue("../dcps", t.Flags.String("out_dir"), t.Flags.String("o")) - useGofmt := !t.Flags.Bool("nogofmt") - -NEXT_DCP: - for _, d := range dcpMetadata { - specFilename := filepath.Join(specsDir, d.Name+".zip") - err := acquireFile(specFilename, d.XMLSpecURL) - if err != nil { - t.Logf("Could not acquire spec for %s, skipping: %v\n", d.Name, err) - continue NEXT_DCP - } - dcp := newDCP(d) - if err := dcp.processZipFile(specFilename); err != nil { - log.Printf("Error processing spec for %s in file %q: %v", d.Name, specFilename, err) - continue NEXT_DCP - } - for i, hack := range d.Hacks { - if err := hack(dcp); err != nil { - log.Printf("Error with Hack[%d] for %s: %v", i, d.Name, err) - continue NEXT_DCP - } - } - dcp.writePackage(outDir, useGofmt) - if err := dcp.writePackage(outDir, useGofmt); err != nil { - log.Printf("Error writing package %q: %v", dcp.Metadata.Name, err) - continue NEXT_DCP - } - } -} - -func fallbackStrValue(defaultValue string, values ...string) string { - for _, v := range values { - if v != "" { - return v - } - } - return defaultValue -} - -func acquireFile(specFilename string, xmlSpecURL string) error { - if f, err := os.Open(specFilename); err != nil { - if !os.IsNotExist(err) { - return err - } - } else { - f.Close() - return nil - } - - resp, err := http.Get(xmlSpecURL) - if err != nil { - return err - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("could not download spec %q from %q: ", - specFilename, xmlSpecURL, resp.Status) - } - - tmpFilename := specFilename + ".download" - w, err := os.Create(tmpFilename) - if err != nil { - return err - } - defer w.Close() - - _, err = io.Copy(w, resp.Body) - if err != nil { - return err - } - - return os.Rename(tmpFilename, specFilename) -} - -// DCP collects together information about a UPnP Device Control Protocol. -type DCP struct { - Metadata DCPMetadata - DeviceTypes map[string]*URNParts - ServiceTypes map[string]*URNParts - Services []SCPDWithURN -} - -func newDCP(metadata DCPMetadata) *DCP { - return &DCP{ - Metadata: metadata, - DeviceTypes: make(map[string]*URNParts), - ServiceTypes: make(map[string]*URNParts), - } -} - -func (dcp *DCP) processZipFile(filename string) error { - archive, err := zip.OpenReader(filename) - if err != nil { - return fmt.Errorf("error reading zip file %q: %v", filename, err) - } - defer archive.Close() - for _, deviceFile := range globFiles("*/device/*.xml", archive) { - if err := dcp.processDeviceFile(deviceFile); err != nil { - return err - } - } - for _, scpdFile := range globFiles("*/service/*.xml", archive) { - if err := dcp.processSCPDFile(scpdFile); err != nil { - return err - } - } - return nil -} - -func (dcp *DCP) processDeviceFile(file *zip.File) error { - var device goupnp.Device - if err := unmarshalXmlFile(file, &device); err != nil { - return fmt.Errorf("error decoding device XML from file %q: %v", file.Name, err) - } - var mainErr error - device.VisitDevices(func(d *goupnp.Device) { - t := strings.TrimSpace(d.DeviceType) - if t != "" { - u, err := extractURNParts(t, deviceURNPrefix) - if err != nil { - mainErr = err - } - dcp.DeviceTypes[t] = u - } - }) - device.VisitServices(func(s *goupnp.Service) { - u, err := extractURNParts(s.ServiceType, serviceURNPrefix) - if err != nil { - mainErr = err - } - dcp.ServiceTypes[s.ServiceType] = u - }) - return mainErr -} - -func (dcp *DCP) writePackage(outDir string, useGofmt bool) error { - packageDirname := filepath.Join(outDir, dcp.Metadata.Name) - err := os.MkdirAll(packageDirname, os.ModePerm) - if err != nil && !os.IsExist(err) { - return err - } - packageFilename := filepath.Join(packageDirname, dcp.Metadata.Name+".go") - packageFile, err := os.Create(packageFilename) - if err != nil { - return err - } - var output io.WriteCloser = packageFile - if useGofmt { - if output, err = codegen.NewGofmtWriteCloser(output); err != nil { - packageFile.Close() - return err - } - } - if err = packageTmpl.Execute(output, dcp); err != nil { - output.Close() - return err - } - return output.Close() -} - -func (dcp *DCP) processSCPDFile(file *zip.File) error { - scpd := new(scpd.SCPD) - if err := unmarshalXmlFile(file, scpd); err != nil { - return fmt.Errorf("error decoding SCPD XML from file %q: %v", file.Name, err) - } - scpd.Clean() - urnParts, err := urnPartsFromSCPDFilename(file.Name) - if err != nil { - return fmt.Errorf("could not recognize SCPD filename %q: %v", file.Name, err) - } - dcp.Services = append(dcp.Services, SCPDWithURN{ - URNParts: urnParts, - SCPD: scpd, - }) - return nil -} - -type SCPDWithURN struct { - *URNParts - SCPD *scpd.SCPD -} - -func (s *SCPDWithURN) WrapArguments(args []*scpd.Argument) (argumentWrapperList, error) { - wrappedArgs := make(argumentWrapperList, len(args)) - for i, arg := range args { - wa, err := s.wrapArgument(arg) - if err != nil { - return nil, err - } - wrappedArgs[i] = wa - } - return wrappedArgs, nil -} - -func (s *SCPDWithURN) wrapArgument(arg *scpd.Argument) (*argumentWrapper, error) { - relVar := s.SCPD.GetStateVariable(arg.RelatedStateVariable) - if relVar == nil { - return nil, fmt.Errorf("no such state variable: %q, for argument %q", arg.RelatedStateVariable, arg.Name) - } - cnv, ok := typeConvs[relVar.DataType.Name] - if !ok { - return nil, fmt.Errorf("unknown data type: %q, for state variable %q, for argument %q", relVar.DataType.Type, arg.RelatedStateVariable, arg.Name) - } - return &argumentWrapper{ - Argument: *arg, - relVar: relVar, - conv: cnv, - }, nil -} - -type argumentWrapper struct { - scpd.Argument - relVar *scpd.StateVariable - conv conv -} - -func (arg *argumentWrapper) AsParameter() string { - return fmt.Sprintf("%s %s", arg.Name, arg.conv.ExtType) -} - -func (arg *argumentWrapper) HasDoc() bool { - rng := arg.relVar.AllowedValueRange - return ((rng != nil && (rng.Minimum != "" || rng.Maximum != "" || rng.Step != "")) || - len(arg.relVar.AllowedValues) > 0) -} - -func (arg *argumentWrapper) Document() string { - relVar := arg.relVar - if rng := relVar.AllowedValueRange; rng != nil { - var parts []string - if rng.Minimum != "" { - parts = append(parts, fmt.Sprintf("minimum=%s", rng.Minimum)) - } - if rng.Maximum != "" { - parts = append(parts, fmt.Sprintf("maximum=%s", rng.Maximum)) - } - if rng.Step != "" { - parts = append(parts, fmt.Sprintf("step=%s", rng.Step)) - } - return "allowed value range: " + strings.Join(parts, ", ") - } - if len(relVar.AllowedValues) != 0 { - return "allowed values: " + strings.Join(relVar.AllowedValues, ", ") - } - return "" -} - -func (arg *argumentWrapper) Marshal() string { - return fmt.Sprintf("soap.Marshal%s(%s)", arg.conv.FuncSuffix, arg.Name) -} - -func (arg *argumentWrapper) Unmarshal(objVar string) string { - return fmt.Sprintf("soap.Unmarshal%s(%s.%s)", arg.conv.FuncSuffix, objVar, arg.Name) -} - -type argumentWrapperList []*argumentWrapper - -func (args argumentWrapperList) HasDoc() bool { - for _, arg := range args { - if arg.HasDoc() { - return true - } - } - return false -} - -type conv struct { - FuncSuffix string - ExtType string -} - -// typeConvs maps from a SOAP type (e.g "fixed.14.4") to the function name -// suffix inside the soap module (e.g "Fixed14_4") and the Go type. -var typeConvs = map[string]conv{ - "ui1": conv{"Ui1", "uint8"}, - "ui2": conv{"Ui2", "uint16"}, - "ui4": conv{"Ui4", "uint32"}, - "i1": conv{"I1", "int8"}, - "i2": conv{"I2", "int16"}, - "i4": conv{"I4", "int32"}, - "int": conv{"Int", "int64"}, - "r4": conv{"R4", "float32"}, - "r8": conv{"R8", "float64"}, - "number": conv{"R8", "float64"}, // Alias for r8. - "fixed.14.4": conv{"Fixed14_4", "float64"}, - "float": conv{"R8", "float64"}, - "char": conv{"Char", "rune"}, - "string": conv{"String", "string"}, - "date": conv{"Date", "time.Time"}, - "dateTime": conv{"DateTime", "time.Time"}, - "dateTime.tz": conv{"DateTimeTz", "time.Time"}, - "time": conv{"TimeOfDay", "soap.TimeOfDay"}, - "time.tz": conv{"TimeOfDayTz", "soap.TimeOfDay"}, - "boolean": conv{"Boolean", "bool"}, - "bin.base64": conv{"BinBase64", "[]byte"}, - "bin.hex": conv{"BinHex", "[]byte"}, - "uri": conv{"URI", "*url.URL"}, -} - -func globFiles(pattern string, archive *zip.ReadCloser) []*zip.File { - var files []*zip.File - for _, f := range archive.File { - if matched, err := path.Match(pattern, f.Name); err != nil { - // This shouldn't happen - all patterns are hard-coded, errors in them - // are a programming error. - panic(err) - } else if matched { - files = append(files, f) - } - } - return files -} - -func unmarshalXmlFile(file *zip.File, data interface{}) error { - r, err := file.Open() - if err != nil { - return err - } - decoder := xml.NewDecoder(r) - r.Close() - return decoder.Decode(data) -} - -type URNParts struct { - URN string - Name string - Version string -} - -func (u *URNParts) Const() string { - return fmt.Sprintf("URN_%s_%s", u.Name, u.Version) -} - -// extractURNParts extracts the name and version from a URN string. -func extractURNParts(urn, expectedPrefix string) (*URNParts, error) { - if !strings.HasPrefix(urn, expectedPrefix) { - return nil, fmt.Errorf("%q does not have expected prefix %q", urn, expectedPrefix) - } - parts := strings.SplitN(strings.TrimPrefix(urn, expectedPrefix), ":", 2) - if len(parts) != 2 { - return nil, fmt.Errorf("%q does not have a name and version", urn) - } - name, version := parts[0], parts[1] - return &URNParts{urn, name, version}, nil -} - -var scpdFilenameRe = regexp.MustCompile( - `.*/([a-zA-Z0-9]+)([0-9]+)\.xml`) - -func urnPartsFromSCPDFilename(filename string) (*URNParts, error) { - parts := scpdFilenameRe.FindStringSubmatch(filename) - if len(parts) != 3 { - return nil, fmt.Errorf("SCPD filename %q does not have expected number of parts", filename) - } - name, version := parts[1], parts[2] - return &URNParts{ - URN: serviceURNPrefix + name + ":" + version, - Name: name, - Version: version, - }, nil -} - -var packageTmpl = template.Must(template.New("package").Parse(`{{$name := .Metadata.Name}} -// Client for UPnP Device Control Protocol {{.Metadata.OfficialName}}. -// {{if .Metadata.DocURL}} -// This DCP is documented in detail at: {{.Metadata.DocURL}}{{end}} -// -// Typically, use one of the New* functions to create clients for services. -package {{$name}} - -// Generated file - do not edit by hand. See README.md - - -import ( - "net/url" - "time" - - "github.com/huin/goupnp" - "github.com/huin/goupnp/soap" -) - -// Hack to avoid Go complaining if time isn't used. -var _ time.Time - -// Device URNs: -const ({{range .DeviceTypes}} - {{.Const}} = "{{.URN}}"{{end}} -) - -// Service URNs: -const ({{range .ServiceTypes}} - {{.Const}} = "{{.URN}}"{{end}} -) - -{{range .Services}} -{{$srv := .}} -{{$srvIdent := printf "%s%s" .Name .Version}} - -// {{$srvIdent}} is a client for UPnP SOAP service with URN "{{.URN}}". See -// goupnp.ServiceClient, which contains RootDevice and Service attributes which -// are provided for informational value. -type {{$srvIdent}} struct { - goupnp.ServiceClient -} - -// New{{$srvIdent}}Clients discovers instances of the service on the network, -// and returns clients to any that are found. errors will contain an error for -// any devices that replied but which could not be queried, and err will be set -// if the discovery process failed outright. -// -// This is a typical entry calling point into this package. -func New{{$srvIdent}}Clients() (clients []*{{$srvIdent}}, errors []error, err error) { - var genericClients []goupnp.ServiceClient - if genericClients, errors, err = goupnp.NewServiceClients({{$srv.Const}}); err != nil { - return - } - clients = new{{$srvIdent}}ClientsFromGenericClients(genericClients) - return -} - -// New{{$srvIdent}}ClientsByURL discovers instances of the service at the given -// URL, and returns clients to any that are found. An error is returned if -// there was an error probing the service. -// -// This is a typical entry calling point into this package when reusing an -// previously discovered service URL. -func New{{$srvIdent}}ClientsByURL(loc *url.URL) ([]*{{$srvIdent}}, error) { - genericClients, err := goupnp.NewServiceClientsByURL(loc, {{$srv.Const}}) - if err != nil { - return nil, err - } - return new{{$srvIdent}}ClientsFromGenericClients(genericClients), nil -} - -// New{{$srvIdent}}ClientsFromRootDevice discovers instances of the service in -// a given root device, and returns clients to any that are found. An error is -// returned if there was not at least one instance of the service within the -// device. The location parameter is simply assigned to the Location attribute -// of the wrapped ServiceClient(s). -// -// This is a typical entry calling point into this package when reusing an -// previously discovered root device. -func New{{$srvIdent}}ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*{{$srvIdent}}, error) { - genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, {{$srv.Const}}) - if err != nil { - return nil, err - } - return new{{$srvIdent}}ClientsFromGenericClients(genericClients), nil -} - -func new{{$srvIdent}}ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*{{$srvIdent}} { - clients := make([]*{{$srvIdent}}, len(genericClients)) - for i := range genericClients { - clients[i] = &{{$srvIdent}}{genericClients[i]} - } - return clients -} - -{{range .SCPD.Actions}}{{/* loops over *SCPDWithURN values */}} - -{{$winargs := $srv.WrapArguments .InputArguments}} -{{$woutargs := $srv.WrapArguments .OutputArguments}} -{{if $winargs.HasDoc}} -// -// Arguments:{{range $winargs}}{{if .HasDoc}} -// -// * {{.Name}}: {{.Document}}{{end}}{{end}}{{end}} -{{if $woutargs.HasDoc}} -// -// Return values:{{range $woutargs}}{{if .HasDoc}} -// -// * {{.Name}}: {{.Document}}{{end}}{{end}}{{end}} -func (client *{{$srvIdent}}) {{.Name}}({{range $winargs}}{{/* -*/}}{{.AsParameter}}, {{end}}{{/* -*/}}) ({{range $woutargs}}{{/* -*/}}{{.AsParameter}}, {{end}} err error) { - // Request structure. - request := {{if $winargs}}&{{template "argstruct" $winargs}}{{"{}"}}{{else}}{{"interface{}(nil)"}}{{end}} - // BEGIN Marshal arguments into request. -{{range $winargs}} - if request.{{.Name}}, err = {{.Marshal}}; err != nil { - return - }{{end}} - // END Marshal arguments into request. - - // Response structure. - response := {{if $woutargs}}&{{template "argstruct" $woutargs}}{{"{}"}}{{else}}{{"interface{}(nil)"}}{{end}} - - // Perform the SOAP call. - if err = client.SOAPClient.PerformAction({{$srv.URNParts.Const}}, "{{.Name}}", request, response); err != nil { - return - } - - // BEGIN Unmarshal arguments from response. -{{range $woutargs}} - if {{.Name}}, err = {{.Unmarshal "response"}}; err != nil { - return - }{{end}} - // END Unmarshal arguments from response. - return -} -{{end}}{{/* range .SCPD.Actions */}} -{{end}}{{/* range .Services */}} - -{{define "argstruct"}}struct {{"{"}}{{range .}} -{{.Name}} string -{{end}}{{"}"}}{{end}} -`)) diff --git a/Godeps/_workspace/src/github.com/jackpal/gateway/LICENSE b/Godeps/_workspace/src/github.com/jackpal/gateway/LICENSE deleted file mode 100644 index c9efac32e0..0000000000 --- a/Godeps/_workspace/src/github.com/jackpal/gateway/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2010 Jack Palevich. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Godeps/_workspace/src/github.com/jackpal/gateway/README.md b/Godeps/_workspace/src/github.com/jackpal/gateway/README.md deleted file mode 100644 index 49cc0b85c5..0000000000 --- a/Godeps/_workspace/src/github.com/jackpal/gateway/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# gateway - -A very simple library for discovering the IP address of the local LAN gateway. - -Provides implementations for Linux, OS X (Darwin) and Windows. - -Pull requests for other OSs happily considered! diff --git a/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_darwin.go b/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_darwin.go deleted file mode 100644 index fc6ef68d95..0000000000 --- a/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_darwin.go +++ /dev/null @@ -1,40 +0,0 @@ -package gateway - -import ( - "bytes" - "io/ioutil" - "net" - "os/exec" -) - -func DiscoverGateway() (ip net.IP, err error) { - routeCmd := exec.Command("route", "-n", "get", "0.0.0.0") - stdOut, err := routeCmd.StdoutPipe() - if err != nil { - return - } - if err = routeCmd.Start(); err != nil { - return - } - output, err := ioutil.ReadAll(stdOut) - if err != nil { - return - } - - // Darwin route out format is always like this: - // route to: default - // destination: default - // mask: default - // gateway: 192.168.1.1 - outputLines := bytes.Split(output, []byte("\n")) - for _, line := range outputLines { - if bytes.Contains(line, []byte("gateway:")) { - gatewayFields := bytes.Fields(line) - ip = net.ParseIP(string(gatewayFields[1])) - break - } - } - - err = routeCmd.Wait() - return -} diff --git a/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_linux.go b/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_linux.go deleted file mode 100644 index 333bde1dcb..0000000000 --- a/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_linux.go +++ /dev/null @@ -1,75 +0,0 @@ -package gateway - -import ( - "bytes" - "io/ioutil" - "net" - "os/exec" -) - -func discoverGatewayUsingIp() (ip net.IP, err error) { - routeCmd := exec.Command("ip", "route", "show") - stdOut, err := routeCmd.StdoutPipe() - if err != nil { - return - } - if err = routeCmd.Start(); err != nil { - return - } - output, err := ioutil.ReadAll(stdOut) - if err != nil { - return - } - - // Linux 'ip route show' format looks like this: - // default via 192.168.178.1 dev wlp3s0 metric 303 - // 192.168.178.0/24 dev wlp3s0 proto kernel scope link src 192.168.178.76 metric 303 - outputLines := bytes.Split(output, []byte("\n")) - for _, line := range outputLines { - if bytes.Contains(line, []byte("default")) { - ipFields := bytes.Fields(line) - ip = net.ParseIP(string(ipFields[2])) - break - } - } - err = routeCmd.Wait() - return -} - -func discoverGatewayUsingRoute() (ip net.IP, err error) { - routeCmd := exec.Command("route", "-n") - stdOut, err := routeCmd.StdoutPipe() - if err != nil { - return - } - if err = routeCmd.Start(); err != nil { - return - } - output, err := ioutil.ReadAll(stdOut) - if err != nil { - return - } - - // Linux route out format is always like this: - // Kernel IP routing table - // Destination Gateway Genmask Flags Metric Ref Use Iface - // 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 - outputLines := bytes.Split(output, []byte("\n")) - for _, line := range outputLines { - if bytes.Contains(line, []byte("0.0.0.0")) { - ipFields := bytes.Fields(line) - ip = net.ParseIP(string(ipFields[1])) - break - } - } - err = routeCmd.Wait() - return -} - -func DiscoverGateway() (ip net.IP, err error) { - ip, err = discoverGatewayUsingRoute() - if err != nil { - ip, err = discoverGatewayUsingIp() - } - return -} diff --git a/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_unimplemented.go b/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_unimplemented.go deleted file mode 100644 index 35042b910d..0000000000 --- a/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_unimplemented.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build !darwin,!linux,!windows - -package gateway - -import ( - "fmt" - "net" - "runtime" -) - -func DiscoverGateway() (ip net.IP, err error) { - err = fmt.Errorf("DiscoverGateway not implemented for OS %s", runtime.GOOS) - return -} diff --git a/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_windows.go b/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_windows.go deleted file mode 100644 index 282c8f6852..0000000000 --- a/Godeps/_workspace/src/github.com/jackpal/gateway/gateway_windows.go +++ /dev/null @@ -1,43 +0,0 @@ -package gateway - -import ( - "bytes" - "io/ioutil" - "net" - "os/exec" -) - -func DiscoverGateway() (ip net.IP, err error) { - routeCmd := exec.Command("route", "print", "0.0.0.0") - stdOut, err := routeCmd.StdoutPipe() - if err != nil { - return - } - if err = routeCmd.Start(); err != nil { - return - } - output, err := ioutil.ReadAll(stdOut) - if err != nil { - return - } - - // Windows route output format is always like this: - // =========================================================================== - // Active Routes: - // Network Destination Netmask Gateway Interface Metric - // 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.100 20 - // =========================================================================== - // I'm trying to pick the active route, - // then jump 2 lines and pick the third IP - // Not using regex because output is quite standard from Windows XP to 8 (NEEDS TESTING) - outputLines := bytes.Split(output, []byte("\n")) - for idx, line := range outputLines { - if bytes.Contains(line, []byte("Active Routes:")) { - ipFields := bytes.Fields(outputLines[idx+2]) - ip = net.ParseIP(string(ipFields[2])) - break - } - } - err = routeCmd.Wait() - return -} diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/metrics-bench/metrics-bench.go b/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/metrics-bench/metrics-bench.go deleted file mode 100644 index dddaf4b126..0000000000 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/metrics-bench/metrics-bench.go +++ /dev/null @@ -1,20 +0,0 @@ -package main - -import ( - "fmt" - "github.com/rcrowley/go-metrics" - "time" -) - -func main() { - r := metrics.NewRegistry() - for i := 0; i < 10000; i++ { - r.Register(fmt.Sprintf("counter-%d", i), metrics.NewCounter()) - r.Register(fmt.Sprintf("gauge-%d", i), metrics.NewGauge()) - r.Register(fmt.Sprintf("gaugefloat64-%d", i), metrics.NewGaugeFloat64()) - r.Register(fmt.Sprintf("histogram-uniform-%d", i), metrics.NewHistogram(metrics.NewUniformSample(1028))) - r.Register(fmt.Sprintf("histogram-exp-%d", i), metrics.NewHistogram(metrics.NewExpDecaySample(1028, 0.015))) - r.Register(fmt.Sprintf("meter-%d", i), metrics.NewMeter()) - } - time.Sleep(600e9) -} diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/metrics-example/metrics-example.go b/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/metrics-example/metrics-example.go deleted file mode 100644 index 66f42c0468..0000000000 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/metrics-example/metrics-example.go +++ /dev/null @@ -1,154 +0,0 @@ -package main - -import ( - "errors" - "github.com/rcrowley/go-metrics" - // "github.com/rcrowley/go-metrics/stathat" - "log" - "math/rand" - "os" - // "syslog" - "time" -) - -const fanout = 10 - -func main() { - - r := metrics.NewRegistry() - - c := metrics.NewCounter() - r.Register("foo", c) - for i := 0; i < fanout; i++ { - go func() { - for { - c.Dec(19) - time.Sleep(300e6) - } - }() - go func() { - for { - c.Inc(47) - time.Sleep(400e6) - } - }() - } - - g := metrics.NewGauge() - r.Register("bar", g) - for i := 0; i < fanout; i++ { - go func() { - for { - g.Update(19) - time.Sleep(300e6) - } - }() - go func() { - for { - g.Update(47) - time.Sleep(400e6) - } - }() - } - - gf := metrics.NewGaugeFloat64() - r.Register("barfloat64", gf) - for i := 0; i < fanout; i++ { - go func() { - for { - g.Update(19.0) - time.Sleep(300e6) - } - }() - go func() { - for { - g.Update(47.0) - time.Sleep(400e6) - } - }() - } - - hc := metrics.NewHealthcheck(func(h metrics.Healthcheck) { - if 0 < rand.Intn(2) { - h.Healthy() - } else { - h.Unhealthy(errors.New("baz")) - } - }) - r.Register("baz", hc) - - s := metrics.NewExpDecaySample(1028, 0.015) - //s := metrics.NewUniformSample(1028) - h := metrics.NewHistogram(s) - r.Register("bang", h) - for i := 0; i < fanout; i++ { - go func() { - for { - h.Update(19) - time.Sleep(300e6) - } - }() - go func() { - for { - h.Update(47) - time.Sleep(400e6) - } - }() - } - - m := metrics.NewMeter() - r.Register("quux", m) - for i := 0; i < fanout; i++ { - go func() { - for { - m.Mark(19) - time.Sleep(300e6) - } - }() - go func() { - for { - m.Mark(47) - time.Sleep(400e6) - } - }() - } - - t := metrics.NewTimer() - r.Register("hooah", t) - for i := 0; i < fanout; i++ { - go func() { - for { - t.Time(func() { time.Sleep(300e6) }) - } - }() - go func() { - for { - t.Time(func() { time.Sleep(400e6) }) - } - }() - } - - metrics.RegisterDebugGCStats(r) - go metrics.CaptureDebugGCStats(r, 5e9) - - metrics.RegisterRuntimeMemStats(r) - go metrics.CaptureRuntimeMemStats(r, 5e9) - - metrics.Log(r, 60e9, log.New(os.Stderr, "metrics: ", log.Lmicroseconds)) - - /* - w, err := syslog.Dial("unixgram", "/dev/log", syslog.LOG_INFO, "metrics") - if nil != err { log.Fatalln(err) } - metrics.Syslog(r, 60e9, w) - */ - - /* - addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:2003") - metrics.Graphite(r, 10e9, "metrics", addr) - */ - - /* - stathat.Stathat(r, 10e9, "example@example.com") - */ - -} diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/never-read/never-read.go b/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/never-read/never-read.go deleted file mode 100644 index dc175b778e..0000000000 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/cmd/never-read/never-read.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import ( - "log" - "net" -) - -func main() { - addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:2003") - l, err := net.ListenTCP("tcp", addr) - if nil != err { - log.Fatalln(err) - } - log.Println("listening", l.Addr()) - for { - c, err := l.AcceptTCP() - if nil != err { - log.Fatalln(err) - } - log.Println("accepted", c.RemoteAddr()) - } -} diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/librato/client.go b/Godeps/_workspace/src/github.com/rcrowley/go-metrics/librato/client.go deleted file mode 100644 index 8c0c850e38..0000000000 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/librato/client.go +++ /dev/null @@ -1,102 +0,0 @@ -package librato - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" -) - -const Operations = "operations" -const OperationsShort = "ops" - -type LibratoClient struct { - Email, Token string -} - -// property strings -const ( - // display attributes - Color = "color" - DisplayMax = "display_max" - DisplayMin = "display_min" - DisplayUnitsLong = "display_units_long" - DisplayUnitsShort = "display_units_short" - DisplayStacked = "display_stacked" - DisplayTransform = "display_transform" - // special gauge display attributes - SummarizeFunction = "summarize_function" - Aggregate = "aggregate" - - // metric keys - Name = "name" - Period = "period" - Description = "description" - DisplayName = "display_name" - Attributes = "attributes" - - // measurement keys - MeasureTime = "measure_time" - Source = "source" - Value = "value" - - // special gauge keys - Count = "count" - Sum = "sum" - Max = "max" - Min = "min" - SumSquares = "sum_squares" - - // batch keys - Counters = "counters" - Gauges = "gauges" - - MetricsPostUrl = "https://metrics-api.librato.com/v1/metrics" -) - -type Measurement map[string]interface{} -type Metric map[string]interface{} - -type Batch struct { - Gauges []Measurement `json:"gauges,omitempty"` - Counters []Measurement `json:"counters,omitempty"` - MeasureTime int64 `json:"measure_time"` - Source string `json:"source"` -} - -func (self *LibratoClient) PostMetrics(batch Batch) (err error) { - var ( - js []byte - req *http.Request - resp *http.Response - ) - - if len(batch.Counters) == 0 && len(batch.Gauges) == 0 { - return nil - } - - if js, err = json.Marshal(batch); err != nil { - return - } - - if req, err = http.NewRequest("POST", MetricsPostUrl, bytes.NewBuffer(js)); err != nil { - return - } - - req.Header.Set("Content-Type", "application/json") - req.SetBasicAuth(self.Email, self.Token) - - if resp, err = http.DefaultClient.Do(req); err != nil { - return - } - - if resp.StatusCode != http.StatusOK { - var body []byte - if body, err = ioutil.ReadAll(resp.Body); err != nil { - body = []byte(fmt.Sprintf("(could not fetch response body for error: %s)", err)) - } - err = fmt.Errorf("Unable to post to Librato: %d %s %s", resp.StatusCode, resp.Status, string(body)) - } - return -} diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/librato/librato.go b/Godeps/_workspace/src/github.com/rcrowley/go-metrics/librato/librato.go deleted file mode 100644 index d7c0574684..0000000000 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/librato/librato.go +++ /dev/null @@ -1,235 +0,0 @@ -package librato - -import ( - "fmt" - "log" - "math" - "regexp" - "time" - - "github.com/rcrowley/go-metrics" -) - -// a regexp for extracting the unit from time.Duration.String -var unitRegexp = regexp.MustCompile("[^\\d]+$") - -// a helper that turns a time.Duration into librato display attributes for timer metrics -func translateTimerAttributes(d time.Duration) (attrs map[string]interface{}) { - attrs = make(map[string]interface{}) - attrs[DisplayTransform] = fmt.Sprintf("x/%d", int64(d)) - attrs[DisplayUnitsShort] = string(unitRegexp.Find([]byte(d.String()))) - return -} - -type Reporter struct { - Email, Token string - Namespace string - Source string - Interval time.Duration - Registry metrics.Registry - Percentiles []float64 // percentiles to report on histogram metrics - TimerAttributes map[string]interface{} // units in which timers will be displayed - intervalSec int64 -} - -func NewReporter(r metrics.Registry, d time.Duration, e string, t string, s string, p []float64, u time.Duration) *Reporter { - return &Reporter{e, t, "", s, d, r, p, translateTimerAttributes(u), int64(d / time.Second)} -} - -func Librato(r metrics.Registry, d time.Duration, e string, t string, s string, p []float64, u time.Duration) { - NewReporter(r, d, e, t, s, p, u).Run() -} - -func (self *Reporter) Run() { - log.Printf("WARNING: This client has been DEPRECATED! It has been moved to https://github.com/mihasya/go-metrics-librato and will be removed from rcrowley/go-metrics on August 5th 2015") - ticker := time.Tick(self.Interval) - metricsApi := &LibratoClient{self.Email, self.Token} - for now := range ticker { - var metrics Batch - var err error - if metrics, err = self.BuildRequest(now, self.Registry); err != nil { - log.Printf("ERROR constructing librato request body %s", err) - continue - } - if err := metricsApi.PostMetrics(metrics); err != nil { - log.Printf("ERROR sending metrics to librato %s", err) - continue - } - } -} - -// calculate sum of squares from data provided by metrics.Histogram -// see http://en.wikipedia.org/wiki/Standard_deviation#Rapid_calculation_methods -func sumSquares(s metrics.Sample) float64 { - count := float64(s.Count()) - sumSquared := math.Pow(count*s.Mean(), 2) - sumSquares := math.Pow(count*s.StdDev(), 2) + sumSquared/count - if math.IsNaN(sumSquares) { - return 0.0 - } - return sumSquares -} -func sumSquaresTimer(t metrics.Timer) float64 { - count := float64(t.Count()) - sumSquared := math.Pow(count*t.Mean(), 2) - sumSquares := math.Pow(count*t.StdDev(), 2) + sumSquared/count - if math.IsNaN(sumSquares) { - return 0.0 - } - return sumSquares -} - -func (self *Reporter) BuildRequest(now time.Time, r metrics.Registry) (snapshot Batch, err error) { - snapshot = Batch{ - // coerce timestamps to a stepping fn so that they line up in Librato graphs - MeasureTime: (now.Unix() / self.intervalSec) * self.intervalSec, - Source: self.Source, - } - snapshot.Gauges = make([]Measurement, 0) - snapshot.Counters = make([]Measurement, 0) - histogramGaugeCount := 1 + len(self.Percentiles) - r.Each(func(name string, metric interface{}) { - if self.Namespace != "" { - name = fmt.Sprintf("%s.%s", self.Namespace, name) - } - measurement := Measurement{} - measurement[Period] = self.Interval.Seconds() - switch m := metric.(type) { - case metrics.Counter: - if m.Count() > 0 { - measurement[Name] = fmt.Sprintf("%s.%s", name, "count") - measurement[Value] = float64(m.Count()) - measurement[Attributes] = map[string]interface{}{ - DisplayUnitsLong: Operations, - DisplayUnitsShort: OperationsShort, - DisplayMin: "0", - } - snapshot.Counters = append(snapshot.Counters, measurement) - } - case metrics.Gauge: - measurement[Name] = name - measurement[Value] = float64(m.Value()) - snapshot.Gauges = append(snapshot.Gauges, measurement) - case metrics.GaugeFloat64: - measurement[Name] = name - measurement[Value] = float64(m.Value()) - snapshot.Gauges = append(snapshot.Gauges, measurement) - case metrics.Histogram: - if m.Count() > 0 { - gauges := make([]Measurement, histogramGaugeCount, histogramGaugeCount) - s := m.Sample() - measurement[Name] = fmt.Sprintf("%s.%s", name, "hist") - measurement[Count] = uint64(s.Count()) - measurement[Max] = float64(s.Max()) - measurement[Min] = float64(s.Min()) - measurement[Sum] = float64(s.Sum()) - measurement[SumSquares] = sumSquares(s) - gauges[0] = measurement - for i, p := range self.Percentiles { - gauges[i+1] = Measurement{ - Name: fmt.Sprintf("%s.%.2f", measurement[Name], p), - Value: s.Percentile(p), - Period: measurement[Period], - } - } - snapshot.Gauges = append(snapshot.Gauges, gauges...) - } - case metrics.Meter: - measurement[Name] = name - measurement[Value] = float64(m.Count()) - snapshot.Counters = append(snapshot.Counters, measurement) - snapshot.Gauges = append(snapshot.Gauges, - Measurement{ - Name: fmt.Sprintf("%s.%s", name, "1min"), - Value: m.Rate1(), - Period: int64(self.Interval.Seconds()), - Attributes: map[string]interface{}{ - DisplayUnitsLong: Operations, - DisplayUnitsShort: OperationsShort, - DisplayMin: "0", - }, - }, - Measurement{ - Name: fmt.Sprintf("%s.%s", name, "5min"), - Value: m.Rate5(), - Period: int64(self.Interval.Seconds()), - Attributes: map[string]interface{}{ - DisplayUnitsLong: Operations, - DisplayUnitsShort: OperationsShort, - DisplayMin: "0", - }, - }, - Measurement{ - Name: fmt.Sprintf("%s.%s", name, "15min"), - Value: m.Rate15(), - Period: int64(self.Interval.Seconds()), - Attributes: map[string]interface{}{ - DisplayUnitsLong: Operations, - DisplayUnitsShort: OperationsShort, - DisplayMin: "0", - }, - }, - ) - case metrics.Timer: - measurement[Name] = name - measurement[Value] = float64(m.Count()) - snapshot.Counters = append(snapshot.Counters, measurement) - if m.Count() > 0 { - libratoName := fmt.Sprintf("%s.%s", name, "timer.mean") - gauges := make([]Measurement, histogramGaugeCount, histogramGaugeCount) - gauges[0] = Measurement{ - Name: libratoName, - Count: uint64(m.Count()), - Sum: m.Mean() * float64(m.Count()), - Max: float64(m.Max()), - Min: float64(m.Min()), - SumSquares: sumSquaresTimer(m), - Period: int64(self.Interval.Seconds()), - Attributes: self.TimerAttributes, - } - for i, p := range self.Percentiles { - gauges[i+1] = Measurement{ - Name: fmt.Sprintf("%s.timer.%2.0f", name, p*100), - Value: m.Percentile(p), - Period: int64(self.Interval.Seconds()), - Attributes: self.TimerAttributes, - } - } - snapshot.Gauges = append(snapshot.Gauges, gauges...) - snapshot.Gauges = append(snapshot.Gauges, - Measurement{ - Name: fmt.Sprintf("%s.%s", name, "rate.1min"), - Value: m.Rate1(), - Period: int64(self.Interval.Seconds()), - Attributes: map[string]interface{}{ - DisplayUnitsLong: Operations, - DisplayUnitsShort: OperationsShort, - DisplayMin: "0", - }, - }, - Measurement{ - Name: fmt.Sprintf("%s.%s", name, "rate.5min"), - Value: m.Rate5(), - Period: int64(self.Interval.Seconds()), - Attributes: map[string]interface{}{ - DisplayUnitsLong: Operations, - DisplayUnitsShort: OperationsShort, - DisplayMin: "0", - }, - }, - Measurement{ - Name: fmt.Sprintf("%s.%s", name, "rate.15min"), - Value: m.Rate15(), - Period: int64(self.Interval.Seconds()), - Attributes: map[string]interface{}{ - DisplayUnitsLong: Operations, - DisplayUnitsShort: OperationsShort, - DisplayMin: "0", - }, - }, - ) - } - } - }) - return -} diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/stathat/stathat.go b/Godeps/_workspace/src/github.com/rcrowley/go-metrics/stathat/stathat.go deleted file mode 100644 index 0afcb48482..0000000000 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/stathat/stathat.go +++ /dev/null @@ -1,69 +0,0 @@ -// Metrics output to StatHat. -package stathat - -import ( - "github.com/rcrowley/go-metrics" - "github.com/stathat/go" - "log" - "time" -) - -func Stathat(r metrics.Registry, d time.Duration, userkey string) { - for { - if err := sh(r, userkey); nil != err { - log.Println(err) - } - time.Sleep(d) - } -} - -func sh(r metrics.Registry, userkey string) error { - r.Each(func(name string, i interface{}) { - switch metric := i.(type) { - case metrics.Counter: - stathat.PostEZCount(name, userkey, int(metric.Count())) - case metrics.Gauge: - stathat.PostEZValue(name, userkey, float64(metric.Value())) - case metrics.GaugeFloat64: - stathat.PostEZValue(name, userkey, float64(metric.Value())) - case metrics.Histogram: - h := metric.Snapshot() - ps := h.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) - stathat.PostEZCount(name+".count", userkey, int(h.Count())) - stathat.PostEZValue(name+".min", userkey, float64(h.Min())) - stathat.PostEZValue(name+".max", userkey, float64(h.Max())) - stathat.PostEZValue(name+".mean", userkey, float64(h.Mean())) - stathat.PostEZValue(name+".std-dev", userkey, float64(h.StdDev())) - stathat.PostEZValue(name+".50-percentile", userkey, float64(ps[0])) - stathat.PostEZValue(name+".75-percentile", userkey, float64(ps[1])) - stathat.PostEZValue(name+".95-percentile", userkey, float64(ps[2])) - stathat.PostEZValue(name+".99-percentile", userkey, float64(ps[3])) - stathat.PostEZValue(name+".999-percentile", userkey, float64(ps[4])) - case metrics.Meter: - m := metric.Snapshot() - stathat.PostEZCount(name+".count", userkey, int(m.Count())) - stathat.PostEZValue(name+".one-minute", userkey, float64(m.Rate1())) - stathat.PostEZValue(name+".five-minute", userkey, float64(m.Rate5())) - stathat.PostEZValue(name+".fifteen-minute", userkey, float64(m.Rate15())) - stathat.PostEZValue(name+".mean", userkey, float64(m.RateMean())) - case metrics.Timer: - t := metric.Snapshot() - ps := t.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) - stathat.PostEZCount(name+".count", userkey, int(t.Count())) - stathat.PostEZValue(name+".min", userkey, float64(t.Min())) - stathat.PostEZValue(name+".max", userkey, float64(t.Max())) - stathat.PostEZValue(name+".mean", userkey, float64(t.Mean())) - stathat.PostEZValue(name+".std-dev", userkey, float64(t.StdDev())) - stathat.PostEZValue(name+".50-percentile", userkey, float64(ps[0])) - stathat.PostEZValue(name+".75-percentile", userkey, float64(ps[1])) - stathat.PostEZValue(name+".95-percentile", userkey, float64(ps[2])) - stathat.PostEZValue(name+".99-percentile", userkey, float64(ps[3])) - stathat.PostEZValue(name+".999-percentile", userkey, float64(ps[4])) - stathat.PostEZValue(name+".one-minute", userkey, float64(t.Rate1())) - stathat.PostEZValue(name+".five-minute", userkey, float64(t.Rate5())) - stathat.PostEZValue(name+".fifteen-minute", userkey, float64(t.Rate15())) - stathat.PostEZValue(name+".mean-rate", userkey, float64(t.RateMean())) - } - }) - return nil -} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/ast/comments.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/ast/comments.go deleted file mode 100644 index 227e34ecbe..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/ast/comments.go +++ /dev/null @@ -1,92 +0,0 @@ -package ast - -import ( - "fmt" - "github.com/robertkrimen/otto/file" -) - -// CommentPosition determines where the comment is in a given context -type CommentPosition int - -const ( - _ CommentPosition = iota - LEADING // Before the pertinent expression - TRAILING // After the pertinent expression - KEY // After a key or keyword - COLON // After a colon in a field declaration - FINAL // Final comments in a block, not belonging to a specific expression or the comment after a trailing , in an array or object literal - TBD -) - -// Comment contains the data of the comment -type Comment struct { - Begin file.Idx - Text string - Position CommentPosition -} - -// String returns a stringified version of the position -func (cp CommentPosition) String() string { - switch cp { - case LEADING: - return "Leading" - case TRAILING: - return "Trailing" - case KEY: - return "Key" - case COLON: - return "Colon" - case FINAL: - return "Final" - default: - return "???" - } -} - -// String returns a stringified version of the comment -func (c Comment) String() string { - return fmt.Sprintf("Comment: %v", c.Text) -} - -// CommentMap is the data structure where all found comments are stored -type CommentMap map[Node][]*Comment - -// AddComment adds a single comment to the map -func (cm CommentMap) AddComment(node Node, comment *Comment) { - list := cm[node] - list = append(list, comment) - - cm[node] = list -} - -// AddComments adds a slice of comments, given a node and an updated position -func (cm CommentMap) AddComments(node Node, comments []*Comment, position CommentPosition) { - for _, comment := range comments { - comment.Position = position - cm.AddComment(node, comment) - } -} - -// Size returns the size of the map -func (cm CommentMap) Size() int { - size := 0 - for _, comments := range cm { - size += len(comments) - } - - return size -} - -// MoveComments moves comments with a given position from a node to another -func (cm CommentMap) MoveComments(from, to Node, position CommentPosition) { - for i, c := range cm[from] { - if c.Position == position { - cm.AddComment(to, c) - - // Remove the comment from the "from" slice - cm[from][i] = cm[from][len(cm[from])-1] - cm[from][len(cm[from])-1] = nil - cm[from] = cm[from][:len(cm[from])-1] - } - } -} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/otto/Makefile b/Godeps/_workspace/src/github.com/robertkrimen/otto/otto/Makefile deleted file mode 100644 index bac5cd4a55..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/otto/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -.PHONY: build - -build: - go build -a - -gxc build-darwin-386 -a diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/otto/main.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/otto/main.go deleted file mode 100644 index f379e42a92..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/otto/main.go +++ /dev/null @@ -1,48 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "io/ioutil" - "os" - - "github.com/robertkrimen/otto" - "github.com/robertkrimen/otto/underscore" -) - -var flag_underscore *bool = flag.Bool("underscore", true, "Load underscore into the runtime environment") - -func readSource(filename string) ([]byte, error) { - if filename == "" || filename == "-" { - return ioutil.ReadAll(os.Stdin) - } - return ioutil.ReadFile(filename) -} - -func main() { - flag.Parse() - - if !*flag_underscore { - underscore.Disable() - } - - err := func() error { - src, err := readSource(flag.Arg(0)) - if err != nil { - return err - } - - vm := otto.New() - _, err = vm.Run(src) - return err - }() - if err != nil { - switch err := err.(type) { - case *otto.Error: - fmt.Print(err.String()) - default: - fmt.Println(err) - } - os.Exit(64) - } -} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/repl/repl.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/repl/repl.go deleted file mode 100644 index 0d70cc051c..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/repl/repl.go +++ /dev/null @@ -1,115 +0,0 @@ -// Package repl implements a REPL (read-eval-print loop) for otto. -package repl - -import ( - "fmt" - "io" - "strings" - "sync/atomic" - - "github.com/robertkrimen/otto" - "gopkg.in/readline.v1" -) - -var counter uint32 - -// DebuggerHandler implements otto's debugger handler signature, providing a -// simple drop-in debugger implementation. -func DebuggerHandler(vm *otto.Otto) { - i := atomic.AddUint32(&counter, 1) - - // purposefully ignoring the error here - we can't do anything useful with - // it except panicking, and that'd be pretty rude. it'd be easy enough for a - // consumer to define an equivalent function that _does_ panic if desired. - _ = RunWithPrompt(vm, fmt.Sprintf("DEBUGGER[%d]>", i)) -} - -// Run creates a REPL with the default prompt and no prelude. -func Run(vm *otto.Otto) error { - return RunWithPromptAndPrelude(vm, "", "") -} - -// RunWithPrompt runs a REPL with the given prompt and no prelude. -func RunWithPrompt(vm *otto.Otto, prompt string) error { - return RunWithPromptAndPrelude(vm, prompt, "") -} - -// RunWithPrelude runs a REPL with the default prompt and the given prelude. -func RunWithPrelude(vm *otto.Otto, prelude string) error { - return RunWithPromptAndPrelude(vm, "", prelude) -} - -// RunWithPromptAndPrelude runs a REPL with the given prompt and prelude. -func RunWithPromptAndPrelude(vm *otto.Otto, prompt, prelude string) error { - if prompt == "" { - prompt = ">" - } - - prompt = strings.Trim(prompt, " ") - prompt += " " - - rl, err := readline.New(prompt) - if err != nil { - return err - } - - if prelude != "" { - if _, err := io.Copy(rl.Stderr(), strings.NewReader(prelude+"\n")); err != nil { - return err - } - - rl.Refresh() - } - - var d []string - - for { - l, err := rl.Readline() - if err != nil { - if err == readline.ErrInterrupt { - if d != nil { - d = nil - - rl.SetPrompt(prompt) - rl.Refresh() - - continue - } - - break - } - - return err - } - - if l == "" { - continue - } - - d = append(d, l) - - s, err := vm.Compile("repl", strings.Join(d, "\n")) - if err != nil { - rl.SetPrompt(strings.Repeat(" ", len(prompt))) - } else { - rl.SetPrompt(prompt) - - d = nil - - v, err := vm.Eval(s) - if err != nil { - if oerr, ok := err.(*otto.Error); ok { - io.Copy(rl.Stdout(), strings.NewReader(oerr.String())) - } else { - io.Copy(rl.Stdout(), strings.NewReader(err.Error())) - } - } else { - rl.Stdout().Write([]byte(v.String() + "\n")) - } - } - - rl.Refresh() - } - - return rl.Close() -} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/terst/terst.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/terst/terst.go deleted file mode 100644 index a25ca8b9c8..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/terst/terst.go +++ /dev/null @@ -1,669 +0,0 @@ -// This file was AUTOMATICALLY GENERATED by terst-import (smuggol) from github.com/robertkrimen/terst - -/* -Package terst is a terse (terst = test + terse), easy-to-use testing library for Go. - -terst is compatible with (and works via) the standard testing package: http://golang.org/pkg/testing - - var is = terst.Is - - func Test(t *testing.T) { - terst.Terst(t, func() { - is("abc", "abc") - - is(1, ">", 0) - - var abc []int - is(abc, nil) - } - } - -Do not import terst directly, instead use `terst-import` to copy it into your testing environment: - -https://github.com/robertkrimen/terst/tree/master/terst-import - - $ go get github.com/robertkrimen/terst/terst-import - - $ terst-import - -*/ -package terst - -import ( - "bytes" - "errors" - "fmt" - "math/big" - "reflect" - "regexp" - "runtime" - "strings" - "sync" - "testing" - "time" -) - -// Is compares two values (got & expect) and returns true if the comparison is true, -// false otherwise. In addition, if the comparison is false, Is will report the error -// in a manner similar to testing.T.Error(...). Is also takes an optional argument, -// a comparator, that changes how the comparison is made. The following -// comparators are available: -// -// == # got == expect (default) -// != # got != expect -// -// > # got > expect (float32, uint, uint16, int, int64, ...) -// >= # got >= expect -// < # got < expect -// <= # got <= expect -// -// =~ # regexp.MustCompile(expect).Match{String}(got) -// !~ # !regexp.MustCompile(expect).Match{String}(got) -// -// Basic usage with the default comparator (==): -// -// Is(, ) -// -// Specifying a different comparator: -// -// Is(, , ) -// -// A simple comparison: -// -// Is(2 + 2, 4) -// -// A bit trickier: -// -// Is(1, ">", 0) -// Is(2 + 2, "!=", 5) -// Is("Nothing happens.", "=~", `ing(\s+)happens\.$`) -// -// Is should only be called under a Terst(t, ...) call. For a standalone version, -// use IsErr. If no scope is found and the comparison is false, then Is will panic the error. -// -func Is(arguments ...interface{}) bool { - err := IsErr(arguments...) - if err != nil { - call := Caller() - if call == nil { - panic(err) - } - call.Error(err) - return false - } - return true -} - -type ( - // ErrFail indicates a comparison failure (e.g. 0 > 1). - ErrFail error - - // ErrInvalid indicates an invalid comparison (e.g. bool == string). - ErrInvalid error -) - -var errInvalid = errors.New("invalid") - -var registry = struct { - table map[uintptr]*_scope - lock sync.RWMutex -}{ - table: map[uintptr]*_scope{}, -} - -func registerScope(pc uintptr, scope *_scope) { - registry.lock.Lock() - defer registry.lock.Unlock() - registry.table[pc] = scope -} - -func scope() *_scope { - scope, _ := findScope() - return scope -} - -func floatCompare(a float64, b float64) int { - if a > b { - return 1 - } else if a < b { - return -1 - } - // NaN == NaN - return 0 -} - -func bigIntCompare(a *big.Int, b *big.Int) int { - return a.Cmp(b) -} - -func bigInt(value int64) *big.Int { - return big.NewInt(value) -} - -func bigUint(value uint64) *big.Int { - return big.NewInt(0).SetUint64(value) -} - -type _toString interface { - String() string -} - -func toString(value interface{}) (string, error) { - switch value := value.(type) { - case string: - return value, nil - case _toString: - return value.String(), nil - case error: - return value.Error(), nil - } - return "", errInvalid -} - -func matchString(got string, expect *regexp.Regexp) (int, error) { - if expect.MatchString(got) { - return 0, nil - } - return -1, nil -} - -func match(got []byte, expect *regexp.Regexp) (int, error) { - if expect.Match(got) { - return 0, nil - } - return -1, nil -} - -func compareMatch(got, expect interface{}) (int, error) { - switch got := got.(type) { - case []byte: - switch expect := expect.(type) { - case string: - matcher, err := regexp.Compile(expect) - if err != nil { - return 0, err - } - return match(got, matcher) - case *regexp.Regexp: - return match(got, expect) - } - default: - if got, err := toString(got); err == nil { - switch expect := expect.(type) { - case string: - matcher, err := regexp.Compile(expect) - if err != nil { - return 0, err - } - return matchString(got, matcher) - case *regexp.Regexp: - return matchString(got, expect) - } - } else { - return 0, err - } - } - return 0, errInvalid -} - -func floatPromote(value reflect.Value) (float64, error) { - kind := value.Kind() - if reflect.Int <= kind && kind <= reflect.Int64 { - return float64(value.Int()), nil - } - if reflect.Uint <= kind && kind <= reflect.Uint64 { - return float64(value.Uint()), nil - } - if reflect.Float32 <= kind && kind <= reflect.Float64 { - return value.Float(), nil - } - return 0, errInvalid -} - -func bigIntPromote(value reflect.Value) (*big.Int, error) { - kind := value.Kind() - if reflect.Int <= kind && kind <= reflect.Int64 { - return bigInt(value.Int()), nil - } - if reflect.Uint <= kind && kind <= reflect.Uint64 { - return bigUint(value.Uint()), nil - } - return nil, errInvalid -} - -func compareOther(got, expect interface{}) (int, error) { - { - switch expect.(type) { - case float32, float64: - return compareNumber(got, expect) - case uint, uint8, uint16, uint32, uint64: - return compareNumber(got, expect) - case int, int8, int16, int32, int64: - return compareNumber(got, expect) - case string: - var err error - got, err = toString(got) - if err != nil { - return 0, err - } - case nil: - got := reflect.ValueOf(got) - switch got.Kind() { - case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Slice, reflect.Interface: - if got.IsNil() { - return 0, nil - } - return -1, nil - case reflect.Invalid: // reflect.Invalid: var abc interface{} = nil - return 0, nil - } - return 0, errInvalid - } - } - - if reflect.ValueOf(got).Type() != reflect.ValueOf(expect).Type() { - return 0, errInvalid - } - - if reflect.DeepEqual(got, expect) { - return 0, nil - } - return -1, nil -} - -func compareNumber(got, expect interface{}) (int, error) { - { - got := reflect.ValueOf(got) - k0 := got.Kind() - expect := reflect.ValueOf(expect) - k1 := expect.Kind() - if reflect.Float32 <= k0 && k0 <= reflect.Float64 || - reflect.Float32 <= k1 && k1 <= reflect.Float64 { - got, err := floatPromote(got) - if err != nil { - return 0, err - } - expect, err := floatPromote(expect) - if err != nil { - return 0, err - } - return floatCompare(got, expect), nil - } else { - got, err := bigIntPromote(got) - if err != nil { - return 0, err - } - expect, err := bigIntPromote(expect) - if err != nil { - return 0, err - } - return got.Cmp(expect), nil - } - } - - return 0, errInvalid -} - -// IsErr compares two values (got & expect) and returns nil if the comparison is true, an ErrFail if -// the comparison is false, or an ErrInvalid if the comparison is invalid. IsErr also -// takes an optional argument, a comparator, that changes how the comparison is made. -// -// Is & IsErr are similar but different: -// -// Is(...) // Should only be called within a Terst(...) call -// IsErr(...) // A standalone comparator, the same as Is, just without the automatic reporting -// -func IsErr(arguments ...interface{}) error { - var got, expect interface{} - comparator := "==" - switch len(arguments) { - case 0, 1: - return fmt.Errorf("invalid number of arguments to IsErr: %d", len(arguments)) - case 2: - got, expect = arguments[0], arguments[1] - default: - if value, ok := arguments[1].(string); ok { - comparator = value - } else { - return fmt.Errorf("invalid comparator: %v", arguments[1]) - } - got, expect = arguments[0], arguments[2] - } - - var result int - var err error - - switch comparator { - case "<", "<=", ">", ">=": - result, err = compareNumber(got, expect) - case "=~", "!~": - result, err = compareMatch(got, expect) - case "==", "!=": - result, err = compareOther(got, expect) - default: - return fmt.Errorf("invalid comparator: %s", comparator) - } - - if err == errInvalid { - return ErrInvalid(fmt.Errorf( - "\nINVALID (%s):\n got: %v (%T)\n expected: %v (%T)", - comparator, - got, got, - expect, expect, - )) - } else if err != nil { - return err - } - - equality, pass := false, false - - switch comparator { - case "==", "=~": - equality = true - pass = result == 0 - case "!=", "!~": - equality = true - pass = result != 0 - case "<": - pass = result < 0 - case "<=": - pass = result <= 0 - case ">": - pass = result > 0 - case ">=": - pass = result >= 0 - } - - if !pass { - if equality { - if comparator[1] == '~' { - if value, ok := got.([]byte); ok { - return ErrFail(fmt.Errorf( - "\nFAIL (%s)\n got: %s %v%s\nexpected: %v%s", - comparator, - value, got, typeKindString(got), - expect, typeKindString(expect), - )) - } - } - return ErrFail(fmt.Errorf( - "\nFAIL (%s)\n got: %v%s\nexpected: %v%s", - comparator, - got, typeKindString(got), - expect, typeKindString(expect), - )) - } - return ErrFail(fmt.Errorf( - "\nFAIL (%s)\n got: %v%s\nexpected: %s %v%s", - comparator, - got, typeKindString(got), - comparator, expect, typeKindString(expect), - )) - } - - return nil -} - -func typeKindString(value interface{}) string { - reflectValue := reflect.ValueOf(value) - kind := reflectValue.Kind().String() - result := fmt.Sprintf("%T", value) - if kind == result { - if kind == "string" { - return "" - } - return fmt.Sprintf(" (%T)", value) - } - return fmt.Sprintf(" (%T=%s)", value, kind) -} - -func (scope *_scope) reset() { - scope.name = "" - scope.output = scope.output[:] - scope.start = time.Time{} - scope.duration = 0 -} - -// Terst creates a testing scope, where Is can be called and errors will be reported -// according to the top-level location of the comparison, and not where the Is call -// actually takes place. For example: -// -// func test(value int) { -// Is(value, 5) // <--- This failure is reported below. -// } -// -// Terst(t, func(){ -// -// Is(2, ">", 3) // <--- An error is reported here. -// -// test(5) // <--- An error is reported here. -// -// }) -// -func Terst(t *testing.T, arguments ...func()) { - scope := &_scope{ - t: t, - } - - pc, _, _, ok := runtime.Caller(1) // TODO Associate with the Test... func - if !ok { - panic("Here be dragons.") - } - - _, scope.testFunc = findTestFunc() - - registerScope(pc, scope) - - for _, fn := range arguments { - func() { - scope.reset() - name := scope.testFunc.Name() - index := strings.LastIndex(scope.testFunc.Name(), ".") - if index >= 0 { - name = name[index+1:] + "(Terst)" - } else { - name = "(Terst)" - } - name = "(Terst)" - scope.name = name - scope.start = time.Now() - defer func() { - scope.duration = time.Now().Sub(scope.start) - if err := recover(); err != nil { - scope.t.Fail() - scope.report() - panic(err) - } - scope.report() - }() - fn() - }() - } -} - -// From "testing" -func (scope *_scope) report() { - format := "~~~ %s: (Terst)\n%s" - if scope.t.Failed() { - fmt.Printf(format, "FAIL", scope.output) - } else if testing.Verbose() && len(scope.output) > 0 { - fmt.Printf(format, "PASS", scope.output) - } -} - -func (scope *_scope) log(call _entry, str string) { - scope.mu.Lock() - defer scope.mu.Unlock() - scope.output = append(scope.output, decorate(call, str)...) -} - -// decorate prefixes the string with the file and line of the call site -// and inserts the final newline if needed and indentation tabs for formascing. -func decorate(call _entry, s string) string { - - file, line := call.File, call.Line - if call.PC > 0 { - // Truncate file name at last file name separator. - if index := strings.LastIndex(file, "/"); index >= 0 { - file = file[index+1:] - } else if index = strings.LastIndex(file, "\\"); index >= 0 { - file = file[index+1:] - } - } else { - file = "???" - line = 1 - } - buf := new(bytes.Buffer) - // Every line is indented at least one tab. - buf.WriteByte('\t') - fmt.Fprintf(buf, "%s:%d: ", file, line) - lines := strings.Split(s, "\n") - if l := len(lines); l > 1 && lines[l-1] == "" { - lines = lines[:l-1] - } - for i, line := range lines { - if i > 0 { - // Second and subsequent lines are indented an extra tab. - buf.WriteString("\n\t\t") - } - buf.WriteString(line) - } - buf.WriteByte('\n') - return buf.String() -} - -func findScope() (*_scope, _entry) { - registry.lock.RLock() - defer registry.lock.RUnlock() - table := registry.table - depth := 2 // Starting depth - call := _entry{} - for { - pc, _, _, ok := runtime.Caller(depth) - if !ok { - break - } - if scope, exists := table[pc]; exists { - pc, file, line, _ := runtime.Caller(depth - 3) // Terst(...) + func(){}() + fn() => ???() - call.PC = pc - call.File = file - call.Line = line - return scope, call - } - depth++ - } - return nil, _entry{} -} - -// Call is a reference to a line immediately under a Terst testing scope. -type Call struct { - scope *_scope - entry _entry -} - -// Caller will search the stack, looking for a Terst testing scope. If a scope -// is found, then Caller returns a Call for logging errors, accessing testing.T, etc. -// If no scope is found, Caller returns nil. -func Caller() *Call { - scope, entry := findScope() - if scope == nil { - return nil - } - return &Call{ - scope: scope, - entry: entry, - } -} - -// TestFunc returns the *runtime.Func entry for the top-level Test...(t testing.T) -// function. -func (cl *Call) TestFunc() *runtime.Func { - return cl.scope.testFunc -} - -// T returns the original testing.T passed to Terst(...) -func (cl *Call) T() *testing.T { - return cl.scope.t -} - -// Log is the terst version of `testing.T.Log` -func (cl *Call) Log(arguments ...interface{}) { - cl.scope.log(cl.entry, fmt.Sprintln(arguments...)) -} - -// Logf is the terst version of `testing.T.Logf` -func (cl *Call) Logf(format string, arguments ...interface{}) { - cl.scope.log(cl.entry, fmt.Sprintf(format, arguments...)) -} - -// Error is the terst version of `testing.T.Error` -func (cl *Call) Error(arguments ...interface{}) { - cl.scope.log(cl.entry, fmt.Sprintln(arguments...)) - cl.scope.t.Fail() -} - -// Errorf is the terst version of `testing.T.Errorf` -func (cl *Call) Errorf(format string, arguments ...interface{}) { - cl.scope.log(cl.entry, fmt.Sprintf(format, arguments...)) - cl.scope.t.Fail() -} - -// Skip is the terst version of `testing.T.Skip` -func (cl *Call) Skip(arguments ...interface{}) { - cl.scope.log(cl.entry, fmt.Sprintln(arguments...)) - cl.scope.t.SkipNow() -} - -// Skipf is the terst version of `testing.T.Skipf` -func (cl *Call) Skipf(format string, arguments ...interface{}) { - cl.scope.log(cl.entry, fmt.Sprintf(format, arguments...)) - cl.scope.t.SkipNow() -} - -type _scope struct { - t *testing.T - testFunc *runtime.Func - name string - mu sync.RWMutex - output []byte - start time.Time - duration time.Duration -} - -type _entry struct { - PC uintptr - File string - Line int - Func *runtime.Func -} - -func _findFunc(match string) (_entry, *runtime.Func) { - depth := 2 // Starting depth - for { - pc, file, line, ok := runtime.Caller(depth) - if !ok { - break - } - fn := runtime.FuncForPC(pc) - name := fn.Name() - if index := strings.LastIndex(name, match); index >= 0 { - // Assume we have an instance of TestXyzzy in a _test file - return _entry{ - PC: pc, - File: file, - Line: line, - Func: fn, - }, fn - } - depth++ - } - return _entry{}, nil -} - -func findTestFunc() (_entry, *runtime.Func) { - return _findFunc(".Test") -} - -func findTerstFunc() (_entry, *runtime.Func) { - return _findFunc(".Terst") -} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/test/Makefile b/Godeps/_workspace/src/github.com/robertkrimen/otto/test/Makefile deleted file mode 100644 index ac76fdeacf..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/test/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -.PHONY: test fetch clean build err report - -TESTER := tester - -test: $(TESTER) - for test in test-*.js; do ./$^ -test=true $$test 1>/dev/null || exit 1; done - @echo PASS - -report: $(TESTER) - ./$^ -report | grep -v "MT READY" - -fetch: $(TESTER) - ./$^ fetch - -build: - go build -a -o $(TESTER) - -$(TESTER): tester.go - $(MAKE) build - -clean: - rm -f test-*.js - rm -f $(TESTER) - -err: $(TESTER) - for test in test-*.js; do ./$^ $$test; done 2>$@ diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/test/tester.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/test/tester.go deleted file mode 100644 index ea694fd8de..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/test/tester.go +++ /dev/null @@ -1,196 +0,0 @@ -package main - -import ( - "encoding/json" - "flag" - "fmt" - "io/ioutil" - "net/http" - "os" - "regexp" - "strings" - "sync" - "text/tabwriter" - - "github.com/robertkrimen/otto" - "github.com/robertkrimen/otto/parser" -) - -var flag_test *bool = flag.Bool("test", false, "") -var flag_report *bool = flag.Bool("report", false, "") - -var match_ReferenceError_not_defined = regexp.MustCompile(`^ReferenceError: \S+ is not defined$`) -var match_lookahead = regexp.MustCompile(`Invalid regular expression: re2: Invalid \(\?[=!]\) `) -var match_backreference = regexp.MustCompile(`Invalid regular expression: re2: Invalid \\\d `) -var match_TypeError_undefined = regexp.MustCompile(`^TypeError: Cannot access member '[^']+' of undefined$`) - -var target = map[string]string{ - "test-angular-bindonce.js": "fail", // (anonymous): Line 1:944 Unexpected token ( (and 40 more errors) - "test-jsforce.js": "fail", // (anonymous): Line 9:28329 RuneError (and 5 more errors) - "test-chaplin.js": "parse", // Error: Chaplin requires Common.js or AMD modules - "test-dropbox.js.js": "parse", // Error: dropbox.js loaded in an unsupported JavaScript environment. - "test-epitome.js": "parse", // TypeError: undefined is not a function - "test-portal.js": "parse", // TypeError - "test-reactive-coffee.js": "parse", // Dependencies are not met for reactive: _ and $ not found - "test-scriptaculous.js": "parse", // script.aculo.us requires the Prototype JavaScript framework >= 1.6.0.3 - "test-waypoints.js": "parse", // TypeError: undefined is not a function - "test-webuploader.js": "parse", // Error: `jQuery` is undefined - "test-xuijs.js": "parse", // TypeError: undefined is not a function -} - -// http://cdnjs.com/ -// http://api.cdnjs.com/libraries - -func fetch(name, location string) error { - response, err := http.Get(location) - if err != nil { - return err - } - defer response.Body.Close() - body, err := ioutil.ReadAll(response.Body) - if err != nil { - return err - } - - if !strings.HasSuffix(location, ".js") { - return nil - } - - filename := "test-" + name + ".js" - fmt.Println(filename, len(body)) - return ioutil.WriteFile(filename, body, 0644) -} - -func test(filename string) error { - script, err := ioutil.ReadFile(filename) - if err != nil { - return err - } - - if !*flag_report { - fmt.Fprintln(os.Stdout, filename, len(script)) - } - - parse := false - option := target[filename] - - if option != "parse" { - vm := otto.New() - _, err = vm.Run(string(script)) - if err != nil { - value := err.Error() - switch { - case match_ReferenceError_not_defined.MatchString(value): - case match_TypeError_undefined.MatchString(value): - case match_lookahead.MatchString(value): - case match_backreference.MatchString(value): - default: - return err - } - parse = true - } - } - - if parse { - _, err = parser.ParseFile(nil, filename, string(script), parser.IgnoreRegExpErrors) - if err != nil { - return err - } - target[filename] = "parse" - } - - return nil -} - -func main() { - flag.Parse() - - filename := "" - - err := func() error { - - if flag.Arg(0) == "fetch" { - response, err := http.Get("http://api.cdnjs.com/libraries") - if err != nil { - return err - } - defer response.Body.Close() - body, err := ioutil.ReadAll(response.Body) - if err != nil { - return err - } - - var tmp map[string]interface{} - - err = json.Unmarshal(body, &tmp) - if err != nil { - return err - } - - var wg sync.WaitGroup - - for _, value := range tmp["results"].([]interface{}) { - wg.Add(1) - library := value.(map[string]interface{}) - go func() { - defer wg.Done() - fetch(library["name"].(string), library["latest"].(string)) - }() - } - - wg.Wait() - - return nil - } - - if *flag_report { - files, err := ioutil.ReadDir(".") - if err != nil { - return err - } - writer := tabwriter.NewWriter(os.Stdout, 0, 8, 0, '\t', 0) - fmt.Fprintln(writer, "", "\t| Status") - fmt.Fprintln(writer, "---", "\t| ---") - for _, file := range files { - filename := file.Name() - if !strings.HasPrefix(filename, "test-") { - continue - } - err := test(filename) - option := target[filename] - name := strings.TrimPrefix(strings.TrimSuffix(filename, ".js"), "test-") - if err == nil { - switch option { - case "": - fmt.Fprintln(writer, name, "\t| pass") - case "parse": - fmt.Fprintln(writer, name, "\t| pass (parse)") - case "re2": - continue - fmt.Fprintln(writer, name, "\t| unknown (re2)") - } - } else { - fmt.Fprintln(writer, name, "\t| fail") - } - } - writer.Flush() - return nil - } - - filename = flag.Arg(0) - return test(filename) - - }() - if err != nil { - if filename != "" { - if *flag_test && target[filename] == "fail" { - goto exit - } - fmt.Fprintf(os.Stderr, "%s: %s\n", filename, err.Error()) - } else { - fmt.Fprintln(os.Stderr, err) - } - os.Exit(64) - } -exit: -} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go deleted file mode 100644 index c469f5fcb2..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go +++ /dev/null @@ -1,13 +0,0 @@ -package otto - -func (rt *_runtime) newErrorObject(name string, message Value) *_object { - self := rt.newClassObject("Error") - if message.IsDefined() { - msg := message.string() - self.defineProperty("message", toValue_string(msg), 0111, false) - self.value = newError(rt, name, msg) - } else { - self.value = newError(rt, name) - } - return self -} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/Makefile b/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/Makefile deleted file mode 100644 index fc872917f0..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -.PHONY: source - -source: source.go - -underscore.js: - curl -kL http://underscorejs.org/underscore.js > $@ - -source.go: underscore.js - go-bindata -f underscore -p underscore -u true < $< 2>/dev/null | grep -v '^//' | gofmt > $@ - head -4 $< >> $@ - mv $< .. diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/README.markdown b/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/README.markdown deleted file mode 100644 index bce37b6953..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/README.markdown +++ /dev/null @@ -1,53 +0,0 @@ -# underscore --- - import "github.com/robertkrimen/otto/underscore" - -Package underscore contains the source for the JavaScript utility-belt library. - - import ( - _ "github.com/robertkrimen/otto/underscore" - ) - // Every Otto runtime will now include underscore - -http://underscorejs.org - -https://github.com/documentcloud/underscore - -By importing this package, you'll automatically load underscore every time you -create a new Otto runtime. - -To prevent this behavior, you can do the following: - - import ( - "github.com/robertkrimen/otto/underscore" - ) - - func init() { - underscore.Disable() - } - -## Usage - -#### func Disable - -```go -func Disable() -``` -Disable underscore runtime inclusion. - -#### func Enable - -```go -func Enable() -``` -Enable underscore runtime inclusion. - -#### func Source - -```go -func Source() string -``` -Source returns the underscore source. - --- -**godocdown** http://github.com/robertkrimen/godocdown diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/source.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/source.go deleted file mode 100644 index 7c5df97145..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/source.go +++ /dev/null @@ -1,3463 +0,0 @@ -package underscore - -func underscore() []byte { - return []byte{ - 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x55, 0x6e, 0x64, 0x65, 0x72, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x6a, 0x73, 0x20, 0x31, 0x2e, 0x34, - 0x2e, 0x34, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x74, - 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, - 0x6f, 0x72, 0x65, 0x6a, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x0a, 0x2f, 0x2f, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, - 0x39, 0x2d, 0x32, 0x30, 0x31, 0x33, 0x20, 0x4a, 0x65, 0x72, 0x65, 0x6d, - 0x79, 0x20, 0x41, 0x73, 0x68, 0x6b, 0x65, 0x6e, 0x61, 0x73, 0x2c, 0x20, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x75, - 0x64, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, - 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x66, 0x72, 0x65, 0x65, - 0x6c, 0x79, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x64, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x4d, 0x49, 0x54, 0x20, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, - 0x2e, 0x0a, 0x0a, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x42, - 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x73, 0x65, 0x74, 0x75, - 0x70, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x69, 0x73, - 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x20, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, 0x60, 0x77, 0x69, 0x6e, 0x64, - 0x6f, 0x77, 0x60, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, - 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x60, - 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x60, 0x20, 0x6f, 0x6e, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x0a, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x20, 0x3d, 0x20, - 0x74, 0x68, 0x69, 0x73, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x53, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x65, - 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, - 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x60, 0x5f, 0x60, 0x20, 0x76, - 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x76, - 0x61, 0x72, 0x20, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x55, - 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x3d, 0x20, - 0x72, 0x6f, 0x6f, 0x74, 0x2e, 0x5f, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x45, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x67, 0x65, 0x74, 0x73, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x72, 0x65, - 0x61, 0x6b, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, - 0x6c, 0x6f, 0x6f, 0x70, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x72, - 0x65, 0x61, 0x6b, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x61, 0x76, 0x65, 0x20, 0x62, - 0x79, 0x74, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x6d, 0x69, 0x6e, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x28, 0x62, 0x75, - 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x67, 0x7a, 0x69, 0x70, 0x70, 0x65, - 0x64, 0x29, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x0a, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x3d, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x2c, 0x20, - 0x4f, 0x62, 0x6a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x3d, 0x20, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, - 0x79, 0x70, 0x65, 0x2c, 0x20, 0x46, 0x75, 0x6e, 0x63, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x20, 0x3d, 0x20, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x3b, - 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x20, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x70, 0x65, 0x65, - 0x64, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74, 0x6f, 0x20, - 0x63, 0x6f, 0x72, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x70, - 0x75, 0x73, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x2c, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, - 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, - 0x6c, 0x69, 0x63, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, - 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6f, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x3d, 0x20, 0x4f, 0x62, 0x6a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x74, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2c, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x73, 0x4f, 0x77, 0x6e, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x4f, - 0x62, 0x6a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x68, 0x61, 0x73, 0x4f, - 0x77, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x2a, 0x2a, - 0x45, 0x43, 0x4d, 0x41, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x35, - 0x2a, 0x2a, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x77, 0x65, 0x20, 0x68, 0x6f, 0x70, 0x65, 0x20, - 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x61, 0x72, 0x65, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x64, - 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x46, - 0x6f, 0x72, 0x45, 0x61, 0x63, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x3d, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x66, 0x6f, 0x72, 0x45, 0x61, 0x63, 0x68, 0x2c, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x70, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x41, - 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6d, 0x61, - 0x70, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, - 0x65, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x3d, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x2c, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x64, - 0x75, 0x63, 0x65, 0x52, 0x69, 0x67, 0x68, 0x74, 0x20, 0x20, 0x3d, 0x20, - 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, - 0x65, 0x64, 0x75, 0x63, 0x65, 0x52, 0x69, 0x67, 0x68, 0x74, 0x2c, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, - 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x45, 0x76, 0x65, 0x72, 0x79, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x41, 0x72, 0x72, - 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x76, 0x65, 0x72, - 0x79, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, - 0x65, 0x53, 0x6f, 0x6d, 0x65, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x3d, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x73, 0x6f, 0x6d, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, - 0x4f, 0x66, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x41, 0x72, - 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x4f, 0x66, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6e, 0x61, - 0x74, 0x69, 0x76, 0x65, 0x4c, 0x61, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x4f, 0x66, 0x20, 0x20, 0x3d, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6c, 0x61, 0x73, 0x74, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x4f, 0x66, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6e, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x41, 0x72, 0x72, 0x61, - 0x79, 0x2e, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4b, 0x65, 0x79, - 0x73, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2c, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x42, - 0x69, 0x6e, 0x64, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x3d, 0x20, 0x46, 0x75, 0x6e, 0x63, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x62, 0x69, 0x6e, 0x64, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x73, 0x61, 0x66, - 0x65, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x20, - 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x55, 0x6e, 0x64, 0x65, 0x72, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x20, 0x66, 0x6f, 0x72, 0x20, 0x75, 0x73, 0x65, 0x20, 0x62, 0x65, 0x6c, - 0x6f, 0x77, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x5f, 0x20, - 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, - 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x63, 0x65, 0x6f, 0x66, 0x20, 0x5f, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x21, 0x28, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x6f, 0x66, 0x20, 0x5f, 0x29, - 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6e, 0x65, 0x77, - 0x20, 0x5f, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x5f, 0x77, 0x72, 0x61, 0x70, 0x70, - 0x65, 0x64, 0x20, 0x3d, 0x20, 0x6f, 0x62, 0x6a, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x70, - 0x6f, 0x72, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x55, 0x6e, 0x64, 0x65, - 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x2a, 0x2a, 0x4e, 0x6f, 0x64, 0x65, - 0x2e, 0x6a, 0x73, 0x2a, 0x2a, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x77, 0x61, 0x72, - 0x64, 0x73, 0x2d, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, - 0x6c, 0x69, 0x74, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x6f, 0x6c, 0x64, 0x20, 0x60, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x28, 0x29, 0x60, 0x20, 0x41, 0x50, 0x49, 0x2e, 0x20, 0x49, 0x66, - 0x20, 0x77, 0x65, 0x27, 0x72, 0x65, 0x20, 0x69, 0x6e, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x73, - 0x65, 0x72, 0x2c, 0x20, 0x61, 0x64, 0x64, 0x20, 0x60, 0x5f, 0x60, 0x20, - 0x61, 0x73, 0x20, 0x61, 0x20, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x76, 0x69, 0x61, 0x20, 0x61, - 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x66, 0x6f, 0x72, 0x20, 0x43, 0x6c, 0x6f, 0x73, 0x75, 0x72, 0x65, - 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x22, 0x61, - 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x22, 0x20, 0x6d, 0x6f, 0x64, - 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x79, 0x70, - 0x65, 0x6f, 0x66, 0x20, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x20, - 0x21, 0x3d, 0x3d, 0x20, 0x27, 0x75, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, - 0x65, 0x64, 0x27, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, - 0x66, 0x20, 0x28, 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x20, 0x21, 0x3d, 0x3d, 0x20, 0x27, 0x75, 0x6e, - 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x27, 0x20, 0x26, 0x26, 0x20, - 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, - 0x74, 0x73, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x20, 0x3d, 0x20, 0x5f, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2e, - 0x5f, 0x20, 0x3d, 0x20, 0x5f, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, - 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x6f, - 0x6f, 0x74, 0x2e, 0x5f, 0x20, 0x3d, 0x20, 0x5f, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x74, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, - 0x20, 0x3d, 0x20, 0x27, 0x31, 0x2e, 0x34, 0x2e, 0x34, 0x27, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, - 0x68, 0x65, 0x20, 0x63, 0x6f, 0x72, 0x6e, 0x65, 0x72, 0x73, 0x74, 0x6f, - 0x6e, 0x65, 0x2c, 0x20, 0x61, 0x6e, 0x20, 0x60, 0x65, 0x61, 0x63, 0x68, - 0x60, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x6b, 0x61, 0x20, 0x60, 0x66, - 0x6f, 0x72, 0x45, 0x61, 0x63, 0x68, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x20, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x2d, 0x69, 0x6e, 0x20, - 0x60, 0x66, 0x6f, 0x72, 0x45, 0x61, 0x63, 0x68, 0x60, 0x2c, 0x20, 0x61, - 0x72, 0x72, 0x61, 0x79, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, - 0x61, 0x77, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, - 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, - 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x60, 0x66, 0x6f, 0x72, - 0x45, 0x61, 0x63, 0x68, 0x60, 0x20, 0x69, 0x66, 0x20, 0x61, 0x76, 0x61, - 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x65, - 0x61, 0x63, 0x68, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x66, 0x6f, 0x72, 0x45, - 0x61, 0x63, 0x68, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, - 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x46, 0x6f, 0x72, 0x45, 0x61, 0x63, 0x68, 0x20, 0x26, 0x26, 0x20, 0x6f, - 0x62, 0x6a, 0x2e, 0x66, 0x6f, 0x72, 0x45, 0x61, 0x63, 0x68, 0x20, 0x3d, - 0x3d, 0x3d, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x46, 0x6f, 0x72, - 0x45, 0x61, 0x63, 0x68, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x66, 0x6f, 0x72, 0x45, 0x61, 0x63, - 0x68, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x6f, 0x62, 0x6a, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, - 0x3d, 0x3d, 0x3d, 0x20, 0x2b, 0x6f, 0x62, 0x6a, 0x2e, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x69, 0x20, - 0x3d, 0x20, 0x30, 0x2c, 0x20, 0x6c, 0x20, 0x3d, 0x20, 0x6f, 0x62, 0x6a, - 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3b, 0x20, 0x69, 0x20, 0x3c, - 0x20, 0x6c, 0x3b, 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, - 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x6f, 0x62, - 0x6a, 0x5b, 0x69, 0x5d, 0x2c, 0x20, 0x69, 0x2c, 0x20, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x65, - 0x72, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x6b, - 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x5f, 0x2e, 0x68, 0x61, 0x73, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, - 0x6b, 0x65, 0x79, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x6f, 0x62, 0x6a, - 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x2c, 0x20, - 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x62, 0x72, 0x65, - 0x61, 0x6b, 0x65, 0x72, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, - 0x70, 0x70, 0x6c, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x20, - 0x65, 0x61, 0x63, 0x68, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x2a, 0x2a, 0x45, 0x43, - 0x4d, 0x41, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x35, 0x2a, 0x2a, - 0x27, 0x73, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x60, 0x6d, - 0x61, 0x70, 0x60, 0x20, 0x69, 0x66, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, - 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6d, 0x61, - 0x70, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, - 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, - 0x74, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x70, 0x20, 0x26, 0x26, 0x20, 0x6f, - 0x62, 0x6a, 0x2e, 0x6d, 0x61, 0x70, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x6e, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x70, 0x29, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x6d, 0x61, 0x70, - 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, - 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x5b, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5d, 0x20, - 0x3d, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, - 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, - 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x20, 0x3d, 0x20, 0x27, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x20, - 0x6f, 0x66, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6e, 0x6f, 0x20, 0x69, - 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x27, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2a, 0x2a, 0x52, - 0x65, 0x64, 0x75, 0x63, 0x65, 0x2a, 0x2a, 0x20, 0x62, 0x75, 0x69, 0x6c, - 0x64, 0x73, 0x20, 0x75, 0x70, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, - 0x6c, 0x65, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x66, 0x72, - 0x6f, 0x6d, 0x20, 0x61, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2c, 0x20, 0x61, 0x6b, 0x61, - 0x20, 0x60, 0x69, 0x6e, 0x6a, 0x65, 0x63, 0x74, 0x60, 0x2c, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x72, 0x20, 0x60, 0x66, 0x6f, 0x6c, 0x64, - 0x6c, 0x60, 0x2e, 0x20, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, - 0x73, 0x20, 0x74, 0x6f, 0x20, 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, 0x53, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, 0x20, - 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x60, 0x72, 0x65, 0x64, 0x75, - 0x63, 0x65, 0x60, 0x20, 0x69, 0x66, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, - 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x72, 0x65, - 0x64, 0x75, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x66, 0x6f, 0x6c, - 0x64, 0x6c, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x69, 0x6e, 0x6a, 0x65, 0x63, - 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x2c, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x2c, 0x20, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, - 0x20, 0x3d, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3e, 0x20, 0x32, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, - 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x6f, 0x62, - 0x6a, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, - 0x64, 0x75, 0x63, 0x65, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x2e, - 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x6e, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x62, - 0x69, 0x6e, 0x64, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x3f, 0x20, 0x6f, - 0x62, 0x6a, 0x2e, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x28, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x6d, 0x65, 0x6d, 0x6f, - 0x29, 0x20, 0x3a, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x72, 0x65, 0x64, 0x75, - 0x63, 0x65, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x65, 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, - 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, - 0x66, 0x20, 0x28, 0x21, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, - 0x65, 0x6d, 0x6f, 0x20, 0x3d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, - 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x6d, 0x65, 0x6d, 0x6f, 0x20, 0x3d, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x2c, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x61, 0x6c, 0x29, 0x20, 0x74, 0x68, 0x72, 0x6f, 0x77, - 0x20, 0x6e, 0x65, 0x77, 0x20, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x28, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, - 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x2d, 0x61, 0x73, 0x73, 0x6f, 0x63, - 0x69, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, - 0x2c, 0x20, 0x61, 0x6c, 0x73, 0x6f, 0x20, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, - 0x20, 0x61, 0x73, 0x20, 0x60, 0x66, 0x6f, 0x6c, 0x64, 0x72, 0x60, 0x2e, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x2a, 0x2a, 0x45, 0x43, 0x4d, - 0x41, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x35, 0x2a, 0x2a, 0x27, - 0x73, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x60, 0x72, 0x65, - 0x64, 0x75, 0x63, 0x65, 0x52, 0x69, 0x67, 0x68, 0x74, 0x60, 0x20, 0x69, - 0x66, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x52, - 0x69, 0x67, 0x68, 0x74, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x66, 0x6f, 0x6c, - 0x64, 0x72, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x2c, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, - 0x6c, 0x20, 0x3d, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3e, 0x20, 0x32, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, - 0x6a, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x6f, - 0x62, 0x6a, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, - 0x65, 0x64, 0x75, 0x63, 0x65, 0x52, 0x69, 0x67, 0x68, 0x74, 0x20, 0x26, - 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, - 0x52, 0x69, 0x67, 0x68, 0x74, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x6e, 0x61, - 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x52, 0x69, - 0x67, 0x68, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x29, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3d, - 0x20, 0x5f, 0x2e, 0x62, 0x69, 0x6e, 0x64, 0x28, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, - 0x20, 0x3f, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x72, 0x65, 0x64, 0x75, 0x63, - 0x65, 0x52, 0x69, 0x67, 0x68, 0x74, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x29, 0x20, 0x3a, - 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x52, - 0x69, 0x67, 0x68, 0x74, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x20, 0x3d, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x21, 0x3d, 0x3d, 0x20, 0x2b, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x73, 0x20, - 0x3d, 0x20, 0x5f, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x28, 0x6f, 0x62, 0x6a, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, - 0x6a, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, - 0x6b, 0x65, 0x79, 0x73, 0x20, 0x3f, 0x20, 0x6b, 0x65, 0x79, 0x73, 0x5b, - 0x2d, 0x2d, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5d, 0x20, 0x3a, 0x20, - 0x2d, 0x2d, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x20, 0x3d, 0x20, 0x6f, - 0x62, 0x6a, 0x5b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5d, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x65, - 0x6d, 0x6f, 0x20, 0x3d, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x2c, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x2c, 0x20, 0x6f, 0x62, - 0x6a, 0x5b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5d, 0x2c, 0x20, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, - 0x21, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x29, 0x20, 0x74, 0x68, - 0x72, 0x6f, 0x77, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x54, 0x79, 0x70, 0x65, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, - 0x69, 0x72, 0x73, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x77, - 0x68, 0x69, 0x63, 0x68, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x73, 0x20, - 0x61, 0x20, 0x74, 0x72, 0x75, 0x74, 0x68, 0x20, 0x74, 0x65, 0x73, 0x74, - 0x2e, 0x20, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, - 0x20, 0x60, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x60, 0x2e, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x66, 0x69, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x5f, 0x2e, - 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x61, 0x6e, 0x79, 0x28, 0x6f, 0x62, 0x6a, 0x2c, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, - 0x6c, 0x69, 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x70, 0x61, 0x73, 0x73, 0x20, 0x61, 0x20, 0x74, - 0x72, 0x75, 0x74, 0x68, 0x20, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, - 0x73, 0x20, 0x74, 0x6f, 0x20, 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, 0x53, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, 0x20, - 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x60, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x60, 0x20, 0x69, 0x66, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, - 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, - 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x60, 0x73, - 0x65, 0x6c, 0x65, 0x63, 0x74, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x73, - 0x65, 0x6c, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, - 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x3d, - 0x20, 0x5b, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, - 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x66, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x6e, 0x61, 0x74, - 0x69, 0x76, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x29, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x66, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, - 0x6a, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, - 0x74, 0x29, 0x29, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x5b, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x5d, 0x20, 0x3d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, - 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x77, 0x68, 0x69, 0x63, - 0x68, 0x20, 0x61, 0x20, 0x74, 0x72, 0x75, 0x74, 0x68, 0x20, 0x74, 0x65, - 0x73, 0x74, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a, 0x20, 0x20, - 0x5f, 0x2e, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, - 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x66, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, - 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x21, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, - 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x2c, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x74, 0x65, - 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x20, 0x77, 0x68, 0x65, 0x74, 0x68, 0x65, - 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x20, 0x61, 0x20, 0x74, 0x72, 0x75, 0x74, 0x68, 0x20, - 0x74, 0x65, 0x73, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, - 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, - 0x65, 0x20, 0x60, 0x65, 0x76, 0x65, 0x72, 0x79, 0x60, 0x20, 0x69, 0x66, - 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, - 0x20, 0x61, 0x73, 0x20, 0x60, 0x61, 0x6c, 0x6c, 0x60, 0x2e, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x65, 0x76, 0x65, 0x72, 0x79, 0x20, 0x3d, 0x20, 0x5f, - 0x2e, 0x61, 0x6c, 0x6c, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x7c, 0x7c, 0x20, 0x28, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x5f, 0x2e, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x29, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, - 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x45, 0x76, 0x65, 0x72, 0x79, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, - 0x2e, 0x65, 0x76, 0x65, 0x72, 0x79, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x6e, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x45, 0x76, 0x65, 0x72, 0x79, 0x29, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x65, - 0x76, 0x65, 0x72, 0x79, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, - 0x6a, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, 0x28, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x20, 0x26, 0x26, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x29, - 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x62, 0x72, 0x65, - 0x61, 0x6b, 0x65, 0x72, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x21, 0x21, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, - 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, - 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x20, 0x69, 0x66, 0x20, 0x61, - 0x74, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x20, 0x6f, 0x6e, 0x65, 0x20, - 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x65, 0x73, 0x20, 0x61, 0x20, 0x74, 0x72, 0x75, 0x74, - 0x68, 0x20, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, - 0x6f, 0x20, 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, 0x53, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, 0x20, 0x6e, 0x61, 0x74, - 0x69, 0x76, 0x65, 0x20, 0x60, 0x73, 0x6f, 0x6d, 0x65, 0x60, 0x20, 0x69, - 0x66, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2e, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x65, - 0x64, 0x20, 0x61, 0x73, 0x20, 0x60, 0x61, 0x6e, 0x79, 0x60, 0x2e, 0x0a, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x3d, 0x20, - 0x5f, 0x2e, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x61, - 0x6e, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x20, 0x7c, 0x7c, 0x20, 0x28, 0x69, 0x74, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, - 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x20, - 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x53, - 0x6f, 0x6d, 0x65, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x73, - 0x6f, 0x6d, 0x65, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x6e, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x53, 0x6f, 0x6d, 0x65, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x73, 0x6f, 0x6d, 0x65, 0x28, - 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x65, 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, - 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, - 0x66, 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x7c, 0x7c, - 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, - 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, - 0x6c, 0x69, 0x73, 0x74, 0x29, 0x29, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x21, 0x21, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, - 0x65, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x20, 0x6f, 0x72, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x61, 0x20, - 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, - 0x28, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x60, 0x3d, 0x3d, 0x3d, 0x60, - 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x69, 0x61, - 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x60, 0x69, 0x6e, 0x63, 0x6c, - 0x75, 0x64, 0x65, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x69, - 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x20, - 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x4f, 0x66, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, - 0x2e, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x20, 0x3d, 0x3d, 0x3d, - 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, - 0x4f, 0x66, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, - 0x62, 0x6a, 0x2e, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x28, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x29, 0x20, 0x21, 0x3d, 0x20, 0x2d, 0x31, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x61, 0x6e, 0x79, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, - 0x3d, 0x3d, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x76, 0x6f, 0x6b, 0x65, - 0x20, 0x61, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x28, 0x77, - 0x69, 0x74, 0x68, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x29, 0x20, 0x6f, 0x6e, 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x20, - 0x69, 0x74, 0x65, 0x6d, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x63, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, - 0x5f, 0x2e, 0x69, 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x20, 0x3d, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, - 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x72, 0x67, 0x73, 0x20, - 0x3d, 0x20, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, - 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, - 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x69, - 0x73, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x6d, 0x61, 0x70, 0x28, - 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x28, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x20, 0x3f, 0x20, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x20, 0x3a, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x5b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5d, 0x29, 0x2e, 0x61, 0x70, - 0x70, 0x6c, 0x79, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x61, - 0x72, 0x67, 0x73, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x69, 0x65, 0x6e, 0x63, 0x65, - 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, - 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x20, 0x75, 0x73, 0x65, - 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x60, 0x6d, 0x61, - 0x70, 0x60, 0x3a, 0x20, 0x66, 0x65, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, - 0x20, 0x61, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x70, 0x6c, 0x75, 0x63, 0x6b, 0x20, 0x3d, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, - 0x6a, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x6d, - 0x61, 0x70, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x7b, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x3b, 0x20, 0x7d, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, - 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x20, 0x63, - 0x61, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x60, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x60, 0x3a, 0x20, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x20, 0x60, 0x6b, 0x65, 0x79, 0x3a, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x60, 0x20, 0x70, 0x61, 0x69, 0x72, 0x73, 0x2e, 0x0a, - 0x20, 0x20, 0x5f, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, - 0x2c, 0x20, 0x61, 0x74, 0x74, 0x72, 0x73, 0x2c, 0x20, 0x66, 0x69, 0x72, - 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x5f, 0x2e, 0x69, 0x73, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x28, - 0x61, 0x74, 0x74, 0x72, 0x73, 0x29, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x3f, 0x20, 0x6e, - 0x75, 0x6c, 0x6c, 0x20, 0x3a, 0x20, 0x5b, 0x5d, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x5b, 0x66, - 0x69, 0x72, 0x73, 0x74, 0x20, 0x3f, 0x20, 0x27, 0x66, 0x69, 0x6e, 0x64, - 0x27, 0x20, 0x3a, 0x20, 0x27, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x27, - 0x5d, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, - 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x61, - 0x74, 0x74, 0x72, 0x73, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x74, 0x74, 0x72, - 0x73, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x20, 0x21, 0x3d, 0x3d, 0x20, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x29, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x72, - 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, - 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x20, 0x63, - 0x61, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x60, 0x66, 0x69, 0x6e, 0x64, - 0x60, 0x3a, 0x20, 0x67, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x20, 0x60, 0x6b, 0x65, 0x79, 0x3a, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x60, 0x20, 0x70, 0x61, 0x69, 0x72, 0x73, 0x2e, 0x0a, - 0x20, 0x20, 0x5f, 0x2e, 0x66, 0x69, 0x6e, 0x64, 0x57, 0x68, 0x65, 0x72, - 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x61, 0x74, 0x74, 0x72, 0x73, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x5f, 0x2e, 0x77, 0x68, 0x65, 0x72, 0x65, 0x28, 0x6f, 0x62, - 0x6a, 0x2c, 0x20, 0x61, 0x74, 0x74, 0x72, 0x73, 0x2c, 0x20, 0x74, 0x72, - 0x75, 0x65, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x20, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6f, 0x72, 0x20, 0x28, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, 0x64, - 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x61, 0x6e, 0x27, - 0x74, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x20, 0x61, - 0x72, 0x72, 0x61, 0x79, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x6e, 0x74, - 0x65, 0x67, 0x65, 0x72, 0x73, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, - 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x36, 0x35, 0x2c, 0x35, 0x33, 0x35, - 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x3a, 0x20, 0x68, 0x74, 0x74, - 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x62, 0x75, 0x67, 0x73, 0x2e, 0x77, 0x65, - 0x62, 0x6b, 0x69, 0x74, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x73, 0x68, 0x6f, - 0x77, 0x5f, 0x62, 0x75, 0x67, 0x2e, 0x63, 0x67, 0x69, 0x3f, 0x69, 0x64, - 0x3d, 0x38, 0x30, 0x37, 0x39, 0x37, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6d, - 0x61, 0x78, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, - 0x21, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x26, 0x26, - 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x28, 0x6f, - 0x62, 0x6a, 0x29, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x5b, 0x30, - 0x5d, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x2b, 0x6f, 0x62, 0x6a, 0x5b, 0x30, - 0x5d, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x20, 0x3c, 0x20, 0x36, 0x35, 0x35, 0x33, 0x35, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x6d, 0x61, 0x78, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x4d, 0x61, 0x74, 0x68, 0x2c, - 0x20, 0x6f, 0x62, 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x26, 0x26, 0x20, 0x5f, 0x2e, - 0x69, 0x73, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x28, 0x6f, 0x62, 0x6a, 0x29, - 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x2d, 0x49, 0x6e, - 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, - 0x20, 0x7b, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x20, 0x3a, - 0x20, 0x2d, 0x49, 0x6e, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x2c, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x20, 0x2d, 0x49, 0x6e, 0x66, 0x69, - 0x6e, 0x69, 0x74, 0x79, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, - 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, - 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x20, 0x3d, - 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3f, 0x20, - 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, - 0x6c, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, - 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x20, 0x3a, 0x20, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, - 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x20, 0x3e, 0x3d, 0x20, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, - 0x64, 0x20, 0x26, 0x26, 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x20, 0x3d, 0x20, 0x7b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3a, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x75, - 0x74, 0x65, 0x64, 0x20, 0x3a, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, - 0x65, 0x64, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x20, 0x65, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x28, 0x6f, 0x72, 0x20, 0x65, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, 0x64, 0x20, 0x63, - 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x29, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6d, 0x69, 0x6e, 0x20, 0x3d, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, - 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, 0x69, 0x74, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x20, 0x26, 0x26, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x41, - 0x72, 0x72, 0x61, 0x79, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x26, 0x26, - 0x20, 0x6f, 0x62, 0x6a, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x3d, 0x3d, 0x20, - 0x2b, 0x6f, 0x62, 0x6a, 0x5b, 0x30, 0x5d, 0x20, 0x26, 0x26, 0x20, 0x6f, - 0x62, 0x6a, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3c, 0x20, - 0x36, 0x35, 0x35, 0x33, 0x35, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x4d, 0x61, - 0x74, 0x68, 0x2e, 0x6d, 0x69, 0x6e, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, - 0x28, 0x4d, 0x61, 0x74, 0x68, 0x2c, 0x20, 0x6f, 0x62, 0x6a, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, - 0x66, 0x20, 0x28, 0x21, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x20, 0x26, 0x26, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x49, 0x6e, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x63, 0x6f, 0x6d, 0x70, 0x75, - 0x74, 0x65, 0x64, 0x20, 0x3a, 0x20, 0x49, 0x6e, 0x66, 0x69, 0x6e, 0x69, - 0x74, 0x79, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x20, 0x49, - 0x6e, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x7d, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, - 0x69, 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, - 0x64, 0x20, 0x3d, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x20, 0x3f, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, - 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x20, 0x3a, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x20, 0x3c, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x75, - 0x74, 0x65, 0x64, 0x20, 0x26, 0x26, 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, - 0x3a, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x64, 0x20, 0x3a, 0x20, 0x63, 0x6f, 0x6d, 0x70, - 0x75, 0x74, 0x65, 0x64, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x20, - 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x20, 0x20, - 0x5f, 0x2e, 0x73, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x72, 0x61, 0x6e, 0x64, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x30, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x73, 0x68, 0x75, - 0x66, 0x66, 0x6c, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x6f, 0x62, 0x6a, - 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x61, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x72, - 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x28, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2b, - 0x2b, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x68, - 0x75, 0x66, 0x66, 0x6c, 0x65, 0x64, 0x5b, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x20, 0x2d, 0x20, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x73, 0x68, 0x75, 0x66, - 0x66, 0x6c, 0x65, 0x64, 0x5b, 0x72, 0x61, 0x6e, 0x64, 0x5d, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x68, 0x75, 0x66, 0x66, 0x6c, - 0x65, 0x64, 0x5b, 0x72, 0x61, 0x6e, 0x64, 0x5d, 0x20, 0x3d, 0x20, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x73, 0x68, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x20, - 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6e, - 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x65, - 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, - 0x70, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2e, - 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, - 0x70, 0x49, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x46, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, - 0x20, 0x3f, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3a, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, - 0x7b, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, - 0x5b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5d, 0x3b, 0x20, 0x7d, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, - 0x6f, 0x72, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x27, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, - 0x62, 0x79, 0x20, 0x61, 0x20, 0x63, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, - 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, - 0x62, 0x79, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x73, 0x6f, 0x72, 0x74, - 0x42, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x74, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, - 0x75, 0x70, 0x49, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x28, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x70, 0x6c, 0x75, 0x63, - 0x6b, 0x28, 0x5f, 0x2e, 0x6d, 0x61, 0x70, 0x28, 0x6f, 0x62, 0x6a, 0x2c, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, - 0x6c, 0x69, 0x73, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x20, 0x3a, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, - 0x3a, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, - 0x61, 0x20, 0x3a, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x29, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x29, 0x2e, 0x73, 0x6f, 0x72, 0x74, 0x28, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6c, 0x65, 0x66, 0x74, 0x2c, 0x20, 0x72, - 0x69, 0x67, 0x68, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x20, 0x3d, 0x20, 0x6c, 0x65, - 0x66, 0x74, 0x2e, 0x63, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, - 0x20, 0x3d, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x63, 0x72, 0x69, - 0x74, 0x65, 0x72, 0x69, 0x61, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x20, 0x21, 0x3d, 0x3d, 0x20, 0x62, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x61, 0x20, 0x3e, 0x20, 0x62, 0x20, 0x7c, 0x7c, - 0x20, 0x61, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x76, 0x6f, 0x69, 0x64, 0x20, - 0x30, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x31, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x61, 0x20, 0x3c, 0x20, 0x62, 0x20, 0x7c, 0x7c, 0x20, 0x62, 0x20, - 0x3d, 0x3d, 0x3d, 0x20, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x30, 0x29, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x2d, 0x31, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6c, 0x65, 0x66, 0x74, - 0x2e, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3c, 0x20, 0x72, 0x69, 0x67, - 0x68, 0x74, 0x2e, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3f, 0x20, 0x2d, - 0x31, 0x20, 0x3a, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x29, 0x2c, 0x20, 0x27, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x27, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x41, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x73, 0x65, - 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x20, 0x22, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x62, - 0x79, 0x22, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x67, 0x72, 0x6f, - 0x75, 0x70, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x62, - 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x49, 0x74, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, - 0x7c, 0x7c, 0x20, 0x5f, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, - 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x3d, 0x20, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, - 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, - 0x6f, 0x62, 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x28, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x2c, 0x20, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x27, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x62, - 0x79, 0x20, 0x61, 0x20, 0x63, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x6f, - 0x6e, 0x2e, 0x20, 0x50, 0x61, 0x73, 0x73, 0x20, 0x65, 0x69, 0x74, 0x68, - 0x65, 0x72, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, - 0x62, 0x79, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x61, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, - 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, - 0x5f, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x79, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, - 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, - 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, - 0x5f, 0x2e, 0x68, 0x61, 0x73, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x20, 0x3f, 0x20, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x20, 0x3a, 0x20, 0x28, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x20, - 0x3d, 0x20, 0x5b, 0x5d, 0x29, 0x29, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x28, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x20, 0x69, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, - 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x74, 0x68, 0x61, - 0x74, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x62, 0x79, 0x20, 0x61, - 0x20, 0x63, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x63, 0x72, 0x69, - 0x74, 0x65, 0x72, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x50, 0x61, 0x73, 0x73, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, - 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x62, 0x79, 0x2c, 0x20, 0x6f, 0x72, 0x20, - 0x61, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, - 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x72, 0x69, - 0x74, 0x65, 0x72, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x28, 0x6f, - 0x62, 0x6a, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2c, - 0x20, 0x6b, 0x65, 0x79, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, 0x5f, 0x2e, 0x68, 0x61, 0x73, - 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2c, 0x20, 0x6b, 0x65, 0x79, - 0x29, 0x29, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5b, 0x6b, 0x65, - 0x79, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5b, 0x6b, 0x65, 0x79, - 0x5d, 0x2b, 0x2b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x55, 0x73, 0x65, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x20, - 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x6d, 0x61, 0x6c, - 0x6c, 0x65, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x61, - 0x74, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x73, - 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x73, - 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x73, 0x6f, 0x20, 0x61, 0x73, 0x20, - 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, - 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x20, 0x55, 0x73, 0x65, 0x73, 0x20, - 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x73, 0x6f, 0x72, 0x74, 0x65, - 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, - 0x20, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x20, 0x3f, - 0x20, 0x5f, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, - 0x3a, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x49, 0x74, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x28, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x6f, 0x62, 0x6a, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6c, 0x6f, 0x77, - 0x20, 0x3d, 0x20, 0x30, 0x2c, 0x20, 0x68, 0x69, 0x67, 0x68, 0x20, 0x3d, - 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, - 0x20, 0x28, 0x6c, 0x6f, 0x77, 0x20, 0x3c, 0x20, 0x68, 0x69, 0x67, 0x68, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x6d, 0x69, 0x64, 0x20, 0x3d, 0x20, 0x28, 0x6c, 0x6f, 0x77, - 0x20, 0x2b, 0x20, 0x68, 0x69, 0x67, 0x68, 0x29, 0x20, 0x3e, 0x3e, 0x3e, - 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x5b, 0x6d, 0x69, 0x64, 0x5d, 0x29, 0x20, 0x3c, 0x20, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3f, 0x20, 0x6c, 0x6f, 0x77, 0x20, 0x3d, - 0x20, 0x6d, 0x69, 0x64, 0x20, 0x2b, 0x20, 0x31, 0x20, 0x3a, 0x20, 0x68, - 0x69, 0x67, 0x68, 0x20, 0x3d, 0x20, 0x6d, 0x69, 0x64, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x6c, 0x6f, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x61, 0x66, 0x65, - 0x6c, 0x79, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x20, 0x61, - 0x6e, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x62, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x61, 0x20, - 0x72, 0x65, 0x61, 0x6c, 0x2c, 0x20, 0x6c, 0x69, 0x76, 0x65, 0x20, 0x61, - 0x72, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x74, 0x6f, - 0x41, 0x72, 0x72, 0x61, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5b, 0x5d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, 0x69, - 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x29, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x73, 0x6c, 0x69, 0x63, - 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, - 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3d, 0x3d, 0x3d, 0x20, - 0x2b, 0x6f, 0x62, 0x6a, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x29, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x6d, 0x61, - 0x70, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x5f, 0x2e, 0x69, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x73, 0x69, 0x7a, - 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x20, 0x6e, - 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x2b, 0x6f, 0x62, 0x6a, 0x2e, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x29, 0x20, 0x3f, 0x20, 0x6f, 0x62, 0x6a, - 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3a, 0x20, 0x5f, 0x2e, - 0x6b, 0x65, 0x79, 0x73, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x2e, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x20, 0x46, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x47, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, - 0x74, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6f, 0x66, - 0x20, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x20, 0x50, - 0x61, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x2a, 0x2a, 0x6e, 0x2a, 0x2a, - 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x4e, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x2e, 0x20, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x20, 0x61, - 0x73, 0x20, 0x60, 0x68, 0x65, 0x61, 0x64, 0x60, 0x20, 0x61, 0x6e, 0x64, - 0x20, 0x60, 0x74, 0x61, 0x6b, 0x65, 0x60, 0x2e, 0x20, 0x54, 0x68, 0x65, - 0x20, 0x2a, 0x2a, 0x67, 0x75, 0x61, 0x72, 0x64, 0x2a, 0x2a, 0x20, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6c, - 0x6c, 0x6f, 0x77, 0x73, 0x20, 0x69, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x77, - 0x6f, 0x72, 0x6b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x60, 0x5f, 0x2e, - 0x6d, 0x61, 0x70, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x66, 0x69, - 0x72, 0x73, 0x74, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x68, 0x65, 0x61, 0x64, - 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x74, 0x61, 0x6b, 0x65, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x2c, 0x20, 0x6e, 0x2c, 0x20, 0x67, 0x75, 0x61, 0x72, 0x64, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, - 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, - 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x76, 0x6f, - 0x69, 0x64, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x28, 0x6e, 0x20, 0x21, 0x3d, 0x20, 0x6e, - 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x26, 0x26, 0x20, 0x21, 0x67, 0x75, 0x61, - 0x72, 0x64, 0x20, 0x3f, 0x20, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, - 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x30, - 0x2c, 0x20, 0x6e, 0x29, 0x20, 0x3a, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, - 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, - 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x62, - 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, - 0x65, 0x6e, 0x74, 0x72, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x20, 0x45, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x75, 0x73, 0x65, 0x66, 0x75, - 0x6c, 0x20, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x20, 0x50, 0x61, 0x73, 0x73, - 0x69, 0x6e, 0x67, 0x20, 0x2a, 0x2a, 0x6e, 0x2a, 0x2a, 0x20, 0x77, 0x69, - 0x6c, 0x6c, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x6c, - 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x20, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x65, 0x78, 0x63, 0x6c, - 0x75, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, - 0x73, 0x74, 0x20, 0x4e, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x2a, 0x2a, - 0x67, 0x75, 0x61, 0x72, 0x64, 0x2a, 0x2a, 0x20, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x20, 0x69, 0x74, 0x20, - 0x74, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x77, 0x69, 0x74, 0x68, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x60, 0x5f, 0x2e, 0x6d, 0x61, 0x70, - 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x6e, 0x2c, 0x20, - 0x67, 0x75, 0x61, 0x72, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x73, 0x6c, 0x69, 0x63, - 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, - 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x6e, 0x20, - 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x7c, 0x7c, 0x20, - 0x67, 0x75, 0x61, 0x72, 0x64, 0x20, 0x3f, 0x20, 0x31, 0x20, 0x3a, 0x20, - 0x6e, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x6c, 0x61, 0x73, 0x74, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, - 0x2e, 0x20, 0x50, 0x61, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x2a, 0x2a, - 0x6e, 0x2a, 0x2a, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, - 0x20, 0x4e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, - 0x72, 0x61, 0x79, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x2a, 0x2a, 0x67, - 0x75, 0x61, 0x72, 0x64, 0x2a, 0x2a, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x20, 0x69, 0x74, 0x20, 0x74, - 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, - 0x60, 0x5f, 0x2e, 0x6d, 0x61, 0x70, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x5f, - 0x2e, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, - 0x6e, 0x2c, 0x20, 0x67, 0x75, 0x61, 0x72, 0x64, 0x29, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x30, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x6e, - 0x20, 0x21, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x26, 0x26, - 0x20, 0x21, 0x67, 0x75, 0x61, 0x72, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, - 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x6d, - 0x61, 0x78, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x20, 0x2d, 0x20, 0x6e, 0x2c, 0x20, 0x30, 0x29, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5b, 0x61, 0x72, - 0x72, 0x61, 0x79, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x2d, - 0x20, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, - 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, - 0x68, 0x69, 0x6e, 0x67, 0x20, 0x62, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x65, 0x6e, 0x74, 0x72, 0x79, - 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x2e, 0x20, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x20, 0x61, - 0x73, 0x20, 0x60, 0x74, 0x61, 0x69, 0x6c, 0x60, 0x20, 0x61, 0x6e, 0x64, - 0x20, 0x60, 0x64, 0x72, 0x6f, 0x70, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x45, 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x6c, 0x79, - 0x20, 0x75, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x20, 0x6f, 0x6e, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x20, 0x50, 0x61, 0x73, - 0x73, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6e, 0x20, 0x2a, 0x2a, 0x6e, 0x2a, - 0x2a, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, - 0x65, 0x73, 0x74, 0x20, 0x4e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x2a, 0x2a, 0x67, 0x75, 0x61, - 0x72, 0x64, 0x2a, 0x2a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x20, 0x69, - 0x74, 0x20, 0x74, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x77, 0x69, - 0x74, 0x68, 0x20, 0x60, 0x5f, 0x2e, 0x6d, 0x61, 0x70, 0x60, 0x2e, 0x0a, - 0x20, 0x20, 0x5f, 0x2e, 0x72, 0x65, 0x73, 0x74, 0x20, 0x3d, 0x20, 0x5f, - 0x2e, 0x74, 0x61, 0x69, 0x6c, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x64, 0x72, - 0x6f, 0x70, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x6e, 0x2c, 0x20, - 0x67, 0x75, 0x61, 0x72, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x73, 0x6c, 0x69, 0x63, - 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, - 0x2c, 0x20, 0x28, 0x6e, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, - 0x29, 0x20, 0x7c, 0x7c, 0x20, 0x67, 0x75, 0x61, 0x72, 0x64, 0x20, 0x3f, - 0x20, 0x31, 0x20, 0x3a, 0x20, 0x6e, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x72, 0x69, 0x6d, - 0x20, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x61, 0x6c, - 0x73, 0x79, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x66, 0x72, - 0x6f, 0x6d, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, - 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x61, 0x72, 0x72, 0x61, 0x79, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x66, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, - 0x5f, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6d, 0x70, - 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, - 0x6f, 0x66, 0x20, 0x61, 0x20, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, - 0x76, 0x65, 0x20, 0x60, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x60, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, - 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x69, 0x6e, 0x70, 0x75, 0x74, 0x2c, 0x20, 0x73, 0x68, 0x61, 0x6c, 0x6c, - 0x6f, 0x77, 0x2c, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x69, - 0x6e, 0x70, 0x75, 0x74, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, - 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x28, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x20, 0x3f, 0x20, - 0x70, 0x75, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x29, 0x20, 0x3a, 0x20, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x28, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x73, 0x68, 0x61, 0x6c, 0x6c, - 0x6f, 0x77, 0x2c, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, - 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x28, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, - 0x79, 0x20, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x65, 0x64, 0x20, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, - 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x5f, - 0x2e, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x3d, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x2c, 0x20, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x28, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x2c, 0x20, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x2c, - 0x20, 0x5b, 0x5d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x61, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, - 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x28, 0x73, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x5f, - 0x2e, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, - 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, - 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, 0x29, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x61, 0x20, - 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2d, 0x66, 0x72, - 0x65, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, - 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, - 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, - 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x65, 0x6e, 0x20, - 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x2c, 0x20, 0x79, 0x6f, 0x75, 0x20, - 0x68, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, - 0x20, 0x61, 0x20, 0x66, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x61, 0x6c, - 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x2e, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, - 0x20, 0x60, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x60, 0x2e, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x75, 0x6e, 0x69, 0x71, 0x20, 0x3d, 0x20, 0x5f, 0x2e, - 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, - 0x20, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x2c, 0x20, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x65, - 0x64, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x3d, 0x20, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3d, - 0x20, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x65, - 0x64, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, - 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x3f, 0x20, 0x5f, 0x2e, - 0x6d, 0x61, 0x70, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x69, - 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x3a, 0x20, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x73, 0x65, 0x65, - 0x6e, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x65, 0x61, 0x63, 0x68, 0x28, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, - 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x3f, 0x20, - 0x28, 0x21, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x7c, 0x7c, 0x20, 0x73, - 0x65, 0x65, 0x6e, 0x5b, 0x73, 0x65, 0x65, 0x6e, 0x2e, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x20, 0x2d, 0x20, 0x31, 0x5d, 0x20, 0x21, 0x3d, 0x3d, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x20, 0x3a, 0x20, 0x21, 0x5f, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x28, 0x73, 0x65, - 0x65, 0x6e, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, - 0x65, 0x6e, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x28, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x70, 0x75, 0x73, 0x68, - 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5b, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x5d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x61, - 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x74, 0x68, 0x61, 0x74, - 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x65, 0x61, 0x63, - 0x68, 0x20, 0x64, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x63, 0x74, 0x20, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, - 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x66, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x2d, 0x69, - 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x73, 0x2e, 0x0a, 0x20, 0x20, - 0x5f, 0x2e, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, - 0x75, 0x6e, 0x69, 0x71, 0x28, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, - 0x65, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, - 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x20, - 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, - 0x65, 0x6e, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x2d, 0x69, - 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x73, 0x2e, 0x0a, 0x20, 0x20, - 0x5f, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x74, 0x20, - 0x3d, 0x20, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, - 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, - 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x28, - 0x5f, 0x2e, 0x75, 0x6e, 0x69, 0x71, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, - 0x29, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x69, 0x74, 0x65, 0x6d, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x65, - 0x76, 0x65, 0x72, 0x79, 0x28, 0x72, 0x65, 0x73, 0x74, 0x2c, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x74, 0x68, 0x65, - 0x72, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x4f, 0x66, 0x28, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x2c, - 0x20, 0x69, 0x74, 0x65, 0x6d, 0x29, 0x20, 0x3e, 0x3d, 0x20, 0x30, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x61, 0x6b, 0x65, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x20, 0x6f, 0x6e, - 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, - 0x61, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, - 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x73, - 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, - 0x6a, 0x75, 0x73, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, - 0x73, 0x74, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x77, 0x69, 0x6c, - 0x6c, 0x20, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x0a, 0x20, 0x20, - 0x5f, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x61, 0x72, 0x72, 0x61, 0x79, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x74, 0x20, 0x3d, 0x20, - 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, - 0x28, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2c, - 0x20, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, - 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, - 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x28, - 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x7b, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x21, 0x5f, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x28, 0x72, 0x65, 0x73, 0x74, 0x2c, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x3b, 0x20, 0x7d, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x5a, 0x69, 0x70, 0x20, 0x74, 0x6f, 0x67, 0x65, 0x74, 0x68, 0x65, 0x72, - 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x6c, 0x69, - 0x73, 0x74, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x73, - 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, - 0x2d, 0x2d, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, - 0x74, 0x68, 0x61, 0x74, 0x20, 0x73, 0x68, 0x61, 0x72, 0x65, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x20, 0x67, 0x6f, 0x20, 0x74, 0x6f, 0x67, 0x65, 0x74, 0x68, 0x65, 0x72, - 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x7a, 0x69, 0x70, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x72, 0x67, - 0x73, 0x20, 0x3d, 0x20, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, - 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x6d, 0x61, - 0x78, 0x28, 0x5f, 0x2e, 0x70, 0x6c, 0x75, 0x63, 0x6b, 0x28, 0x61, 0x72, - 0x67, 0x73, 0x2c, 0x20, 0x27, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x27, - 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x6e, 0x65, - 0x77, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x28, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x30, 0x3b, - 0x20, 0x69, 0x20, 0x3c, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3b, - 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x5b, 0x69, 0x5d, - 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x70, 0x6c, 0x75, 0x63, 0x6b, 0x28, 0x61, - 0x72, 0x67, 0x73, 0x2c, 0x20, 0x22, 0x22, 0x20, 0x2b, 0x20, 0x69, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x73, 0x20, - 0x6c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x20, 0x50, 0x61, 0x73, 0x73, - 0x20, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x61, 0x20, 0x73, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x6f, - 0x66, 0x20, 0x60, 0x5b, 0x6b, 0x65, 0x79, 0x2c, 0x20, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x5d, 0x60, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x61, - 0x69, 0x72, 0x73, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x77, 0x6f, 0x20, - 0x70, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x20, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, - 0x61, 0x6d, 0x65, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x2d, - 0x2d, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x6b, 0x65, 0x79, - 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x6f, - 0x66, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, - 0x6f, 0x72, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x5f, - 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6c, 0x69, 0x73, 0x74, 0x2c, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6c, 0x69, 0x73, 0x74, 0x20, - 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, - 0x20, 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x30, 0x2c, - 0x20, 0x6c, 0x20, 0x3d, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x3b, 0x20, 0x69, 0x20, 0x3c, 0x20, 0x6c, 0x3b, - 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5b, 0x6c, 0x69, 0x73, 0x74, 0x5b, - 0x69, 0x5d, 0x5d, 0x20, 0x3d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x5b, 0x69, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5b, 0x6c, - 0x69, 0x73, 0x74, 0x5b, 0x69, 0x5d, 0x5b, 0x30, 0x5d, 0x5d, 0x20, 0x3d, - 0x20, 0x6c, 0x69, 0x73, 0x74, 0x5b, 0x69, 0x5d, 0x5b, 0x31, 0x5d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x20, - 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x79, 0x20, 0x75, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x20, 0x28, 0x49, 0x27, 0x6d, 0x20, - 0x6c, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x74, 0x20, 0x79, - 0x6f, 0x75, 0x2c, 0x20, 0x2a, 0x2a, 0x4d, 0x53, 0x49, 0x45, 0x2a, 0x2a, - 0x29, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x65, 0x20, 0x6e, - 0x65, 0x65, 0x64, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, - 0x72, 0x73, 0x74, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x6e, - 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x2d, - 0x31, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x74, 0x65, - 0x6d, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x69, 0x6e, 0x63, - 0x6c, 0x75, 0x64, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, - 0x6f, 0x20, 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, 0x53, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, 0x20, 0x6e, 0x61, 0x74, - 0x69, 0x76, 0x65, 0x20, 0x60, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, - 0x60, 0x20, 0x69, 0x66, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, - 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x69, 0x73, - 0x20, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, - 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, - 0x72, 0x74, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2c, 0x20, 0x70, 0x61, - 0x73, 0x73, 0x20, 0x60, 0x74, 0x72, 0x75, 0x65, 0x60, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x2a, 0x2a, 0x69, 0x73, 0x53, - 0x6f, 0x72, 0x74, 0x65, 0x64, 0x2a, 0x2a, 0x20, 0x74, 0x6f, 0x20, 0x75, - 0x73, 0x65, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x73, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x4f, 0x66, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, - 0x69, 0x74, 0x65, 0x6d, 0x2c, 0x20, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, - 0x65, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x3d, 0x3d, 0x20, 0x6e, - 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x2d, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x69, 0x20, 0x3d, 0x20, 0x30, 0x2c, 0x20, 0x6c, 0x20, 0x3d, 0x20, 0x61, - 0x72, 0x72, 0x61, 0x79, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x69, 0x73, 0x53, - 0x6f, 0x72, 0x74, 0x65, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x79, 0x70, 0x65, 0x6f, - 0x66, 0x20, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x3d, - 0x3d, 0x20, 0x27, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x20, - 0x3d, 0x20, 0x28, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, - 0x3c, 0x20, 0x30, 0x20, 0x3f, 0x20, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x6d, - 0x61, 0x78, 0x28, 0x30, 0x2c, 0x20, 0x6c, 0x20, 0x2b, 0x20, 0x69, 0x73, - 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x29, 0x20, 0x3a, 0x20, 0x69, 0x73, - 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x20, 0x3d, 0x20, - 0x5f, 0x2e, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2c, 0x20, 0x69, 0x74, 0x65, - 0x6d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, - 0x5b, 0x69, 0x5d, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x69, 0x74, 0x65, 0x6d, - 0x20, 0x3f, 0x20, 0x69, 0x20, 0x3a, 0x20, 0x2d, 0x31, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, 0x74, - 0x69, 0x76, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x20, 0x26, - 0x26, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x4f, 0x66, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x6e, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x29, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x28, 0x69, 0x74, 0x65, 0x6d, - 0x2c, 0x20, 0x69, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x3b, 0x20, - 0x69, 0x20, 0x3c, 0x20, 0x6c, 0x3b, 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5b, 0x69, 0x5d, - 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x29, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x69, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x2d, 0x31, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, - 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, - 0x65, 0x20, 0x60, 0x6c, 0x61, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, - 0x4f, 0x66, 0x60, 0x20, 0x69, 0x66, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, - 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6c, 0x61, - 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x2c, 0x20, 0x66, 0x72, - 0x6f, 0x6d, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x3d, 0x3d, 0x20, 0x6e, - 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x2d, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x68, 0x61, 0x73, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x66, - 0x72, 0x6f, 0x6d, 0x20, 0x21, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x61, 0x74, - 0x69, 0x76, 0x65, 0x4c, 0x61, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, - 0x4f, 0x66, 0x20, 0x26, 0x26, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, - 0x6c, 0x61, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x20, - 0x3d, 0x3d, 0x3d, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x61, - 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x68, 0x61, 0x73, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3f, - 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x6c, 0x61, 0x73, 0x74, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x28, 0x69, 0x74, 0x65, 0x6d, 0x2c, - 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x29, 0x20, 0x3a, 0x20, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x2e, 0x6c, 0x61, 0x73, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, - 0x4f, 0x66, 0x28, 0x69, 0x74, 0x65, 0x6d, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x69, 0x20, 0x3d, 0x20, 0x28, 0x68, 0x61, 0x73, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x20, 0x3f, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x3a, 0x20, 0x61, - 0x72, 0x72, 0x61, 0x79, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, - 0x28, 0x69, 0x2d, 0x2d, 0x29, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x72, - 0x72, 0x61, 0x79, 0x5b, 0x69, 0x5d, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x69, - 0x74, 0x65, 0x6d, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x69, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x2d, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, - 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x69, - 0x74, 0x68, 0x6d, 0x65, 0x74, 0x69, 0x63, 0x20, 0x70, 0x72, 0x6f, 0x67, - 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x41, 0x20, 0x70, - 0x6f, 0x72, 0x74, 0x20, 0x6f, 0x66, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x50, - 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x20, 0x60, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x28, 0x29, 0x60, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x20, 0x53, 0x65, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x5b, - 0x74, 0x68, 0x65, 0x20, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x20, 0x64, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5d, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x64, 0x6f, 0x63, - 0x73, 0x2e, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x2e, 0x6f, 0x72, 0x67, - 0x2f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2f, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x23, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x73, 0x74, 0x61, 0x72, 0x74, 0x2c, 0x20, - 0x73, 0x74, 0x6f, 0x70, 0x2c, 0x20, 0x73, 0x74, 0x65, 0x70, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x72, - 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x20, 0x3c, 0x3d, 0x20, 0x31, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x3d, 0x20, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x7c, 0x7c, 0x20, 0x30, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, - 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x73, 0x74, 0x65, 0x70, 0x20, 0x3d, 0x20, 0x61, 0x72, - 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x32, 0x5d, 0x20, 0x7c, - 0x7c, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x6c, 0x65, 0x6e, 0x20, 0x3d, 0x20, 0x4d, 0x61, 0x74, 0x68, - 0x2e, 0x6d, 0x61, 0x78, 0x28, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x63, 0x65, - 0x69, 0x6c, 0x28, 0x28, 0x73, 0x74, 0x6f, 0x70, 0x20, 0x2d, 0x20, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x29, 0x20, 0x2f, 0x20, 0x73, 0x74, 0x65, 0x70, - 0x29, 0x2c, 0x20, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, - 0x61, 0x72, 0x20, 0x69, 0x64, 0x78, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x61, 0x6e, 0x67, - 0x65, 0x20, 0x3d, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x41, 0x72, 0x72, 0x61, - 0x79, 0x28, 0x6c, 0x65, 0x6e, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x28, 0x69, 0x64, 0x78, 0x20, 0x3c, - 0x20, 0x6c, 0x65, 0x6e, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5b, 0x69, 0x64, 0x78, 0x2b, - 0x2b, 0x5d, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, - 0x2b, 0x3d, 0x20, 0x73, 0x74, 0x65, 0x70, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x61, 0x68, 0x65, 0x6d, 0x29, - 0x20, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, - 0x61, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x62, - 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x67, 0x69, - 0x76, 0x65, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x28, - 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x60, 0x74, - 0x68, 0x69, 0x73, 0x60, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x72, - 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x6c, 0x79, - 0x29, 0x2e, 0x20, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x73, - 0x20, 0x74, 0x6f, 0x20, 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, 0x53, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, 0x20, 0x6e, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x60, 0x46, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x62, 0x69, 0x6e, 0x64, 0x60, 0x20, 0x69, 0x66, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, - 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x62, 0x69, 0x6e, - 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x66, 0x75, 0x6e, 0x63, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x64, 0x20, - 0x3d, 0x3d, 0x3d, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x42, 0x69, - 0x6e, 0x64, 0x20, 0x26, 0x26, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x42, 0x69, 0x6e, 0x64, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x2c, 0x20, - 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, - 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, 0x29, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, - 0x72, 0x67, 0x73, 0x20, 0x3d, 0x20, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, - 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x2c, 0x20, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x63, 0x6f, - 0x6e, 0x63, 0x61, 0x74, 0x28, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, - 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x50, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x61, 0x70, - 0x70, 0x6c, 0x79, 0x20, 0x61, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x62, 0x79, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6e, 0x67, 0x20, 0x61, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x68, 0x61, 0x73, 0x20, 0x68, 0x61, - 0x64, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, - 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x20, 0x70, 0x72, 0x65, 0x2d, 0x66, 0x69, 0x6c, - 0x6c, 0x65, 0x64, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, - 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x74, - 0x73, 0x20, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x20, 0x60, 0x74, - 0x68, 0x69, 0x73, 0x60, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x70, 0x61, 0x72, 0x74, 0x69, 0x61, - 0x6c, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x66, 0x75, 0x6e, 0x63, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x72, 0x67, 0x73, 0x20, 0x3d, 0x20, - 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, - 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x2e, 0x61, 0x70, 0x70, 0x6c, - 0x79, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x28, 0x73, 0x6c, 0x69, 0x63, - 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x42, 0x69, 0x6e, 0x64, 0x20, 0x61, 0x6c, 0x6c, 0x20, - 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x27, 0x73, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x74, - 0x6f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x20, 0x55, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x20, 0x66, 0x6f, - 0x72, 0x20, 0x65, 0x6e, 0x73, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6c, 0x6c, - 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x20, 0x64, - 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x61, 0x6e, - 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x62, 0x65, 0x6c, 0x6f, - 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x74, 0x2e, 0x0a, 0x20, 0x20, - 0x5f, 0x2e, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x73, 0x20, 0x3d, 0x20, 0x73, 0x6c, 0x69, 0x63, - 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x73, 0x2e, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x30, - 0x29, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x73, 0x20, 0x3d, 0x20, 0x5f, 0x2e, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x28, 0x6f, 0x62, - 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, - 0x28, 0x66, 0x75, 0x6e, 0x63, 0x73, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x66, 0x29, 0x20, 0x7b, 0x20, 0x6f, 0x62, - 0x6a, 0x5b, 0x66, 0x5d, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x62, 0x69, 0x6e, - 0x64, 0x28, 0x6f, 0x62, 0x6a, 0x5b, 0x66, 0x5d, 0x2c, 0x20, 0x6f, 0x62, - 0x6a, 0x29, 0x3b, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4d, - 0x65, 0x6d, 0x6f, 0x69, 0x7a, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x78, - 0x70, 0x65, 0x6e, 0x73, 0x69, 0x76, 0x65, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x62, 0x79, 0x20, 0x73, 0x74, 0x6f, 0x72, - 0x69, 0x6e, 0x67, 0x20, 0x69, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x69, 0x7a, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x2c, 0x20, 0x68, 0x61, - 0x73, 0x68, 0x65, 0x72, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x20, 0x3d, 0x20, 0x7b, - 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x73, 0x68, 0x65, - 0x72, 0x20, 0x7c, 0x7c, 0x20, 0x28, 0x68, 0x61, 0x73, 0x68, 0x65, 0x72, - 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x73, 0x68, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x74, 0x68, 0x69, - 0x73, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x68, 0x61, 0x73, 0x28, 0x6d, 0x65, - 0x6d, 0x6f, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x20, 0x3f, 0x20, 0x6d, - 0x65, 0x6d, 0x6f, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x20, 0x3a, 0x20, 0x28, - 0x6d, 0x65, 0x6d, 0x6f, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x74, - 0x68, 0x69, 0x73, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x44, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x20, 0x61, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, - 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, - 0x74, 0x68, 0x65, 0x6e, 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x2e, 0x0a, - 0x20, 0x20, 0x5f, 0x2e, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x66, 0x75, 0x6e, - 0x63, 0x2c, 0x20, 0x77, 0x61, 0x69, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x72, 0x67, 0x73, 0x20, - 0x3d, 0x20, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, - 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, - 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, - 0x7b, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x6e, 0x75, 0x6c, 0x6c, - 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, 0x29, 0x3b, 0x20, 0x7d, 0x2c, 0x20, - 0x77, 0x61, 0x69, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x66, 0x65, 0x72, 0x73, - 0x20, 0x61, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2c, - 0x20, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x69, 0x6e, 0x67, 0x20, - 0x69, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x61, 0x66, - 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x74, 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x20, 0x73, 0x74, 0x61, - 0x63, 0x6b, 0x20, 0x68, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x63, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x5f, - 0x2e, 0x64, 0x65, 0x66, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x5f, 0x2e, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, - 0x6c, 0x79, 0x28, 0x5f, 0x2c, 0x20, 0x5b, 0x66, 0x75, 0x6e, 0x63, 0x2c, - 0x20, 0x31, 0x5d, 0x2e, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x28, 0x73, - 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, - 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, 0x29, 0x29, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, - 0x61, 0x74, 0x2c, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x69, 0x6e, 0x76, - 0x6f, 0x6b, 0x65, 0x64, 0x2c, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6f, - 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x74, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x65, 0x64, 0x20, 0x61, 0x74, 0x20, 0x6d, 0x6f, 0x73, 0x74, - 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, - 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, - 0x6e, 0x20, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x6f, 0x66, 0x20, - 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x74, 0x68, - 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x2c, 0x20, - 0x77, 0x61, 0x69, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, - 0x20, 0x61, 0x72, 0x67, 0x73, 0x2c, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x2c, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x70, 0x72, 0x65, 0x76, - 0x69, 0x6f, 0x75, 0x73, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x20, - 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x72, 0x65, - 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x3d, 0x20, 0x6e, 0x65, 0x77, 0x20, - 0x44, 0x61, 0x74, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x6e, 0x75, - 0x6c, 0x6c, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, - 0x61, 0x72, 0x20, 0x6e, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x6e, 0x65, 0x77, - 0x20, 0x44, 0x61, 0x74, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, - 0x6e, 0x67, 0x20, 0x3d, 0x20, 0x77, 0x61, 0x69, 0x74, 0x20, 0x2d, 0x20, - 0x28, 0x6e, 0x6f, 0x77, 0x20, 0x2d, 0x20, 0x70, 0x72, 0x65, 0x76, 0x69, - 0x6f, 0x75, 0x73, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x3d, 0x20, 0x74, 0x68, - 0x69, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x72, - 0x67, 0x73, 0x20, 0x3d, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, - 0x3c, 0x3d, 0x20, 0x30, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x54, 0x69, 0x6d, - 0x65, 0x6f, 0x75, 0x74, 0x28, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x6e, 0x75, 0x6c, - 0x6c, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, - 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x3d, 0x20, 0x6e, 0x6f, - 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, 0x29, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x21, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x73, 0x65, - 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x28, 0x6c, 0x61, 0x74, - 0x65, 0x72, 0x2c, 0x20, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, - 0x67, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x2c, 0x20, 0x61, 0x73, 0x20, 0x6c, 0x6f, 0x6e, 0x67, - 0x20, 0x61, 0x73, 0x20, 0x69, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, - 0x6e, 0x75, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x69, - 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x2c, 0x20, 0x77, 0x69, 0x6c, 0x6c, - 0x20, 0x6e, 0x6f, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x65, - 0x20, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x65, 0x64, 0x2e, 0x20, - 0x54, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x63, 0x61, 0x6c, - 0x6c, 0x65, 0x64, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x69, 0x74, - 0x20, 0x73, 0x74, 0x6f, 0x70, 0x73, 0x20, 0x62, 0x65, 0x69, 0x6e, 0x67, - 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x20, 0x6d, 0x69, 0x6c, 0x6c, 0x69, - 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2e, 0x20, 0x49, 0x66, 0x20, - 0x60, 0x69, 0x6d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x60, 0x20, - 0x69, 0x73, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x2c, 0x20, 0x74, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x74, - 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6c, 0x65, 0x61, 0x64, - 0x69, 0x6e, 0x67, 0x20, 0x65, 0x64, 0x67, 0x65, 0x2c, 0x20, 0x69, 0x6e, - 0x73, 0x74, 0x65, 0x61, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x64, 0x65, 0x62, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x20, - 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x66, - 0x75, 0x6e, 0x63, 0x2c, 0x20, 0x77, 0x61, 0x69, 0x74, 0x2c, 0x20, 0x69, - 0x6d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x29, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x74, 0x69, 0x6d, 0x65, - 0x6f, 0x75, 0x74, 0x2c, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x3d, 0x20, 0x74, 0x68, 0x69, - 0x73, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, 0x20, 0x3d, 0x20, 0x61, 0x72, - 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x72, - 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x6e, 0x75, - 0x6c, 0x6c, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x21, 0x69, 0x6d, 0x6d, 0x65, 0x64, 0x69, 0x61, - 0x74, 0x65, 0x29, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x61, 0x72, 0x67, - 0x73, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, - 0x61, 0x6c, 0x6c, 0x4e, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x69, 0x6d, 0x6d, - 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x20, 0x26, 0x26, 0x20, 0x21, 0x74, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x28, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x20, 0x3d, 0x20, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, - 0x6f, 0x75, 0x74, 0x28, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x2c, 0x20, 0x77, - 0x61, 0x69, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x63, 0x61, 0x6c, 0x6c, 0x4e, 0x6f, 0x77, 0x29, - 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, - 0x61, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, - 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x20, 0x61, 0x74, 0x20, - 0x6d, 0x6f, 0x73, 0x74, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x74, 0x69, 0x6d, - 0x65, 0x2c, 0x20, 0x6e, 0x6f, 0x20, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x20, 0x68, 0x6f, 0x77, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x66, - 0x74, 0x65, 0x6e, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61, 0x6c, 0x6c, - 0x20, 0x69, 0x74, 0x2e, 0x20, 0x55, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x20, - 0x66, 0x6f, 0x72, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6f, 0x6e, 0x63, 0x65, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x66, 0x75, 0x6e, - 0x63, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, - 0x20, 0x72, 0x61, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x2c, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x72, 0x61, 0x6e, 0x29, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x61, 0x6e, 0x20, 0x3d, 0x20, - 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x6d, 0x65, 0x6d, 0x6f, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2c, 0x20, - 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x20, 0x3d, - 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x65, 0x6d, 0x6f, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, - 0x74, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, - 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, - 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x2c, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, - 0x67, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x64, 0x6a, - 0x75, 0x73, 0x74, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x2c, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, - 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, - 0x66, 0x74, 0x65, 0x72, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, - 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, - 0x20, 0x20, 0x5f, 0x2e, 0x77, 0x72, 0x61, 0x70, 0x20, 0x3d, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x66, 0x75, 0x6e, 0x63, - 0x2c, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, - 0x72, 0x67, 0x73, 0x20, 0x3d, 0x20, 0x5b, 0x66, 0x75, 0x6e, 0x63, 0x5d, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x75, 0x73, 0x68, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x61, 0x72, 0x67, 0x73, 0x2c, - 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x70, 0x6c, 0x79, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2c, 0x20, 0x61, 0x72, - 0x67, 0x73, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, - 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x6c, - 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x65, 0x61, 0x63, 0x68, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x69, 0x6e, - 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, - 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x73, 0x20, 0x3d, 0x20, 0x61, 0x72, 0x67, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x72, 0x67, 0x73, 0x20, 0x3d, 0x20, - 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, - 0x72, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x73, 0x2e, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x2d, 0x20, 0x31, 0x3b, 0x20, - 0x69, 0x20, 0x3e, 0x3d, 0x20, 0x30, 0x3b, 0x20, 0x69, 0x2d, 0x2d, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, - 0x72, 0x67, 0x73, 0x20, 0x3d, 0x20, 0x5b, 0x66, 0x75, 0x6e, 0x63, 0x73, - 0x5b, 0x69, 0x5d, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x74, 0x68, - 0x69, 0x73, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, 0x29, 0x5d, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x72, 0x67, - 0x73, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, - 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, - 0x20, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x20, 0x61, 0x66, - 0x74, 0x65, 0x72, 0x20, 0x62, 0x65, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x61, - 0x6c, 0x6c, 0x65, 0x64, 0x20, 0x4e, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, - 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x20, 0x3c, 0x3d, 0x20, 0x30, 0x29, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x28, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x2d, - 0x2d, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x20, 0x3c, 0x20, 0x31, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x2e, 0x61, 0x70, - 0x70, 0x6c, 0x79, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2c, 0x20, 0x61, 0x72, - 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x46, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2d, 0x2d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, - 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x27, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x6f, - 0x20, 0x2a, 0x2a, 0x45, 0x43, 0x4d, 0x41, 0x53, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x20, 0x35, 0x2a, 0x2a, 0x27, 0x73, 0x20, 0x6e, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x20, 0x60, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x6b, - 0x65, 0x79, 0x73, 0x60, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6b, 0x65, 0x79, - 0x73, 0x20, 0x3d, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4b, 0x65, - 0x79, 0x73, 0x20, 0x7c, 0x7c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x21, 0x3d, - 0x3d, 0x20, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x28, 0x6f, 0x62, 0x6a, - 0x29, 0x29, 0x20, 0x74, 0x68, 0x72, 0x6f, 0x77, 0x20, 0x6e, 0x65, 0x77, - 0x20, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x27, - 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x27, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, - 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, 0x68, 0x61, 0x73, 0x28, - 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x29, 0x20, 0x6b, - 0x65, 0x79, 0x73, 0x5b, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x5d, 0x20, 0x3d, 0x20, 0x6b, 0x65, 0x79, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6b, - 0x65, 0x79, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, - 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x27, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, - 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x3d, - 0x20, 0x5b, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, - 0x20, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, - 0x68, 0x61, 0x73, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x6b, 0x65, 0x79, - 0x29, 0x29, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x70, 0x75, - 0x73, 0x68, 0x28, 0x6f, 0x62, 0x6a, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x29, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6e, 0x76, - 0x65, 0x72, 0x74, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x6c, 0x69, 0x73, - 0x74, 0x20, 0x6f, 0x66, 0x20, 0x60, 0x5b, 0x6b, 0x65, 0x79, 0x2c, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5d, 0x60, 0x20, 0x70, 0x61, 0x69, 0x72, - 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x70, 0x61, 0x69, 0x72, 0x73, - 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, - 0x61, 0x72, 0x20, 0x70, 0x61, 0x69, 0x72, 0x73, 0x20, 0x3d, 0x20, 0x5b, - 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, - 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6f, - 0x62, 0x6a, 0x29, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, 0x68, 0x61, - 0x73, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x29, - 0x20, 0x70, 0x61, 0x69, 0x72, 0x73, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x28, - 0x5b, 0x6b, 0x65, 0x79, 0x2c, 0x20, 0x6f, 0x62, 0x6a, 0x5b, 0x6b, 0x65, - 0x79, 0x5d, 0x5d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x70, 0x61, 0x69, 0x72, 0x73, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, - 0x6e, 0x76, 0x65, 0x72, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6b, 0x65, - 0x79, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x73, - 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x62, 0x6c, 0x65, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x20, - 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, - 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x7b, - 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, - 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6f, - 0x62, 0x6a, 0x29, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, 0x68, 0x61, - 0x73, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x29, - 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5b, 0x6f, 0x62, 0x6a, 0x5b, - 0x6b, 0x65, 0x79, 0x5d, 0x5d, 0x20, 0x3d, 0x20, 0x6b, 0x65, 0x79, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x61, 0x20, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x6c, - 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x20, - 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x69, 0x61, - 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x60, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x73, 0x60, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, - 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, - 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, - 0x62, 0x6a, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x29, 0x29, 0x20, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x28, 0x6b, 0x65, 0x79, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x2e, 0x73, 0x6f, 0x72, 0x74, 0x28, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x64, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, - 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x61, - 0x73, 0x73, 0x65, 0x64, 0x2d, 0x69, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x28, 0x73, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x73, 0x6c, 0x69, - 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, 0x29, 0x2c, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, - 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x20, - 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, - 0x62, 0x6a, 0x5b, 0x70, 0x72, 0x6f, 0x70, 0x5d, 0x20, 0x3d, 0x20, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5b, 0x70, 0x72, 0x6f, 0x70, 0x5d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x61, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x6f, 0x6e, - 0x6c, 0x79, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, - 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, - 0x69, 0x73, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x70, 0x69, - 0x63, 0x6b, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x3d, 0x20, - 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x6b, 0x65, 0x79, 0x73, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6e, 0x63, 0x61, - 0x74, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x41, 0x72, 0x72, 0x61, - 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2c, 0x20, 0x73, 0x6c, 0x69, 0x63, - 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, 0x29, 0x29, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x6b, 0x65, 0x79, 0x73, - 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6b, - 0x65, 0x79, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6f, - 0x62, 0x6a, 0x29, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x5b, 0x6b, 0x65, 0x79, - 0x5d, 0x20, 0x3d, 0x20, 0x6f, 0x62, 0x6a, 0x5b, 0x6b, 0x65, 0x79, 0x5d, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x63, 0x6f, 0x70, - 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x20, - 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, - 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6c, 0x61, 0x63, 0x6b, - 0x6c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6f, - 0x6d, 0x69, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x3d, - 0x20, 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, - 0x20, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6e, 0x63, - 0x61, 0x74, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x41, 0x72, 0x72, - 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2c, 0x20, 0x73, 0x6c, 0x69, - 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, 0x29, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, - 0x20, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x21, 0x5f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, - 0x28, 0x6b, 0x65, 0x79, 0x73, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x29, - 0x20, 0x63, 0x6f, 0x70, 0x79, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x20, 0x3d, - 0x20, 0x6f, 0x62, 0x6a, 0x5b, 0x6b, 0x65, 0x79, 0x5d, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x6c, - 0x6c, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, - 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, - 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x5f, - 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, - 0x28, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, - 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x31, - 0x29, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x70, - 0x72, 0x6f, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x5b, 0x70, - 0x72, 0x6f, 0x70, 0x5d, 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, - 0x29, 0x20, 0x6f, 0x62, 0x6a, 0x5b, 0x70, 0x72, 0x6f, 0x70, 0x5d, 0x20, - 0x3d, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5b, 0x70, 0x72, 0x6f, - 0x70, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x28, 0x73, 0x68, 0x61, 0x6c, 0x6c, - 0x6f, 0x77, 0x2d, 0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x64, 0x29, 0x20, 0x64, - 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x66, 0x20, - 0x61, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x20, 0x3d, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, - 0x5f, 0x2e, 0x69, 0x73, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x28, 0x6f, - 0x62, 0x6a, 0x29, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x6f, 0x62, 0x6a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, - 0x79, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x3f, 0x20, 0x6f, 0x62, 0x6a, - 0x2e, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x28, 0x29, 0x20, 0x3a, 0x20, 0x5f, - 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x28, 0x7b, 0x7d, 0x2c, 0x20, - 0x6f, 0x62, 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x73, - 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x65, 0x70, 0x74, 0x6f, 0x72, - 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x62, - 0x6a, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x6f, 0x62, 0x6a, 0x2e, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x72, - 0x69, 0x6d, 0x61, 0x72, 0x79, 0x20, 0x70, 0x75, 0x72, 0x70, 0x6f, 0x73, - 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x20, 0x69, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x22, - 0x74, 0x61, 0x70, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x22, 0x20, 0x61, 0x20, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x2c, 0x20, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x72, - 0x64, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x65, 0x72, 0x66, 0x6f, - 0x72, 0x6d, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x20, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, - 0x64, 0x69, 0x61, 0x74, 0x65, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, - 0x74, 0x61, 0x70, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x63, 0x65, 0x70, 0x74, 0x6f, 0x72, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x65, 0x70, 0x74, - 0x6f, 0x72, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x72, 0x65, 0x63, - 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, - 0x72, 0x69, 0x73, 0x6f, 0x6e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x69, 0x73, 0x45, 0x71, - 0x75, 0x61, 0x6c, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x65, 0x71, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x61, 0x2c, 0x20, 0x62, 0x2c, 0x20, 0x61, 0x53, 0x74, 0x61, - 0x63, 0x6b, 0x2c, 0x20, 0x62, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x65, 0x71, 0x75, 0x61, 0x6c, - 0x2e, 0x20, 0x60, 0x30, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x2d, 0x30, 0x60, - 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x61, - 0x72, 0x65, 0x6e, 0x27, 0x74, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x6c, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x48, 0x61, 0x72, 0x6d, - 0x6f, 0x6e, 0x79, 0x20, 0x60, 0x65, 0x67, 0x61, 0x6c, 0x60, 0x20, 0x70, - 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x3a, 0x20, 0x68, 0x74, 0x74, - 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x69, 0x6b, 0x69, 0x2e, 0x65, 0x63, 0x6d, - 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2e, 0x6f, 0x72, 0x67, 0x2f, - 0x64, 0x6f, 0x6b, 0x75, 0x2e, 0x70, 0x68, 0x70, 0x3f, 0x69, 0x64, 0x3d, - 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x3a, 0x65, 0x67, 0x61, 0x6c, - 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x20, - 0x3d, 0x3d, 0x3d, 0x20, 0x62, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x61, 0x20, 0x21, 0x3d, 0x3d, 0x20, 0x30, 0x20, 0x7c, 0x7c, - 0x20, 0x31, 0x20, 0x2f, 0x20, 0x61, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x20, - 0x2f, 0x20, 0x62, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x41, 0x20, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x20, 0x63, 0x6f, 0x6d, - 0x70, 0x61, 0x72, 0x69, 0x73, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x6e, - 0x65, 0x63, 0x65, 0x73, 0x73, 0x61, 0x72, 0x79, 0x20, 0x62, 0x65, 0x63, - 0x61, 0x75, 0x73, 0x65, 0x20, 0x60, 0x6e, 0x75, 0x6c, 0x6c, 0x20, 0x3d, - 0x3d, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x60, - 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x20, - 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x20, 0x7c, 0x7c, 0x20, 0x62, - 0x20, 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x62, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x6e, 0x77, - 0x72, 0x61, 0x70, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x77, 0x72, 0x61, 0x70, - 0x70, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x20, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x6f, 0x66, 0x20, 0x5f, 0x29, - 0x20, 0x61, 0x20, 0x3d, 0x20, 0x61, 0x2e, 0x5f, 0x77, 0x72, 0x61, 0x70, - 0x70, 0x65, 0x64, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x62, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x6f, - 0x66, 0x20, 0x5f, 0x29, 0x20, 0x62, 0x20, 0x3d, 0x20, 0x62, 0x2e, 0x5f, - 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, 0x20, - 0x60, 0x5b, 0x5b, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x5d, 0x5d, 0x60, 0x20, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, - 0x61, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x4e, 0x61, 0x6d, 0x65, - 0x20, 0x3d, 0x20, 0x74, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, - 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x4e, 0x61, - 0x6d, 0x65, 0x20, 0x21, 0x3d, 0x20, 0x74, 0x6f, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x62, 0x29, 0x29, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, - 0x20, 0x28, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x2c, 0x20, 0x6e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x73, 0x2c, 0x20, 0x64, 0x61, 0x74, 0x65, 0x73, 0x2c, - 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, - 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, - 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, - 0x27, 0x5b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x5d, 0x27, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, - 0x69, 0x72, 0x20, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, - 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x20, 0x61, 0x72, 0x65, - 0x20, 0x65, 0x71, 0x75, 0x69, 0x76, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x3b, - 0x20, 0x74, 0x68, 0x75, 0x73, 0x2c, 0x20, 0x60, 0x22, 0x35, 0x22, 0x60, - 0x20, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x65, 0x71, 0x75, 0x69, 0x76, 0x61, 0x6c, 0x65, 0x6e, - 0x74, 0x20, 0x74, 0x6f, 0x20, 0x60, 0x6e, 0x65, 0x77, 0x20, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x28, 0x22, 0x35, 0x22, 0x29, 0x60, 0x2e, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x61, 0x20, 0x3d, 0x3d, 0x20, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x28, 0x62, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x27, 0x5b, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x20, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5d, 0x27, 0x3a, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x60, 0x4e, 0x61, 0x4e, 0x60, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x65, - 0x71, 0x75, 0x69, 0x76, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x62, - 0x75, 0x74, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x72, 0x65, 0x66, 0x6c, 0x65, - 0x78, 0x69, 0x76, 0x65, 0x2e, 0x20, 0x41, 0x6e, 0x20, 0x60, 0x65, 0x67, - 0x61, 0x6c, 0x60, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x69, 0x73, - 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x70, 0x65, 0x72, 0x66, 0x6f, 0x72, - 0x6d, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, - 0x20, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x20, 0x21, 0x3d, - 0x20, 0x2b, 0x61, 0x20, 0x3f, 0x20, 0x62, 0x20, 0x21, 0x3d, 0x20, 0x2b, - 0x62, 0x20, 0x3a, 0x20, 0x28, 0x61, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x20, - 0x3f, 0x20, 0x31, 0x20, 0x2f, 0x20, 0x61, 0x20, 0x3d, 0x3d, 0x20, 0x31, - 0x20, 0x2f, 0x20, 0x62, 0x20, 0x3a, 0x20, 0x61, 0x20, 0x3d, 0x3d, 0x20, - 0x2b, 0x62, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, - 0x61, 0x73, 0x65, 0x20, 0x27, 0x5b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x20, 0x44, 0x61, 0x74, 0x65, 0x5d, 0x27, 0x3a, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x27, 0x5b, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x20, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, - 0x5d, 0x27, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x65, 0x72, 0x63, 0x65, 0x20, 0x64, 0x61, - 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x6f, 0x6f, 0x6c, - 0x65, 0x61, 0x6e, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x6e, 0x75, 0x6d, 0x65, - 0x72, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, - 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x20, 0x44, 0x61, - 0x74, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, - 0x61, 0x72, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x69, - 0x72, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, - 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, - 0x68, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, - 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6d, - 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x72, - 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x6f, 0x66, 0x20, 0x60, 0x4e, 0x61, 0x4e, 0x60, 0x20, 0x61, - 0x72, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x71, 0x75, 0x69, 0x76, - 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x2b, 0x61, - 0x20, 0x3d, 0x3d, 0x20, 0x2b, 0x62, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x67, 0x45, 0x78, 0x70, 0x73, - 0x20, 0x61, 0x72, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, - 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x69, 0x72, 0x20, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x6c, 0x61, 0x67, 0x73, - 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, - 0x20, 0x27, 0x5b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x52, 0x65, - 0x67, 0x45, 0x78, 0x70, 0x5d, 0x27, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, - 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x62, - 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x26, 0x26, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x61, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x3d, - 0x3d, 0x20, 0x62, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x26, - 0x26, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x62, 0x2e, 0x6d, 0x75, - 0x6c, 0x74, 0x69, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x26, 0x26, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x61, 0x2e, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x43, 0x61, - 0x73, 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x62, 0x2e, 0x69, 0x67, 0x6e, 0x6f, - 0x72, 0x65, 0x43, 0x61, 0x73, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x79, - 0x70, 0x65, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x21, 0x3d, 0x20, 0x27, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x27, 0x20, 0x7c, 0x7c, 0x20, 0x74, 0x79, - 0x70, 0x65, 0x6f, 0x66, 0x20, 0x62, 0x20, 0x21, 0x3d, 0x20, 0x27, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x27, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x20, - 0x65, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x63, 0x79, 0x63, 0x6c, 0x69, 0x63, 0x20, 0x73, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, - 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x20, 0x66, 0x6f, - 0x72, 0x20, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x20, - 0x63, 0x79, 0x63, 0x6c, 0x69, 0x63, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x73, - 0x20, 0x69, 0x73, 0x20, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x64, 0x20, - 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x45, 0x53, 0x20, 0x35, 0x2e, 0x31, 0x20, - 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x35, 0x2e, 0x31, - 0x32, 0x2e, 0x33, 0x2c, 0x20, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, - 0x74, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, - 0x60, 0x4a, 0x4f, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, - 0x72, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x61, - 0x53, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, - 0x28, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2d, 0x2d, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4c, 0x69, - 0x6e, 0x65, 0x61, 0x72, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, - 0x20, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, - 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x6c, - 0x79, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, - 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x5b, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5d, 0x20, 0x3d, 0x3d, 0x20, 0x61, - 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x62, 0x53, 0x74, - 0x61, 0x63, 0x6b, 0x5b, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5d, 0x20, - 0x3d, 0x3d, 0x20, 0x62, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x64, 0x64, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, - 0x74, 0x61, 0x63, 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x72, 0x61, 0x76, - 0x65, 0x72, 0x73, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x61, 0x53, 0x74, 0x61, 0x63, - 0x6b, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x28, 0x61, 0x29, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x62, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x70, 0x75, - 0x73, 0x68, 0x28, 0x62, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, - 0x61, 0x72, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x3d, 0x20, 0x30, 0x2c, - 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x74, 0x72, - 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, - 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x6c, 0x79, 0x20, 0x63, - 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, - 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x3d, 0x20, - 0x27, 0x5b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x41, 0x72, 0x72, - 0x61, 0x79, 0x5d, 0x27, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, - 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x65, 0x20, 0x69, 0x66, 0x20, 0x61, 0x20, 0x64, 0x65, 0x65, - 0x70, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x69, 0x73, 0x6f, 0x6e, - 0x20, 0x69, 0x73, 0x20, 0x6e, 0x65, 0x63, 0x65, 0x73, 0x73, 0x61, 0x72, - 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x69, 0x7a, - 0x65, 0x20, 0x3d, 0x20, 0x61, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x3d, 0x3d, - 0x20, 0x62, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x65, 0x70, 0x20, 0x63, - 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x69, 0x67, 0x6e, - 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x6e, 0x75, - 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x28, 0x73, 0x69, 0x7a, - 0x65, 0x2d, 0x2d, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x21, 0x28, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x65, 0x71, 0x28, 0x61, - 0x5b, 0x73, 0x69, 0x7a, 0x65, 0x5d, 0x2c, 0x20, 0x62, 0x5b, 0x73, 0x69, - 0x7a, 0x65, 0x5d, 0x2c, 0x20, 0x61, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x2c, - 0x20, 0x62, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x29, 0x29, 0x29, 0x20, 0x62, - 0x72, 0x65, 0x61, 0x6b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x64, - 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x63, 0x6f, 0x6e, - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x61, 0x72, - 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x71, 0x75, 0x69, 0x76, 0x61, - 0x6c, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x60, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x60, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x64, 0x69, - 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x66, 0x72, 0x61, 0x6d, - 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x43, 0x74, 0x6f, 0x72, 0x20, - 0x3d, 0x20, 0x61, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x62, 0x43, 0x74, 0x6f, 0x72, 0x20, 0x3d, - 0x20, 0x62, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x6f, 0x72, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x61, 0x43, 0x74, 0x6f, 0x72, 0x20, 0x21, 0x3d, 0x3d, 0x20, - 0x62, 0x43, 0x74, 0x6f, 0x72, 0x20, 0x26, 0x26, 0x20, 0x21, 0x28, 0x5f, - 0x2e, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x61, 0x43, 0x74, 0x6f, 0x72, 0x29, 0x20, 0x26, 0x26, 0x20, 0x28, 0x61, - 0x43, 0x74, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x6f, 0x66, 0x20, 0x61, 0x43, 0x74, 0x6f, 0x72, 0x29, 0x20, 0x26, - 0x26, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x2e, 0x69, - 0x73, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x62, 0x43, - 0x74, 0x6f, 0x72, 0x29, 0x20, 0x26, 0x26, 0x20, 0x28, 0x62, 0x43, 0x74, - 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x6f, - 0x66, 0x20, 0x62, 0x43, 0x74, 0x6f, 0x72, 0x29, 0x29, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x65, 0x70, 0x20, 0x63, 0x6f, 0x6d, - 0x70, 0x61, 0x72, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, - 0x28, 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, - 0x61, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, 0x68, 0x61, 0x73, 0x28, 0x61, - 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x78, 0x70, - 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x20, 0x6f, 0x66, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, - 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x2b, 0x2b, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, - 0x65, 0x65, 0x70, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x65, 0x20, - 0x65, 0x61, 0x63, 0x68, 0x20, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, - 0x66, 0x20, 0x28, 0x21, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, - 0x3d, 0x20, 0x5f, 0x2e, 0x68, 0x61, 0x73, 0x28, 0x62, 0x2c, 0x20, 0x6b, - 0x65, 0x79, 0x29, 0x20, 0x26, 0x26, 0x20, 0x65, 0x71, 0x28, 0x61, 0x5b, - 0x6b, 0x65, 0x79, 0x5d, 0x2c, 0x20, 0x62, 0x5b, 0x6b, 0x65, 0x79, 0x5d, - 0x2c, 0x20, 0x61, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x2c, 0x20, 0x62, 0x53, - 0x74, 0x61, 0x63, 0x6b, 0x29, 0x29, 0x29, 0x20, 0x62, 0x72, 0x65, 0x61, - 0x6b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x73, 0x75, 0x72, 0x65, - 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x62, 0x6f, 0x74, 0x68, 0x20, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, - 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x70, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x6b, 0x65, 0x79, 0x20, 0x69, - 0x6e, 0x20, 0x62, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, 0x68, - 0x61, 0x73, 0x28, 0x62, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x20, 0x26, - 0x26, 0x20, 0x21, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x2d, 0x2d, 0x29, 0x29, - 0x20, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x21, - 0x73, 0x69, 0x7a, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x73, 0x74, 0x61, 0x63, 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x72, 0x61, - 0x76, 0x65, 0x72, 0x73, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x61, 0x53, 0x74, 0x61, - 0x63, 0x6b, 0x2e, 0x70, 0x6f, 0x70, 0x28, 0x29, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x62, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x70, 0x6f, 0x70, - 0x28, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x3b, 0x0a, 0x20, - 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x50, 0x65, - 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x61, 0x20, 0x64, 0x65, 0x65, 0x70, - 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x69, 0x73, 0x6f, 0x6e, 0x20, - 0x74, 0x6f, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x69, 0x66, 0x20, - 0x74, 0x77, 0x6f, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x20, - 0x61, 0x72, 0x65, 0x20, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x2e, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x20, 0x3d, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x61, 0x2c, - 0x20, 0x62, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x71, 0x28, 0x61, 0x2c, 0x20, 0x62, - 0x2c, 0x20, 0x5b, 0x5d, 0x2c, 0x20, 0x5b, 0x5d, 0x29, 0x3b, 0x0a, 0x20, - 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, - 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x2c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2c, 0x20, - 0x6f, 0x72, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6e, - 0x20, 0x22, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x20, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x20, 0x68, 0x61, 0x73, 0x20, 0x6e, 0x6f, 0x20, 0x65, - 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x6f, 0x77, - 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x20, 0x6e, - 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x5f, 0x2e, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x28, - 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7c, 0x7c, 0x20, 0x5f, 0x2e, 0x69, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x29, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x2e, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x30, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, - 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x62, - 0x6a, 0x29, 0x20, 0x69, 0x66, 0x20, 0x28, 0x5f, 0x2e, 0x68, 0x61, 0x73, - 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x29, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x61, 0x20, 0x67, - 0x69, 0x76, 0x65, 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x61, - 0x20, 0x44, 0x4f, 0x4d, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x3f, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x45, 0x6c, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x21, 0x21, 0x28, - 0x6f, 0x62, 0x6a, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x6e, - 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d, 0x3d, 0x20, - 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, - 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x61, - 0x72, 0x72, 0x61, 0x79, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, - 0x45, 0x43, 0x4d, 0x41, 0x35, 0x27, 0x73, 0x20, 0x6e, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x69, 0x73, 0x41, - 0x72, 0x72, 0x61, 0x79, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x41, - 0x72, 0x72, 0x61, 0x79, 0x20, 0x3d, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, - 0x65, 0x49, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x20, 0x7c, 0x7c, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x74, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, - 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x3d, 0x3d, - 0x20, 0x27, 0x5b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x41, 0x72, - 0x72, 0x61, 0x79, 0x5d, 0x27, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x61, 0x20, 0x67, - 0x69, 0x76, 0x65, 0x6e, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x3f, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x20, 0x3d, - 0x3d, 0x3d, 0x20, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x28, 0x6f, 0x62, - 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x41, 0x64, 0x64, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, - 0x69, 0x73, 0x54, 0x79, 0x70, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x73, 0x3a, 0x20, 0x69, 0x73, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x69, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x2c, 0x20, 0x69, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2c, - 0x20, 0x69, 0x73, 0x44, 0x61, 0x74, 0x65, 0x2c, 0x20, 0x69, 0x73, 0x52, - 0x65, 0x67, 0x45, 0x78, 0x70, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x61, 0x63, - 0x68, 0x28, 0x5b, 0x27, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x27, 0x2c, 0x20, 0x27, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x27, 0x2c, 0x20, 0x27, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x27, - 0x2c, 0x20, 0x27, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27, 0x2c, 0x20, - 0x27, 0x44, 0x61, 0x74, 0x65, 0x27, 0x2c, 0x20, 0x27, 0x52, 0x65, 0x67, - 0x45, 0x78, 0x70, 0x27, 0x5d, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x29, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x5f, 0x5b, 0x27, 0x69, 0x73, 0x27, 0x20, 0x2b, - 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x5d, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x74, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x63, - 0x61, 0x6c, 0x6c, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x3d, 0x3d, 0x20, - 0x27, 0x5b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x27, 0x20, 0x2b, - 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x2b, 0x20, 0x27, 0x5d, 0x27, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x29, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x66, 0x69, - 0x6e, 0x65, 0x20, 0x61, 0x20, 0x66, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, - 0x6b, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, - 0x69, 0x6e, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x73, 0x20, - 0x28, 0x61, 0x68, 0x65, 0x6d, 0x2c, 0x20, 0x49, 0x45, 0x29, 0x2c, 0x20, - 0x77, 0x68, 0x65, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, - 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x61, - 0x6e, 0x79, 0x20, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x20, 0x22, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x69, - 0x66, 0x20, 0x28, 0x21, 0x5f, 0x2e, 0x69, 0x73, 0x41, 0x72, 0x67, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x28, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x5f, 0x2e, 0x69, 0x73, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x21, 0x21, 0x28, - 0x6f, 0x62, 0x6a, 0x20, 0x26, 0x26, 0x20, 0x5f, 0x2e, 0x68, 0x61, 0x73, - 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x27, 0x63, 0x61, 0x6c, 0x6c, 0x65, - 0x65, 0x27, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4f, - 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x20, 0x60, 0x69, 0x73, 0x46, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x60, 0x20, 0x69, 0x66, 0x20, - 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70, 0x72, 0x69, 0x61, 0x74, 0x65, 0x2e, - 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x79, 0x70, 0x65, 0x6f, - 0x66, 0x20, 0x28, 0x2f, 0x2e, 0x2f, 0x29, 0x20, 0x21, 0x3d, 0x3d, 0x20, - 0x27, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x27, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x46, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x6f, 0x62, 0x6a, - 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x27, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x27, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, - 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x20, 0x61, 0x20, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x65, - 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x3f, 0x0a, 0x20, 0x20, 0x5f, - 0x2e, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x74, 0x65, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x74, 0x65, 0x28, - 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x26, 0x26, 0x20, 0x21, 0x69, 0x73, 0x4e, - 0x61, 0x4e, 0x28, 0x70, 0x61, 0x72, 0x73, 0x65, 0x46, 0x6c, 0x6f, 0x61, - 0x74, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x20, 0x60, 0x4e, 0x61, 0x4e, 0x60, 0x3f, 0x20, 0x28, 0x4e, - 0x61, 0x4e, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x6e, - 0x6c, 0x79, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x77, 0x68, - 0x69, 0x63, 0x68, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, - 0x20, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x20, 0x69, 0x74, 0x73, 0x65, 0x6c, - 0x66, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x4e, 0x61, - 0x4e, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x26, - 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x20, 0x21, 0x3d, 0x20, 0x2b, 0x6f, 0x62, - 0x6a, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x49, 0x73, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x61, 0x20, 0x62, 0x6f, 0x6f, - 0x6c, 0x65, 0x61, 0x6e, 0x3f, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x73, - 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x74, 0x72, 0x75, - 0x65, 0x20, 0x7c, 0x7c, 0x20, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x3d, - 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x20, 0x7c, 0x7c, 0x20, 0x74, 0x6f, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, - 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x5b, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x20, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, - 0x5d, 0x27, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, 0x65, - 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x65, 0x71, 0x75, 0x61, - 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x3f, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x6e, - 0x75, 0x6c, 0x6c, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x61, 0x20, 0x67, 0x69, 0x76, - 0x65, 0x6e, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x20, - 0x75, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x3f, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, - 0x65, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x20, - 0x3d, 0x3d, 0x3d, 0x20, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x30, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, - 0x68, 0x6f, 0x72, 0x74, 0x63, 0x75, 0x74, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x66, 0x20, 0x61, 0x6e, 0x20, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, - 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x79, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6c, 0x79, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x6e, 0x20, 0x69, 0x74, 0x73, - 0x65, 0x6c, 0x66, 0x20, 0x28, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65, - 0x72, 0x20, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x2c, 0x20, 0x6e, 0x6f, 0x74, - 0x20, 0x6f, 0x6e, 0x20, 0x61, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, - 0x79, 0x70, 0x65, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x68, 0x61, - 0x73, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x2c, 0x20, 0x6b, 0x65, 0x79, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x68, 0x61, 0x73, 0x4f, 0x77, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x79, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6f, 0x62, 0x6a, 0x2c, - 0x20, 0x6b, 0x65, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x74, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x20, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x75, 0x6e, 0x20, 0x55, 0x6e, 0x64, - 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x6a, 0x73, 0x20, 0x69, - 0x6e, 0x20, 0x2a, 0x6e, 0x6f, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, - 0x74, 0x2a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x60, - 0x5f, 0x60, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x20, - 0x74, 0x6f, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x6f, 0x77, 0x6e, - 0x65, 0x72, 0x2e, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, - 0x61, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x20, - 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x55, 0x6e, 0x64, 0x65, 0x72, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6e, 0x6f, 0x43, 0x6f, 0x6e, 0x66, - 0x6c, 0x69, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x6f, 0x6f, 0x74, 0x2e, 0x5f, 0x20, 0x3d, 0x20, 0x70, 0x72, 0x65, - 0x76, 0x69, 0x6f, 0x75, 0x73, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, - 0x6f, 0x72, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x3b, 0x0a, 0x20, 0x20, - 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4b, 0x65, 0x65, - 0x70, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, - 0x61, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x75, 0x6e, 0x20, - 0x61, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2a, - 0x2a, 0x6e, 0x2a, 0x2a, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x2e, 0x0a, - 0x20, 0x20, 0x5f, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6e, 0x2c, 0x20, - 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x63, 0x63, 0x75, 0x6d, 0x20, 0x3d, - 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x28, 0x6e, 0x29, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, - 0x69, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x20, 0x69, 0x20, 0x3c, 0x20, 0x6e, - 0x3b, 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x20, 0x61, 0x63, 0x63, 0x75, 0x6d, - 0x5b, 0x69, 0x5d, 0x20, 0x3d, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x2c, 0x20, 0x69, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x63, 0x63, 0x75, - 0x6d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x20, 0x72, - 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, - 0x72, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x20, 0x6d, 0x69, - 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x69, - 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x29, 0x2e, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x69, 0x6e, - 0x2c, 0x20, 0x6d, 0x61, 0x78, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x3d, 0x3d, 0x20, - 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x6d, 0x69, 0x6e, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x6e, 0x20, 0x3d, - 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x69, 0x6e, - 0x20, 0x2b, 0x20, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x66, 0x6c, 0x6f, 0x6f, - 0x72, 0x28, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x72, 0x61, 0x6e, 0x64, 0x6f, - 0x6d, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x2d, - 0x20, 0x6d, 0x69, 0x6e, 0x20, 0x2b, 0x20, 0x31, 0x29, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4c, - 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x20, - 0x20, 0x76, 0x61, 0x72, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4d, - 0x61, 0x70, 0x20, 0x3d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, - 0x73, 0x63, 0x61, 0x70, 0x65, 0x3a, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x27, 0x26, 0x27, 0x3a, 0x20, 0x27, 0x26, 0x61, 0x6d, - 0x70, 0x3b, 0x27, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x27, - 0x3c, 0x27, 0x3a, 0x20, 0x27, 0x26, 0x6c, 0x74, 0x3b, 0x27, 0x2c, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x27, 0x3e, 0x27, 0x3a, 0x20, 0x27, - 0x26, 0x67, 0x74, 0x3b, 0x27, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x27, 0x22, 0x27, 0x3a, 0x20, 0x27, 0x26, 0x71, 0x75, 0x6f, 0x74, - 0x3b, 0x27, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x27, - 0x22, 0x3a, 0x20, 0x27, 0x26, 0x23, 0x78, 0x32, 0x37, 0x3b, 0x27, 0x2c, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x27, 0x2f, 0x27, 0x3a, 0x20, - 0x27, 0x26, 0x23, 0x78, 0x32, 0x46, 0x3b, 0x27, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x70, 0x2e, 0x75, 0x6e, 0x65, 0x73, - 0x63, 0x61, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x69, 0x6e, 0x76, - 0x65, 0x72, 0x74, 0x28, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4d, 0x61, - 0x70, 0x2e, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x29, 0x3b, 0x0a, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x67, 0x65, 0x78, 0x65, 0x73, - 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x61, 0x6e, 0x64, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, - 0x65, 0x64, 0x20, 0x69, 0x6d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, - 0x6c, 0x79, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, - 0x67, 0x65, 0x78, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x3a, 0x20, 0x20, 0x20, - 0x6e, 0x65, 0x77, 0x20, 0x52, 0x65, 0x67, 0x45, 0x78, 0x70, 0x28, 0x27, - 0x5b, 0x27, 0x20, 0x2b, 0x20, 0x5f, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x28, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x70, 0x2e, 0x65, 0x73, - 0x63, 0x61, 0x70, 0x65, 0x29, 0x2e, 0x6a, 0x6f, 0x69, 0x6e, 0x28, 0x27, - 0x27, 0x29, 0x20, 0x2b, 0x20, 0x27, 0x5d, 0x27, 0x2c, 0x20, 0x27, 0x67, - 0x27, 0x29, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x75, 0x6e, 0x65, 0x73, - 0x63, 0x61, 0x70, 0x65, 0x3a, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x52, 0x65, - 0x67, 0x45, 0x78, 0x70, 0x28, 0x27, 0x28, 0x27, 0x20, 0x2b, 0x20, 0x5f, - 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x28, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x4d, 0x61, 0x70, 0x2e, 0x75, 0x6e, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, - 0x29, 0x2e, 0x6a, 0x6f, 0x69, 0x6e, 0x28, 0x27, 0x7c, 0x27, 0x29, 0x20, - 0x2b, 0x20, 0x27, 0x29, 0x27, 0x2c, 0x20, 0x27, 0x67, 0x27, 0x29, 0x0a, - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6e, - 0x64, 0x20, 0x75, 0x6e, 0x65, 0x73, 0x63, 0x61, 0x70, 0x69, 0x6e, 0x67, - 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x74, 0x6f, 0x2f, - 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x70, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x65, 0x61, 0x63, 0x68, 0x28, 0x5b, 0x27, - 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x27, 0x2c, 0x20, 0x27, 0x75, 0x6e, - 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x27, 0x5d, 0x2c, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x5b, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5d, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x3d, 0x3d, 0x20, - 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x20, 0x27, 0x27, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x28, 0x27, 0x27, 0x20, 0x2b, 0x20, - 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x29, 0x2e, 0x72, 0x65, 0x70, 0x6c, - 0x61, 0x63, 0x65, 0x28, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, - 0x67, 0x65, 0x78, 0x65, 0x73, 0x5b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x5d, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4d, 0x61, 0x70, 0x5b, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x5d, 0x5b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5d, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x29, 0x3b, - 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x79, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x6e, - 0x20, 0x69, 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x20, 0x69, 0x74, 0x3b, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x77, 0x69, - 0x73, 0x65, 0x2c, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x69, - 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x79, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x69, 0x66, 0x20, 0x28, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, - 0x3d, 0x3d, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, - 0x3d, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5b, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x79, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x2e, 0x69, 0x73, 0x46, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x29, 0x20, 0x3f, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x63, - 0x61, 0x6c, 0x6c, 0x28, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x29, 0x20, - 0x3a, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x64, 0x64, 0x20, - 0x79, 0x6f, 0x75, 0x72, 0x20, 0x6f, 0x77, 0x6e, 0x20, 0x63, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x55, 0x6e, 0x64, - 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6d, 0x69, 0x78, 0x69, - 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x65, 0x61, 0x63, 0x68, 0x28, 0x5f, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x2c, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, - 0x29, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x20, 0x3d, 0x20, 0x5f, 0x5b, 0x6e, 0x61, - 0x6d, 0x65, 0x5d, 0x20, 0x3d, 0x20, 0x6f, 0x62, 0x6a, 0x5b, 0x6e, 0x61, - 0x6d, 0x65, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x5b, 0x6e, - 0x61, 0x6d, 0x65, 0x5d, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x72, 0x67, 0x73, - 0x20, 0x3d, 0x20, 0x5b, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x5f, 0x77, 0x72, - 0x61, 0x70, 0x70, 0x65, 0x64, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x70, 0x75, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x70, - 0x6c, 0x79, 0x28, 0x61, 0x72, 0x67, 0x73, 0x2c, 0x20, 0x61, 0x72, 0x67, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, - 0x74, 0x68, 0x69, 0x73, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x2e, 0x61, - 0x70, 0x70, 0x6c, 0x79, 0x28, 0x5f, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x73, - 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x75, 0x6e, 0x69, 0x71, 0x75, - 0x65, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x20, 0x69, 0x64, - 0x20, 0x28, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x77, 0x69, 0x74, - 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x74, 0x69, - 0x72, 0x65, 0x20, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x55, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x20, 0x66, 0x6f, 0x72, 0x20, - 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x20, 0x44, 0x4f, - 0x4d, 0x20, 0x69, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, - 0x20, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x20, 0x3d, - 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x75, 0x6e, 0x69, 0x71, - 0x75, 0x65, 0x49, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x29, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x64, - 0x20, 0x3d, 0x20, 0x2b, 0x2b, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x20, 0x2b, 0x20, 0x27, 0x27, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x70, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x20, 0x3f, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, - 0x2b, 0x20, 0x69, 0x64, 0x20, 0x3a, 0x20, 0x69, 0x64, 0x3b, 0x0a, 0x20, - 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x42, 0x79, - 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x2c, 0x20, 0x55, 0x6e, - 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x75, 0x73, 0x65, - 0x73, 0x20, 0x45, 0x52, 0x42, 0x2d, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x20, - 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x64, 0x65, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x73, 0x2c, 0x20, 0x63, 0x68, 0x61, - 0x6e, 0x67, 0x65, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x74, - 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x73, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, - 0x61, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, - 0x64, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x73, 0x2e, 0x0a, - 0x20, 0x20, 0x5f, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x3d, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, - 0x65, 0x20, 0x20, 0x20, 0x20, 0x3a, 0x20, 0x2f, 0x3c, 0x25, 0x28, 0x5b, - 0x5c, 0x73, 0x5c, 0x53, 0x5d, 0x2b, 0x3f, 0x29, 0x25, 0x3e, 0x2f, 0x67, - 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, - 0x6f, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x3a, 0x20, 0x2f, 0x3c, 0x25, 0x3d, - 0x28, 0x5b, 0x5c, 0x73, 0x5c, 0x53, 0x5d, 0x2b, 0x3f, 0x29, 0x25, 0x3e, - 0x2f, 0x67, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x73, 0x63, 0x61, - 0x70, 0x65, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3a, 0x20, 0x2f, 0x3c, - 0x25, 0x2d, 0x28, 0x5b, 0x5c, 0x73, 0x5c, 0x53, 0x5d, 0x2b, 0x3f, 0x29, - 0x25, 0x3e, 0x2f, 0x67, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x57, 0x68, 0x65, 0x6e, 0x20, 0x63, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x69, 0x7a, 0x69, 0x6e, 0x67, 0x20, 0x60, 0x74, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x60, 0x2c, 0x20, 0x69, 0x66, 0x20, 0x79, 0x6f, 0x75, 0x20, - 0x64, 0x6f, 0x6e, 0x27, 0x74, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, 0x74, - 0x6f, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x61, 0x6e, 0x0a, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x6f, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x65, 0x76, 0x61, 0x6c, - 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x72, 0x20, 0x65, 0x73, - 0x63, 0x61, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x67, 0x65, 0x78, - 0x2c, 0x20, 0x77, 0x65, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x6f, 0x6e, - 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x67, 0x75, 0x61, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, - 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x74, - 0x63, 0x68, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6e, 0x6f, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x20, 0x3d, 0x20, 0x2f, 0x28, 0x2e, 0x29, - 0x5e, 0x2f, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x65, - 0x72, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, - 0x74, 0x65, 0x72, 0x73, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x74, 0x6f, - 0x20, 0x62, 0x65, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x64, 0x20, - 0x73, 0x6f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x79, - 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x70, 0x75, 0x74, 0x20, - 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x61, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x69, 0x74, 0x65, 0x72, - 0x61, 0x6c, 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x65, 0x73, - 0x63, 0x61, 0x70, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x22, 0x27, 0x22, 0x3a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x22, 0x27, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x27, 0x5c, 0x5c, - 0x27, 0x3a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x27, 0x5c, 0x5c, 0x27, 0x2c, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x27, 0x5c, 0x72, 0x27, 0x3a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x27, 0x72, 0x27, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x27, 0x5c, 0x6e, 0x27, 0x3a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x27, 0x6e, - 0x27, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x27, 0x5c, 0x74, 0x27, 0x3a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x27, 0x74, 0x27, 0x2c, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x27, 0x5c, 0x75, 0x32, 0x30, 0x32, 0x38, 0x27, 0x3a, 0x20, - 0x27, 0x75, 0x32, 0x30, 0x32, 0x38, 0x27, 0x2c, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x27, 0x5c, 0x75, 0x32, 0x30, 0x32, 0x39, 0x27, 0x3a, 0x20, 0x27, - 0x75, 0x32, 0x30, 0x32, 0x39, 0x27, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, - 0x65, 0x72, 0x20, 0x3d, 0x20, 0x2f, 0x5c, 0x5c, 0x7c, 0x27, 0x7c, 0x5c, - 0x72, 0x7c, 0x5c, 0x6e, 0x7c, 0x5c, 0x74, 0x7c, 0x5c, 0x75, 0x32, 0x30, - 0x32, 0x38, 0x7c, 0x5c, 0x75, 0x32, 0x30, 0x32, 0x39, 0x2f, 0x67, 0x3b, - 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2d, - 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x2c, 0x20, - 0x73, 0x69, 0x6d, 0x69, 0x6c, 0x61, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x4a, - 0x6f, 0x68, 0x6e, 0x20, 0x52, 0x65, 0x73, 0x69, 0x67, 0x27, 0x73, 0x20, - 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x6e, 0x64, - 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x74, 0x65, 0x6d, 0x70, - 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, - 0x65, 0x73, 0x20, 0x61, 0x72, 0x62, 0x69, 0x74, 0x72, 0x61, 0x72, 0x79, - 0x20, 0x64, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x73, 0x2c, - 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x73, 0x20, 0x77, - 0x68, 0x69, 0x74, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2c, 0x0a, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63, 0x6f, 0x72, 0x72, - 0x65, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, - 0x73, 0x20, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x73, 0x20, 0x77, 0x69, 0x74, - 0x68, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x6f, 0x6c, - 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x0a, 0x20, - 0x20, 0x5f, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x20, - 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x74, - 0x65, 0x78, 0x74, 0x2c, 0x20, 0x64, 0x61, 0x74, 0x61, 0x2c, 0x20, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x29, 0x20, 0x7b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x20, 0x3d, 0x20, 0x5f, 0x2e, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x73, 0x28, 0x7b, 0x7d, 0x2c, 0x20, 0x73, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2c, 0x20, 0x5f, 0x2e, 0x74, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x65, 0x20, 0x64, 0x65, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x65, 0x72, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, - 0x6f, 0x6e, 0x65, 0x20, 0x72, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x20, - 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x76, - 0x69, 0x61, 0x20, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x6e, 0x65, - 0x77, 0x20, 0x52, 0x65, 0x67, 0x45, 0x78, 0x70, 0x28, 0x5b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x2e, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x20, 0x7c, 0x7c, - 0x20, 0x6e, 0x6f, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x29, 0x2e, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x28, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x70, 0x6f, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x7c, 0x7c, - 0x20, 0x6e, 0x6f, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x29, 0x2e, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x28, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x65, 0x76, - 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x20, 0x7c, 0x7c, 0x20, 0x6e, 0x6f, - 0x4d, 0x61, 0x74, 0x63, 0x68, 0x29, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2e, 0x6a, 0x6f, 0x69, 0x6e, - 0x28, 0x27, 0x7c, 0x27, 0x29, 0x20, 0x2b, 0x20, 0x27, 0x7c, 0x24, 0x27, - 0x2c, 0x20, 0x27, 0x67, 0x27, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2c, 0x20, 0x65, 0x73, 0x63, - 0x61, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x20, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x73, 0x20, 0x61, 0x70, - 0x70, 0x72, 0x6f, 0x70, 0x72, 0x69, 0x61, 0x74, 0x65, 0x6c, 0x79, 0x2e, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3d, - 0x20, 0x22, 0x5f, 0x5f, 0x70, 0x2b, 0x3d, 0x27, 0x22, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x72, 0x65, 0x70, 0x6c, - 0x61, 0x63, 0x65, 0x28, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2c, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x2c, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x2c, - 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x6f, 0x6c, 0x61, 0x74, 0x65, - 0x2c, 0x20, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x2c, 0x20, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x2b, - 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x73, 0x6c, 0x69, 0x63, 0x65, - 0x28, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x28, 0x65, 0x73, 0x63, - 0x61, 0x70, 0x65, 0x72, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x29, 0x20, 0x7b, 0x20, - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x27, 0x5c, 0x5c, 0x27, 0x20, - 0x2b, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x73, 0x5b, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x5d, 0x3b, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x65, 0x73, 0x63, - 0x61, 0x70, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x2b, 0x3d, - 0x20, 0x22, 0x27, 0x2b, 0x5c, 0x6e, 0x28, 0x28, 0x5f, 0x5f, 0x74, 0x3d, - 0x28, 0x22, 0x20, 0x2b, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x20, - 0x2b, 0x20, 0x22, 0x29, 0x29, 0x3d, 0x3d, 0x6e, 0x75, 0x6c, 0x6c, 0x3f, - 0x27, 0x27, 0x3a, 0x5f, 0x2e, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x28, - 0x5f, 0x5f, 0x74, 0x29, 0x29, 0x2b, 0x5c, 0x6e, 0x27, 0x22, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, - 0x6f, 0x6c, 0x61, 0x74, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, - 0x2b, 0x3d, 0x20, 0x22, 0x27, 0x2b, 0x5c, 0x6e, 0x28, 0x28, 0x5f, 0x5f, - 0x74, 0x3d, 0x28, 0x22, 0x20, 0x2b, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x70, 0x6f, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x2b, 0x20, 0x22, 0x29, 0x29, - 0x3d, 0x3d, 0x6e, 0x75, 0x6c, 0x6c, 0x3f, 0x27, 0x27, 0x3a, 0x5f, 0x5f, - 0x74, 0x29, 0x2b, 0x5c, 0x6e, 0x27, 0x22, 0x3b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, - 0x66, 0x20, 0x28, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x29, - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x2b, 0x3d, 0x20, 0x22, 0x27, 0x3b, - 0x5c, 0x6e, 0x22, 0x20, 0x2b, 0x20, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, - 0x74, 0x65, 0x20, 0x2b, 0x20, 0x22, 0x5c, 0x6e, 0x5f, 0x5f, 0x70, 0x2b, - 0x3d, 0x27, 0x22, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x20, 0x3d, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x2b, 0x20, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x20, 0x2b, 0x3d, 0x20, 0x22, 0x27, 0x3b, 0x5c, - 0x6e, 0x22, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, - 0x49, 0x66, 0x20, 0x61, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2c, 0x20, 0x70, 0x6c, 0x61, 0x63, - 0x65, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x20, 0x69, 0x6e, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, - 0x20, 0x28, 0x21, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, - 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x29, 0x20, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x27, 0x77, 0x69, 0x74, 0x68, - 0x28, 0x6f, 0x62, 0x6a, 0x7c, 0x7c, 0x7b, 0x7d, 0x29, 0x7b, 0x5c, 0x6e, - 0x27, 0x20, 0x2b, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x2b, - 0x20, 0x27, 0x7d, 0x5c, 0x6e, 0x27, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x76, - 0x61, 0x72, 0x20, 0x5f, 0x5f, 0x74, 0x2c, 0x5f, 0x5f, 0x70, 0x3d, 0x27, - 0x27, 0x2c, 0x5f, 0x5f, 0x6a, 0x3d, 0x41, 0x72, 0x72, 0x61, 0x79, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6a, 0x6f, - 0x69, 0x6e, 0x2c, 0x22, 0x20, 0x2b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x22, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x3d, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x7b, 0x5f, 0x5f, 0x70, 0x2b, 0x3d, - 0x5f, 0x5f, 0x6a, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x61, 0x72, 0x67, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x27, 0x27, 0x29, 0x3b, 0x7d, - 0x3b, 0x5c, 0x6e, 0x22, 0x20, 0x2b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x2b, 0x20, 0x22, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x5f, 0x70, 0x3b, 0x5c, 0x6e, - 0x22, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x72, 0x79, 0x20, - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x20, 0x3d, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x46, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x2e, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x20, - 0x7c, 0x7c, 0x20, 0x27, 0x6f, 0x62, 0x6a, 0x27, 0x2c, 0x20, 0x27, 0x5f, - 0x27, 0x2c, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x63, 0x61, 0x74, 0x63, 0x68, 0x20, - 0x28, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x65, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x74, 0x68, 0x72, 0x6f, 0x77, 0x20, 0x65, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x64, 0x61, 0x74, 0x61, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x20, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x28, 0x64, 0x61, 0x74, - 0x61, 0x2c, 0x20, 0x5f, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, - 0x61, 0x72, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x20, - 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x64, - 0x61, 0x74, 0x61, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x74, 0x68, 0x69, 0x73, - 0x2c, 0x20, 0x64, 0x61, 0x74, 0x61, 0x2c, 0x20, 0x5f, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6e, - 0x76, 0x65, 0x6e, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x70, 0x72, 0x65, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x20, 0x3d, 0x20, 0x27, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x27, 0x20, 0x2b, 0x20, 0x28, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x2e, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x20, - 0x7c, 0x7c, 0x20, 0x27, 0x6f, 0x62, 0x6a, 0x27, 0x29, 0x20, 0x2b, 0x20, - 0x27, 0x29, 0x7b, 0x5c, 0x6e, 0x27, 0x20, 0x2b, 0x20, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x20, 0x2b, 0x20, 0x27, 0x7d, 0x27, 0x3b, 0x0a, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, - 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x7d, - 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x64, 0x64, 0x20, - 0x61, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, - 0x68, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x64, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, - 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, - 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x28, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x4f, 0x4f, 0x50, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2d, 0x2d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x55, - 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x69, 0x73, - 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, - 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x69, - 0x74, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x20, - 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x20, 0x74, 0x68, 0x61, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, - 0x20, 0x4f, 0x4f, 0x2d, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x20, 0x54, - 0x68, 0x69, 0x73, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, - 0x68, 0x6f, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x65, - 0x64, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, - 0x66, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, - 0x65, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x0a, 0x0a, 0x20, 0x20, - 0x2f, 0x2f, 0x20, 0x48, 0x65, 0x6c, 0x70, 0x65, 0x72, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6f, - 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x20, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, - 0x69, 0x61, 0x74, 0x65, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, - 0x2e, 0x0a, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x28, 0x6f, 0x62, 0x6a, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, - 0x2e, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x20, 0x3f, 0x20, 0x5f, 0x28, - 0x6f, 0x62, 0x6a, 0x29, 0x2e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x28, 0x29, - 0x20, 0x3a, 0x20, 0x6f, 0x62, 0x6a, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, - 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x64, 0x64, 0x20, 0x61, - 0x6c, 0x6c, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x55, 0x6e, - 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x6d, 0x69, - 0x78, 0x69, 0x6e, 0x28, 0x5f, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, - 0x2f, 0x20, 0x41, 0x64, 0x64, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6d, 0x75, - 0x74, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x74, 0x6f, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, - 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x5b, 0x27, 0x70, - 0x6f, 0x70, 0x27, 0x2c, 0x20, 0x27, 0x70, 0x75, 0x73, 0x68, 0x27, 0x2c, - 0x20, 0x27, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x27, 0x2c, 0x20, - 0x27, 0x73, 0x68, 0x69, 0x66, 0x74, 0x27, 0x2c, 0x20, 0x27, 0x73, 0x6f, - 0x72, 0x74, 0x27, 0x2c, 0x20, 0x27, 0x73, 0x70, 0x6c, 0x69, 0x63, 0x65, - 0x27, 0x2c, 0x20, 0x27, 0x75, 0x6e, 0x73, 0x68, 0x69, 0x66, 0x74, 0x27, - 0x5d, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, - 0x6e, 0x61, 0x6d, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x3d, - 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5b, - 0x6e, 0x61, 0x6d, 0x65, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x5b, 0x6e, - 0x61, 0x6d, 0x65, 0x5d, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6f, 0x62, 0x6a, 0x20, 0x3d, 0x20, - 0x74, 0x68, 0x69, 0x73, 0x2e, 0x5f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x64, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x28, 0x6f, 0x62, - 0x6a, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, - 0x28, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x73, - 0x68, 0x69, 0x66, 0x74, 0x27, 0x20, 0x7c, 0x7c, 0x20, 0x6e, 0x61, 0x6d, - 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x73, 0x70, 0x6c, 0x69, 0x63, 0x65, - 0x27, 0x29, 0x20, 0x26, 0x26, 0x20, 0x6f, 0x62, 0x6a, 0x2e, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x20, 0x3d, 0x3d, 0x3d, 0x20, 0x30, 0x29, 0x20, - 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x5b, 0x30, - 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x63, - 0x61, 0x6c, 0x6c, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2c, 0x20, 0x6f, 0x62, - 0x6a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, - 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, - 0x64, 0x64, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x6f, 0x72, 0x20, 0x41, 0x72, 0x72, 0x61, 0x79, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x2e, 0x0a, - 0x20, 0x20, 0x65, 0x61, 0x63, 0x68, 0x28, 0x5b, 0x27, 0x63, 0x6f, 0x6e, - 0x63, 0x61, 0x74, 0x27, 0x2c, 0x20, 0x27, 0x6a, 0x6f, 0x69, 0x6e, 0x27, - 0x2c, 0x20, 0x27, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x27, 0x5d, 0x2c, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6e, 0x61, 0x6d, - 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, - 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x3d, 0x20, 0x41, 0x72, - 0x72, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5b, 0x6e, 0x61, 0x6d, - 0x65, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x5b, 0x6e, 0x61, 0x6d, 0x65, - 0x5d, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2c, 0x20, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x79, - 0x28, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x5f, 0x77, 0x72, 0x61, 0x70, 0x70, - 0x65, 0x64, 0x2c, 0x20, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, - 0x20, 0x20, 0x7d, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x5f, 0x2e, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x64, 0x28, 0x5f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x74, 0x79, 0x70, 0x65, 0x2c, 0x20, 0x7b, 0x0a, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x74, 0x61, 0x72, 0x74, 0x20, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x77, 0x72, - 0x61, 0x70, 0x70, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x73, - 0x63, 0x6f, 0x72, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x3a, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2e, - 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, - 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x3b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x7d, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, - 0x20, 0x45, 0x78, 0x74, 0x72, 0x61, 0x63, 0x74, 0x73, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x66, 0x72, 0x6f, - 0x6d, 0x20, 0x61, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x20, - 0x61, 0x6e, 0x64, 0x20, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x20, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x68, 0x69, - 0x73, 0x2e, 0x5f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x7d, 0x29, 0x3b, - 0x0a, 0x0a, 0x7d, 0x29, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x74, 0x68, - 0x69, 0x73, 0x29, 0x3b, 0x0a, - } -} - -// Underscore.js 1.4.4 -// http://underscorejs.org -// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc. -// Underscore may be freely distributed under the MIT license. diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/testify b/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/testify deleted file mode 100644 index 7f6e0f7c11..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/testify +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use warnings; - -my $underscore_test = shift @ARGV || ""; -if (!-d $underscore_test) { - print <<_END_; -Usage: - - testify ./underscore/test - - # Should look something like: - arrays.js - chaining.js - collections.js - functions.js - index.html - objects.js - speed.js - utility.js - vendor - -_END_ - if ($underscore_test) { - die "!: Not a directory: $underscore_test\n" - } - exit; -} - -chdir $underscore_test or die "!: $!"; - -my @js = <*.js>; - -for my $file (@js) { - open my $fh, '<', $file or die "!: $!"; - my $tests = join "", <$fh>; - my @tests = $tests =~ m/ - ^(\s{2}test\(.*? - ^\s{2}}\);)$ - /mgxs; - close $fh; - next unless @tests; - print "$file: ", scalar(@tests), "\n"; - my $underscore_name = "underscore_$file"; - $underscore_name =~ s/.js$//; - my $go_file = "${underscore_name}_test.go"; - $go_file =~ s/.js$/.go/; - open $fh, '>', $go_file or die "!: $!"; - - $fh->print(<<_END_); -package otto - -import ( - "testing" -) - -_END_ - - my $count = 0; - for my $test (@tests) { - $test =~ s/`([^`]+)`/<$1>/g; - my ($name) = $test =~ m/^\s*test\(['"]([^'"]+)['"]/; - $fh->print(<<_END_); -// $name -func Test_${underscore_name}_$count(t *testing.T) { - tt(t, func(){ - test := underscoreTest() - - test(` -$test - `) - }) -} - -_END_ - $count++; - } -} - -# test('#779 - delimeters are applied to unescaped text.', 1, function() { -# var template = _.template('<<\nx\n>>', null, {evaluate: /<<(.*?)>>/g}); -# strictEqual(template(), '<<\nx\n>>'); -# }); diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/underscore.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/underscore.go deleted file mode 100644 index 714b8f3cf9..0000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore/underscore.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Package underscore contains the source for the JavaScript utility-belt library. - - import ( - _ "github.com/robertkrimen/otto/underscore" - ) - // Every Otto runtime will now include underscore - -http://underscorejs.org - -https://github.com/documentcloud/underscore - -By importing this package, you'll automatically load underscore every time you create a new Otto runtime. - -To prevent this behavior, you can do the following: - - import ( - "github.com/robertkrimen/otto/underscore" - ) - - func init() { - underscore.Disable() - } - -*/ -package underscore - -import ( - "github.com/robertkrimen/otto/registry" -) - -var entry *registry.Entry = registry.Register(func() string { - return Source() -}) - -// Enable underscore runtime inclusion. -func Enable() { - entry.Enable() -} - -// Disable underscore runtime inclusion. -func Disable() { - entry.Disable() -} - -// Source returns the underscore source. -func Source() string { - return string(underscore()) -} diff --git a/Godeps/_workspace/src/github.com/rs/cors/cors.go b/Godeps/_workspace/src/github.com/rs/cors/cors.go deleted file mode 100644 index 276bc40bb2..0000000000 --- a/Godeps/_workspace/src/github.com/rs/cors/cors.go +++ /dev/null @@ -1,308 +0,0 @@ -/* -Package cors is net/http handler to handle CORS related requests -as defined by http://www.w3.org/TR/cors/ - -You can configure it by passing an option struct to cors.New: - - c := cors.New(cors.Options{ - AllowedOrigins: []string{"foo.com"}, - AllowedMethods: []string{"GET", "POST", "DELETE"}, - AllowCredentials: true, - }) - -Then insert the handler in the chain: - - handler = c.Handler(handler) - -See Options documentation for more options. - -The resulting handler is a standard net/http handler. -*/ -package cors - -import ( - "log" - "net/http" - "os" - "strconv" - "strings" -) - -// Options is a configuration container to setup the CORS middleware. -type Options struct { - // AllowedOrigins is a list of origins a cross-domain request can be executed from. - // If the special "*" value is present in the list, all origins will be allowed. - // Default value is ["*"] - AllowedOrigins []string - // AllowedMethods is a list of methods the client is allowed to use with - // cross-domain requests. Default value is simple methods (GET and POST) - AllowedMethods []string - // AllowedHeaders is list of non simple headers the client is allowed to use with - // cross-domain requests. - // If the special "*" value is present in the list, all headers will be allowed. - // Default value is [] but "Origin" is always appended to the list. - AllowedHeaders []string - // ExposedHeaders indicates which headers are safe to expose to the API of a CORS - // API specification - ExposedHeaders []string - // AllowCredentials indicates whether the request can include user credentials like - // cookies, HTTP authentication or client side SSL certificates. - AllowCredentials bool - // MaxAge indicates how long (in seconds) the results of a preflight request - // can be cached - MaxAge int - // Debugging flag adds additional output to debug server side CORS issues - Debug bool - // log object to use when debugging - log *log.Logger -} - -type Cors struct { - // The CORS Options - options Options -} - -// New creates a new Cors handler with the provided options. -func New(options Options) *Cors { - // Normalize options - // Note: for origins and methods matching, the spec requires a case-sensitive matching. - // As it may error prone, we chose to ignore the spec here. - normOptions := Options{ - AllowedOrigins: convert(options.AllowedOrigins, strings.ToLower), - AllowedMethods: convert(options.AllowedMethods, strings.ToUpper), - // Origin is always appended as some browsers will always request - // for this header at preflight - AllowedHeaders: convert(append(options.AllowedHeaders, "Origin"), http.CanonicalHeaderKey), - ExposedHeaders: convert(options.ExposedHeaders, http.CanonicalHeaderKey), - AllowCredentials: options.AllowCredentials, - MaxAge: options.MaxAge, - Debug: options.Debug, - log: log.New(os.Stdout, "[cors] ", log.LstdFlags), - } - if len(normOptions.AllowedOrigins) == 0 { - // Default is all origins - normOptions.AllowedOrigins = []string{"*"} - } - if len(normOptions.AllowedHeaders) == 1 { - // Add some sensible defaults - normOptions.AllowedHeaders = []string{"Origin", "Accept", "Content-Type"} - } - if len(normOptions.AllowedMethods) == 0 { - // Default is simple methods - normOptions.AllowedMethods = []string{"GET", "POST"} - } - - if normOptions.Debug { - normOptions.log.Printf("Options: %v", normOptions) - } - return &Cors{ - options: normOptions, - } -} - -// Default creates a new Cors handler with default options -func Default() *Cors { - return New(Options{}) -} - -// Handler apply the CORS specification on the request, and add relevant CORS headers -// as necessary. -func (cors *Cors) Handler(h http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Method == "OPTIONS" { - cors.logf("Handler: Preflight request") - cors.handlePreflight(w, r) - // Preflight requests are standalone and should stop the chain as some other - // middleware may not handle OPTIONS requests correctly. One typical example - // is authentication middleware ; OPTIONS requests won't carry authentication - // headers (see #1) - } else { - cors.logf("Handler: Actual request") - cors.handleActualRequest(w, r) - h.ServeHTTP(w, r) - } - }) -} - -// Martini compatible handler -func (cors *Cors) HandlerFunc(w http.ResponseWriter, r *http.Request) { - if r.Method == "OPTIONS" { - cors.logf("HandlerFunc: Preflight request") - cors.handlePreflight(w, r) - } else { - cors.logf("HandlerFunc: Actual request") - cors.handleActualRequest(w, r) - } -} - -// Negroni compatible interface -func (cors *Cors) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { - if r.Method == "OPTIONS" { - cors.logf("ServeHTTP: Preflight request") - cors.handlePreflight(w, r) - // Preflight requests are standalone and should stop the chain as some other - // middleware may not handle OPTIONS requests correctly. One typical example - // is authentication middleware ; OPTIONS requests won't carry authentication - // headers (see #1) - } else { - cors.logf("ServeHTTP: Actual request") - cors.handleActualRequest(w, r) - next(w, r) - } -} - -// handlePreflight handles pre-flight CORS requests -func (cors *Cors) handlePreflight(w http.ResponseWriter, r *http.Request) { - options := cors.options - headers := w.Header() - origin := r.Header.Get("Origin") - - if r.Method != "OPTIONS" { - cors.logf(" Preflight aborted: %s!=OPTIONS", r.Method) - return - } - if origin == "" { - cors.logf(" Preflight aborted: empty origin") - return - } - if !cors.isOriginAllowed(origin) { - cors.logf(" Preflight aborted: origin '%s' not allowed", origin) - return - } - - reqMethod := r.Header.Get("Access-Control-Request-Method") - if !cors.isMethodAllowed(reqMethod) { - cors.logf(" Preflight aborted: method '%s' not allowed", reqMethod) - return - } - reqHeaders := parseHeaderList(r.Header.Get("Access-Control-Request-Headers")) - if !cors.areHeadersAllowed(reqHeaders) { - cors.logf(" Preflight aborted: headers '%v' not allowed", reqHeaders) - return - } - headers.Set("Access-Control-Allow-Origin", origin) - headers.Add("Vary", "Origin") - // Spec says: Since the list of methods can be unbounded, simply returning the method indicated - // by Access-Control-Request-Method (if supported) can be enough - headers.Set("Access-Control-Allow-Methods", strings.ToUpper(reqMethod)) - if len(reqHeaders) > 0 { - - // Spec says: Since the list of headers can be unbounded, simply returning supported headers - // from Access-Control-Request-Headers can be enough - headers.Set("Access-Control-Allow-Headers", strings.Join(reqHeaders, ", ")) - } - if options.AllowCredentials { - headers.Set("Access-Control-Allow-Credentials", "true") - } - if options.MaxAge > 0 { - headers.Set("Access-Control-Max-Age", strconv.Itoa(options.MaxAge)) - } - cors.logf(" Preflight response headers: %v", headers) -} - -// handleActualRequest handles simple cross-origin requests, actual request or redirects -func (cors *Cors) handleActualRequest(w http.ResponseWriter, r *http.Request) { - options := cors.options - headers := w.Header() - origin := r.Header.Get("Origin") - - if r.Method == "OPTIONS" { - cors.logf(" Actual request no headers added: method == %s", r.Method) - return - } - if origin == "" { - cors.logf(" Actual request no headers added: missing origin") - return - } - if !cors.isOriginAllowed(origin) { - cors.logf(" Actual request no headers added: origin '%s' not allowed", origin) - return - } - - // Note that spec does define a way to specifically disallow a simple method like GET or - // POST. Access-Control-Allow-Methods is only used for pre-flight requests and the - // spec doesn't instruct to check the allowed methods for simple cross-origin requests. - // We think it's a nice feature to be able to have control on those methods though. - if !cors.isMethodAllowed(r.Method) { - if cors.options.Debug { - cors.logf(" Actual request no headers added: method '%s' not allowed", - r.Method) - } - - return - } - headers.Set("Access-Control-Allow-Origin", origin) - headers.Add("Vary", "Origin") - if len(options.ExposedHeaders) > 0 { - headers.Set("Access-Control-Expose-Headers", strings.Join(options.ExposedHeaders, ", ")) - } - if options.AllowCredentials { - headers.Set("Access-Control-Allow-Credentials", "true") - } - cors.logf(" Actual response added headers: %v", headers) -} - -// convenience method. checks if debugging is turned on before printing -func (cors *Cors) logf(format string, a ...interface{}) { - if cors.options.Debug { - cors.options.log.Printf(format, a...) - } -} - -// isOriginAllowed checks if a given origin is allowed to perform cross-domain requests -// on the endpoint -func (cors *Cors) isOriginAllowed(origin string) bool { - allowedOrigins := cors.options.AllowedOrigins - origin = strings.ToLower(origin) - for _, allowedOrigin := range allowedOrigins { - switch allowedOrigin { - case "*": - return true - case origin: - return true - } - } - return false -} - -// isMethodAllowed checks if a given method can be used as part of a cross-domain request -// on the endpoing -func (cors *Cors) isMethodAllowed(method string) bool { - allowedMethods := cors.options.AllowedMethods - if len(allowedMethods) == 0 { - // If no method allowed, always return false, even for preflight request - return false - } - method = strings.ToUpper(method) - if method == "OPTIONS" { - // Always allow preflight requests - return true - } - for _, allowedMethod := range allowedMethods { - if allowedMethod == method { - return true - } - } - return false -} - -// areHeadersAllowed checks if a given list of headers are allowed to used within -// a cross-domain request. -func (cors *Cors) areHeadersAllowed(requestedHeaders []string) bool { - if len(requestedHeaders) == 0 { - return true - } - for _, header := range requestedHeaders { - found := false - for _, allowedHeader := range cors.options.AllowedHeaders { - if allowedHeader == "*" || allowedHeader == header { - found = true - break - } - } - if !found { - return false - } - } - return true -} diff --git a/Godeps/_workspace/src/github.com/rs/cors/utils.go b/Godeps/_workspace/src/github.com/rs/cors/utils.go deleted file mode 100644 index 429ab1114b..0000000000 --- a/Godeps/_workspace/src/github.com/rs/cors/utils.go +++ /dev/null @@ -1,27 +0,0 @@ -package cors - -import ( - "net/http" - "strings" -) - -type converter func(string) string - -// convert converts a list of string using the passed converter function -func convert(s []string, c converter) []string { - out := []string{} - for _, i := range s { - out = append(out, c(i)) - } - return out -} - -func parseHeaderList(headerList string) (headers []string) { - for _, header := range strings.Split(headerList, ",") { - header = http.CanonicalHeaderKey(strings.TrimSpace(header)) - if header != "" { - headers = append(headers, header) - } - } - return headers -} diff --git a/Godeps/_workspace/src/golang.org/x/text/language/index.go b/Godeps/_workspace/src/golang.org/x/text/language/index.go deleted file mode 100644 index 7fa9cc82d1..0000000000 --- a/Godeps/_workspace/src/golang.org/x/text/language/index.go +++ /dev/null @@ -1,762 +0,0 @@ -// This file was generated by go generate; DO NOT EDIT - -package language - -// NumCompactTags is the number of common tags. The maximum tag is -// NumCompactTags-1. -const NumCompactTags = 747 - -var specialTags = []Tag{ // 2 elements - 0: {lang: 0x61, region: 0x6d, script: 0x0, pVariant: 0x5, pExt: 0xe, str: "ca-ES-valencia"}, - 1: {lang: 0x9b, region: 0x132, script: 0x0, pVariant: 0x5, pExt: 0x5, str: "en-US-u-va-posix"}, -} // Size: 72 bytes - -var coreTags = map[uint32]uint16{ - 0x0: 0, // und - 0x00a00000: 3, // af - 0x00a000d0: 4, // af-NA - 0x00a0015e: 5, // af-ZA - 0x00b00000: 6, // agq - 0x00b00051: 7, // agq-CM - 0x00d00000: 8, // ak - 0x00d0007e: 9, // ak-GH - 0x01100000: 10, // am - 0x0110006e: 11, // am-ET - 0x01500000: 12, // ar - 0x01500001: 13, // ar-001 - 0x01500022: 14, // ar-AE - 0x01500038: 15, // ar-BH - 0x01500061: 16, // ar-DJ - 0x01500066: 17, // ar-DZ - 0x0150006a: 18, // ar-EG - 0x0150006b: 19, // ar-EH - 0x0150006c: 20, // ar-ER - 0x01500095: 21, // ar-IL - 0x01500099: 22, // ar-IQ - 0x0150009f: 23, // ar-JO - 0x015000a6: 24, // ar-KM - 0x015000aa: 25, // ar-KW - 0x015000ae: 26, // ar-LB - 0x015000b7: 27, // ar-LY - 0x015000b8: 28, // ar-MA - 0x015000c7: 29, // ar-MR - 0x015000df: 30, // ar-OM - 0x015000eb: 31, // ar-PS - 0x015000f1: 32, // ar-QA - 0x01500106: 33, // ar-SA - 0x01500109: 34, // ar-SD - 0x01500113: 35, // ar-SO - 0x01500115: 36, // ar-SS - 0x0150011a: 37, // ar-SY - 0x0150011e: 38, // ar-TD - 0x01500126: 39, // ar-TN - 0x0150015b: 40, // ar-YE - 0x01c00000: 41, // as - 0x01c00097: 42, // as-IN - 0x01d00000: 43, // asa - 0x01d0012d: 44, // asa-TZ - 0x01f00000: 45, // ast - 0x01f0006d: 46, // ast-ES - 0x02400000: 47, // az - 0x0241e000: 48, // az-Cyrl - 0x0241e031: 49, // az-Cyrl-AZ - 0x02452000: 50, // az-Latn - 0x02452031: 51, // az-Latn-AZ - 0x02a00000: 52, // bas - 0x02a00051: 53, // bas-CM - 0x02f00000: 54, // be - 0x02f00046: 55, // be-BY - 0x03100000: 56, // bem - 0x0310015f: 57, // bem-ZM - 0x03300000: 58, // bez - 0x0330012d: 59, // bez-TZ - 0x03800000: 60, // bg - 0x03800037: 61, // bg-BG - 0x03c00000: 62, // bh - 0x04900000: 63, // bm - 0x049000c1: 64, // bm-ML - 0x04b00000: 65, // bn - 0x04b00034: 66, // bn-BD - 0x04b00097: 67, // bn-IN - 0x04c00000: 68, // bo - 0x04c00052: 69, // bo-CN - 0x04c00097: 70, // bo-IN - 0x05000000: 71, // br - 0x05000076: 72, // br-FR - 0x05300000: 73, // brx - 0x05300097: 74, // brx-IN - 0x05400000: 75, // bs - 0x0541e000: 76, // bs-Cyrl - 0x0541e032: 77, // bs-Cyrl-BA - 0x05452000: 78, // bs-Latn - 0x05452032: 79, // bs-Latn-BA - 0x06100000: 80, // ca - 0x06100021: 81, // ca-AD - 0x0610006d: 82, // ca-ES - 0x06100076: 83, // ca-FR - 0x0610009c: 84, // ca-IT - 0x06400000: 85, // ce - 0x06400104: 86, // ce-RU - 0x06600000: 87, // cgg - 0x0660012f: 88, // cgg-UG - 0x06c00000: 89, // chr - 0x06c00132: 90, // chr-US - 0x06f00000: 91, // ckb - 0x06f00099: 92, // ckb-IQ - 0x06f0009a: 93, // ckb-IR - 0x07900000: 94, // cs - 0x0790005d: 95, // cs-CZ - 0x07d00000: 96, // cu - 0x07d00104: 97, // cu-RU - 0x07f00000: 98, // cy - 0x07f00079: 99, // cy-GB - 0x08000000: 100, // da - 0x08000062: 101, // da-DK - 0x08000080: 102, // da-GL - 0x08300000: 103, // dav - 0x083000a2: 104, // dav-KE - 0x08500000: 105, // de - 0x0850002d: 106, // de-AT - 0x08500035: 107, // de-BE - 0x0850004d: 108, // de-CH - 0x0850005f: 109, // de-DE - 0x085000b0: 110, // de-LI - 0x085000b5: 111, // de-LU - 0x08800000: 112, // dje - 0x088000d2: 113, // dje-NE - 0x08b00000: 114, // dsb - 0x08b0005f: 115, // dsb-DE - 0x08f00000: 116, // dua - 0x08f00051: 117, // dua-CM - 0x09000000: 118, // dv - 0x09100000: 119, // dyo - 0x09100112: 120, // dyo-SN - 0x09300000: 121, // dz - 0x09300042: 122, // dz-BT - 0x09400000: 123, // ebu - 0x094000a2: 124, // ebu-KE - 0x09500000: 125, // ee - 0x0950007e: 126, // ee-GH - 0x09500120: 127, // ee-TG - 0x09a00000: 128, // el - 0x09a0005c: 129, // el-CY - 0x09a00085: 130, // el-GR - 0x09b00000: 131, // en - 0x09b00001: 132, // en-001 - 0x09b0001a: 133, // en-150 - 0x09b00024: 134, // en-AG - 0x09b00025: 135, // en-AI - 0x09b0002c: 136, // en-AS - 0x09b0002d: 137, // en-AT - 0x09b0002e: 138, // en-AU - 0x09b00033: 139, // en-BB - 0x09b00035: 140, // en-BE - 0x09b00039: 141, // en-BI - 0x09b0003c: 142, // en-BM - 0x09b00041: 143, // en-BS - 0x09b00045: 144, // en-BW - 0x09b00047: 145, // en-BZ - 0x09b00048: 146, // en-CA - 0x09b00049: 147, // en-CC - 0x09b0004d: 148, // en-CH - 0x09b0004f: 149, // en-CK - 0x09b00051: 150, // en-CM - 0x09b0005b: 151, // en-CX - 0x09b0005c: 152, // en-CY - 0x09b0005f: 153, // en-DE - 0x09b00060: 154, // en-DG - 0x09b00062: 155, // en-DK - 0x09b00063: 156, // en-DM - 0x09b0006c: 157, // en-ER - 0x09b00070: 158, // en-FI - 0x09b00071: 159, // en-FJ - 0x09b00072: 160, // en-FK - 0x09b00073: 161, // en-FM - 0x09b00079: 162, // en-GB - 0x09b0007a: 163, // en-GD - 0x09b0007d: 164, // en-GG - 0x09b0007e: 165, // en-GH - 0x09b0007f: 166, // en-GI - 0x09b00081: 167, // en-GM - 0x09b00088: 168, // en-GU - 0x09b0008a: 169, // en-GY - 0x09b0008b: 170, // en-HK - 0x09b00094: 171, // en-IE - 0x09b00095: 172, // en-IL - 0x09b00096: 173, // en-IM - 0x09b00097: 174, // en-IN - 0x09b00098: 175, // en-IO - 0x09b0009d: 176, // en-JE - 0x09b0009e: 177, // en-JM - 0x09b000a2: 178, // en-KE - 0x09b000a5: 179, // en-KI - 0x09b000a7: 180, // en-KN - 0x09b000ab: 181, // en-KY - 0x09b000af: 182, // en-LC - 0x09b000b2: 183, // en-LR - 0x09b000b3: 184, // en-LS - 0x09b000bd: 185, // en-MG - 0x09b000be: 186, // en-MH - 0x09b000c4: 187, // en-MO - 0x09b000c5: 188, // en-MP - 0x09b000c8: 189, // en-MS - 0x09b000c9: 190, // en-MT - 0x09b000ca: 191, // en-MU - 0x09b000cc: 192, // en-MW - 0x09b000ce: 193, // en-MY - 0x09b000d0: 194, // en-NA - 0x09b000d3: 195, // en-NF - 0x09b000d4: 196, // en-NG - 0x09b000d7: 197, // en-NL - 0x09b000db: 198, // en-NR - 0x09b000dd: 199, // en-NU - 0x09b000de: 200, // en-NZ - 0x09b000e4: 201, // en-PG - 0x09b000e5: 202, // en-PH - 0x09b000e6: 203, // en-PK - 0x09b000e9: 204, // en-PN - 0x09b000ea: 205, // en-PR - 0x09b000ee: 206, // en-PW - 0x09b00105: 207, // en-RW - 0x09b00107: 208, // en-SB - 0x09b00108: 209, // en-SC - 0x09b00109: 210, // en-SD - 0x09b0010a: 211, // en-SE - 0x09b0010b: 212, // en-SG - 0x09b0010c: 213, // en-SH - 0x09b0010d: 214, // en-SI - 0x09b00110: 215, // en-SL - 0x09b00115: 216, // en-SS - 0x09b00119: 217, // en-SX - 0x09b0011b: 218, // en-SZ - 0x09b0011d: 219, // en-TC - 0x09b00123: 220, // en-TK - 0x09b00127: 221, // en-TO - 0x09b0012a: 222, // en-TT - 0x09b0012b: 223, // en-TV - 0x09b0012d: 224, // en-TZ - 0x09b0012f: 225, // en-UG - 0x09b00131: 226, // en-UM - 0x09b00132: 227, // en-US - 0x09b00136: 228, // en-VC - 0x09b00139: 229, // en-VG - 0x09b0013a: 230, // en-VI - 0x09b0013c: 231, // en-VU - 0x09b0013f: 232, // en-WS - 0x09b0015e: 233, // en-ZA - 0x09b0015f: 234, // en-ZM - 0x09b00161: 235, // en-ZW - 0x09c00000: 236, // eo - 0x09c00001: 237, // eo-001 - 0x09d00000: 238, // es - 0x09d0001e: 239, // es-419 - 0x09d0002b: 240, // es-AR - 0x09d0003e: 241, // es-BO - 0x09d00040: 242, // es-BR - 0x09d00050: 243, // es-CL - 0x09d00053: 244, // es-CO - 0x09d00055: 245, // es-CR - 0x09d00058: 246, // es-CU - 0x09d00064: 247, // es-DO - 0x09d00067: 248, // es-EA - 0x09d00068: 249, // es-EC - 0x09d0006d: 250, // es-ES - 0x09d00084: 251, // es-GQ - 0x09d00087: 252, // es-GT - 0x09d0008d: 253, // es-HN - 0x09d00092: 254, // es-IC - 0x09d000cd: 255, // es-MX - 0x09d000d6: 256, // es-NI - 0x09d000e0: 257, // es-PA - 0x09d000e2: 258, // es-PE - 0x09d000e5: 259, // es-PH - 0x09d000ea: 260, // es-PR - 0x09d000ef: 261, // es-PY - 0x09d00118: 262, // es-SV - 0x09d00132: 263, // es-US - 0x09d00133: 264, // es-UY - 0x09d00138: 265, // es-VE - 0x09f00000: 266, // et - 0x09f00069: 267, // et-EE - 0x0a100000: 268, // eu - 0x0a10006d: 269, // eu-ES - 0x0a200000: 270, // ewo - 0x0a200051: 271, // ewo-CM - 0x0a400000: 272, // fa - 0x0a400023: 273, // fa-AF - 0x0a40009a: 274, // fa-IR - 0x0a600000: 275, // ff - 0x0a600051: 276, // ff-CM - 0x0a600082: 277, // ff-GN - 0x0a6000c7: 278, // ff-MR - 0x0a600112: 279, // ff-SN - 0x0a800000: 280, // fi - 0x0a800070: 281, // fi-FI - 0x0aa00000: 282, // fil - 0x0aa000e5: 283, // fil-PH - 0x0ad00000: 284, // fo - 0x0ad00062: 285, // fo-DK - 0x0ad00074: 286, // fo-FO - 0x0af00000: 287, // fr - 0x0af00035: 288, // fr-BE - 0x0af00036: 289, // fr-BF - 0x0af00039: 290, // fr-BI - 0x0af0003a: 291, // fr-BJ - 0x0af0003b: 292, // fr-BL - 0x0af00048: 293, // fr-CA - 0x0af0004a: 294, // fr-CD - 0x0af0004b: 295, // fr-CF - 0x0af0004c: 296, // fr-CG - 0x0af0004d: 297, // fr-CH - 0x0af0004e: 298, // fr-CI - 0x0af00051: 299, // fr-CM - 0x0af00061: 300, // fr-DJ - 0x0af00066: 301, // fr-DZ - 0x0af00076: 302, // fr-FR - 0x0af00078: 303, // fr-GA - 0x0af0007c: 304, // fr-GF - 0x0af00082: 305, // fr-GN - 0x0af00083: 306, // fr-GP - 0x0af00084: 307, // fr-GQ - 0x0af0008f: 308, // fr-HT - 0x0af000a6: 309, // fr-KM - 0x0af000b5: 310, // fr-LU - 0x0af000b8: 311, // fr-MA - 0x0af000b9: 312, // fr-MC - 0x0af000bc: 313, // fr-MF - 0x0af000bd: 314, // fr-MG - 0x0af000c1: 315, // fr-ML - 0x0af000c6: 316, // fr-MQ - 0x0af000c7: 317, // fr-MR - 0x0af000ca: 318, // fr-MU - 0x0af000d1: 319, // fr-NC - 0x0af000d2: 320, // fr-NE - 0x0af000e3: 321, // fr-PF - 0x0af000e8: 322, // fr-PM - 0x0af00100: 323, // fr-RE - 0x0af00105: 324, // fr-RW - 0x0af00108: 325, // fr-SC - 0x0af00112: 326, // fr-SN - 0x0af0011a: 327, // fr-SY - 0x0af0011e: 328, // fr-TD - 0x0af00120: 329, // fr-TG - 0x0af00126: 330, // fr-TN - 0x0af0013c: 331, // fr-VU - 0x0af0013d: 332, // fr-WF - 0x0af0015c: 333, // fr-YT - 0x0b600000: 334, // fur - 0x0b60009c: 335, // fur-IT - 0x0b900000: 336, // fy - 0x0b9000d7: 337, // fy-NL - 0x0ba00000: 338, // ga - 0x0ba00094: 339, // ga-IE - 0x0c200000: 340, // gd - 0x0c200079: 341, // gd-GB - 0x0c800000: 342, // gl - 0x0c80006d: 343, // gl-ES - 0x0d200000: 344, // gsw - 0x0d20004d: 345, // gsw-CH - 0x0d200076: 346, // gsw-FR - 0x0d2000b0: 347, // gsw-LI - 0x0d300000: 348, // gu - 0x0d300097: 349, // gu-IN - 0x0d700000: 350, // guw - 0x0d800000: 351, // guz - 0x0d8000a2: 352, // guz-KE - 0x0d900000: 353, // gv - 0x0d900096: 354, // gv-IM - 0x0dc00000: 355, // ha - 0x0dc0007e: 356, // ha-GH - 0x0dc000d2: 357, // ha-NE - 0x0dc000d4: 358, // ha-NG - 0x0de00000: 359, // haw - 0x0de00132: 360, // haw-US - 0x0e000000: 361, // he - 0x0e000095: 362, // he-IL - 0x0e100000: 363, // hi - 0x0e100097: 364, // hi-IN - 0x0ee00000: 365, // hr - 0x0ee00032: 366, // hr-BA - 0x0ee0008e: 367, // hr-HR - 0x0ef00000: 368, // hsb - 0x0ef0005f: 369, // hsb-DE - 0x0f200000: 370, // hu - 0x0f200090: 371, // hu-HU - 0x0f300000: 372, // hy - 0x0f300027: 373, // hy-AM - 0x0f800000: 374, // id - 0x0f800093: 375, // id-ID - 0x0fa00000: 376, // ig - 0x0fa000d4: 377, // ig-NG - 0x0fb00000: 378, // ii - 0x0fb00052: 379, // ii-CN - 0x10200000: 380, // is - 0x1020009b: 381, // is-IS - 0x10300000: 382, // it - 0x1030004d: 383, // it-CH - 0x1030009c: 384, // it-IT - 0x10300111: 385, // it-SM - 0x10400000: 386, // iu - 0x10700000: 387, // ja - 0x107000a0: 388, // ja-JP - 0x10900000: 389, // jbo - 0x10a00000: 390, // jgo - 0x10a00051: 391, // jgo-CM - 0x10c00000: 392, // jmc - 0x10c0012d: 393, // jmc-TZ - 0x10f00000: 394, // jv - 0x11100000: 395, // ka - 0x1110007b: 396, // ka-GE - 0x11300000: 397, // kab - 0x11300066: 398, // kab-DZ - 0x11500000: 399, // kaj - 0x11600000: 400, // kam - 0x116000a2: 401, // kam-KE - 0x11900000: 402, // kcg - 0x11b00000: 403, // kde - 0x11b0012d: 404, // kde-TZ - 0x11d00000: 405, // kea - 0x11d00059: 406, // kea-CV - 0x12800000: 407, // khq - 0x128000c1: 408, // khq-ML - 0x12b00000: 409, // ki - 0x12b000a2: 410, // ki-KE - 0x12f00000: 411, // kk - 0x12f000ac: 412, // kk-KZ - 0x13000000: 413, // kkj - 0x13000051: 414, // kkj-CM - 0x13100000: 415, // kl - 0x13100080: 416, // kl-GL - 0x13200000: 417, // kln - 0x132000a2: 418, // kln-KE - 0x13300000: 419, // km - 0x133000a4: 420, // km-KH - 0x13500000: 421, // kn - 0x13500097: 422, // kn-IN - 0x13600000: 423, // ko - 0x136000a8: 424, // ko-KP - 0x136000a9: 425, // ko-KR - 0x13800000: 426, // kok - 0x13800097: 427, // kok-IN - 0x14100000: 428, // ks - 0x14100097: 429, // ks-IN - 0x14200000: 430, // ksb - 0x1420012d: 431, // ksb-TZ - 0x14300000: 432, // ksf - 0x14300051: 433, // ksf-CM - 0x14400000: 434, // ksh - 0x1440005f: 435, // ksh-DE - 0x14500000: 436, // ku - 0x14a00000: 437, // kw - 0x14a00079: 438, // kw-GB - 0x14d00000: 439, // ky - 0x14d000a3: 440, // ky-KG - 0x15100000: 441, // lag - 0x1510012d: 442, // lag-TZ - 0x15400000: 443, // lb - 0x154000b5: 444, // lb-LU - 0x15a00000: 445, // lg - 0x15a0012f: 446, // lg-UG - 0x16100000: 447, // lkt - 0x16100132: 448, // lkt-US - 0x16400000: 449, // ln - 0x16400029: 450, // ln-AO - 0x1640004a: 451, // ln-CD - 0x1640004b: 452, // ln-CF - 0x1640004c: 453, // ln-CG - 0x16500000: 454, // lo - 0x165000ad: 455, // lo-LA - 0x16800000: 456, // lrc - 0x16800099: 457, // lrc-IQ - 0x1680009a: 458, // lrc-IR - 0x16900000: 459, // lt - 0x169000b4: 460, // lt-LT - 0x16b00000: 461, // lu - 0x16b0004a: 462, // lu-CD - 0x16d00000: 463, // luo - 0x16d000a2: 464, // luo-KE - 0x16e00000: 465, // luy - 0x16e000a2: 466, // luy-KE - 0x17000000: 467, // lv - 0x170000b6: 468, // lv-LV - 0x17a00000: 469, // mas - 0x17a000a2: 470, // mas-KE - 0x17a0012d: 471, // mas-TZ - 0x18000000: 472, // mer - 0x180000a2: 473, // mer-KE - 0x18200000: 474, // mfe - 0x182000ca: 475, // mfe-MU - 0x18300000: 476, // mg - 0x183000bd: 477, // mg-MG - 0x18400000: 478, // mgh - 0x184000cf: 479, // mgh-MZ - 0x18500000: 480, // mgo - 0x18500051: 481, // mgo-CM - 0x18c00000: 482, // mk - 0x18c000c0: 483, // mk-MK - 0x18d00000: 484, // ml - 0x18d00097: 485, // ml-IN - 0x18f00000: 486, // mn - 0x18f000c3: 487, // mn-MN - 0x19600000: 488, // mr - 0x19600097: 489, // mr-IN - 0x19a00000: 490, // ms - 0x19a0003d: 491, // ms-BN - 0x19a000ce: 492, // ms-MY - 0x19a0010b: 493, // ms-SG - 0x19b00000: 494, // mt - 0x19b000c9: 495, // mt-MT - 0x19d00000: 496, // mua - 0x19d00051: 497, // mua-CM - 0x1a500000: 498, // my - 0x1a5000c2: 499, // my-MM - 0x1a900000: 500, // mzn - 0x1a90009a: 501, // mzn-IR - 0x1ab00000: 502, // nah - 0x1ae00000: 503, // naq - 0x1ae000d0: 504, // naq-NA - 0x1af00000: 505, // nb - 0x1af000d8: 506, // nb-NO - 0x1af0010e: 507, // nb-SJ - 0x1b100000: 508, // nd - 0x1b100161: 509, // nd-ZW - 0x1b400000: 510, // ne - 0x1b400097: 511, // ne-IN - 0x1b4000d9: 512, // ne-NP - 0x1bd00000: 513, // nl - 0x1bd0002f: 514, // nl-AW - 0x1bd00035: 515, // nl-BE - 0x1bd0003f: 516, // nl-BQ - 0x1bd0005a: 517, // nl-CW - 0x1bd000d7: 518, // nl-NL - 0x1bd00114: 519, // nl-SR - 0x1bd00119: 520, // nl-SX - 0x1be00000: 521, // nmg - 0x1be00051: 522, // nmg-CM - 0x1bf00000: 523, // nn - 0x1bf000d8: 524, // nn-NO - 0x1c000000: 525, // nnh - 0x1c000051: 526, // nnh-CM - 0x1c100000: 527, // no - 0x1c500000: 528, // nqo - 0x1c600000: 529, // nr - 0x1c800000: 530, // nso - 0x1c900000: 531, // nus - 0x1c900115: 532, // nus-SS - 0x1cc00000: 533, // ny - 0x1ce00000: 534, // nyn - 0x1ce0012f: 535, // nyn-UG - 0x1d200000: 536, // om - 0x1d20006e: 537, // om-ET - 0x1d2000a2: 538, // om-KE - 0x1d300000: 539, // or - 0x1d300097: 540, // or-IN - 0x1d400000: 541, // os - 0x1d40007b: 542, // os-GE - 0x1d400104: 543, // os-RU - 0x1d700000: 544, // pa - 0x1d705000: 545, // pa-Arab - 0x1d7050e6: 546, // pa-Arab-PK - 0x1d72f000: 547, // pa-Guru - 0x1d72f097: 548, // pa-Guru-IN - 0x1db00000: 549, // pap - 0x1e700000: 550, // pl - 0x1e7000e7: 551, // pl-PL - 0x1ed00000: 552, // prg - 0x1ed00001: 553, // prg-001 - 0x1ee00000: 554, // ps - 0x1ee00023: 555, // ps-AF - 0x1ef00000: 556, // pt - 0x1ef00029: 557, // pt-AO - 0x1ef00040: 558, // pt-BR - 0x1ef0004d: 559, // pt-CH - 0x1ef00059: 560, // pt-CV - 0x1ef00084: 561, // pt-GQ - 0x1ef00089: 562, // pt-GW - 0x1ef000b5: 563, // pt-LU - 0x1ef000c4: 564, // pt-MO - 0x1ef000cf: 565, // pt-MZ - 0x1ef000ec: 566, // pt-PT - 0x1ef00116: 567, // pt-ST - 0x1ef00124: 568, // pt-TL - 0x1f100000: 569, // qu - 0x1f10003e: 570, // qu-BO - 0x1f100068: 571, // qu-EC - 0x1f1000e2: 572, // qu-PE - 0x1fc00000: 573, // rm - 0x1fc0004d: 574, // rm-CH - 0x20100000: 575, // rn - 0x20100039: 576, // rn-BI - 0x20300000: 577, // ro - 0x203000ba: 578, // ro-MD - 0x20300102: 579, // ro-RO - 0x20500000: 580, // rof - 0x2050012d: 581, // rof-TZ - 0x20700000: 582, // ru - 0x20700046: 583, // ru-BY - 0x207000a3: 584, // ru-KG - 0x207000ac: 585, // ru-KZ - 0x207000ba: 586, // ru-MD - 0x20700104: 587, // ru-RU - 0x2070012e: 588, // ru-UA - 0x20a00000: 589, // rw - 0x20a00105: 590, // rw-RW - 0x20b00000: 591, // rwk - 0x20b0012d: 592, // rwk-TZ - 0x20f00000: 593, // sah - 0x20f00104: 594, // sah-RU - 0x21000000: 595, // saq - 0x210000a2: 596, // saq-KE - 0x21400000: 597, // sbp - 0x2140012d: 598, // sbp-TZ - 0x21c00000: 599, // sdh - 0x21d00000: 600, // se - 0x21d00070: 601, // se-FI - 0x21d000d8: 602, // se-NO - 0x21d0010a: 603, // se-SE - 0x21f00000: 604, // seh - 0x21f000cf: 605, // seh-MZ - 0x22100000: 606, // ses - 0x221000c1: 607, // ses-ML - 0x22200000: 608, // sg - 0x2220004b: 609, // sg-CF - 0x22600000: 610, // shi - 0x22652000: 611, // shi-Latn - 0x226520b8: 612, // shi-Latn-MA - 0x226d2000: 613, // shi-Tfng - 0x226d20b8: 614, // shi-Tfng-MA - 0x22800000: 615, // si - 0x228000b1: 616, // si-LK - 0x22a00000: 617, // sk - 0x22a0010f: 618, // sk-SK - 0x22c00000: 619, // sl - 0x22c0010d: 620, // sl-SI - 0x23000000: 621, // sma - 0x23100000: 622, // smi - 0x23200000: 623, // smj - 0x23300000: 624, // smn - 0x23300070: 625, // smn-FI - 0x23500000: 626, // sms - 0x23600000: 627, // sn - 0x23600161: 628, // sn-ZW - 0x23800000: 629, // so - 0x23800061: 630, // so-DJ - 0x2380006e: 631, // so-ET - 0x238000a2: 632, // so-KE - 0x23800113: 633, // so-SO - 0x23a00000: 634, // sq - 0x23a00026: 635, // sq-AL - 0x23a000c0: 636, // sq-MK - 0x23a0014a: 637, // sq-XK - 0x23b00000: 638, // sr - 0x23b1e000: 639, // sr-Cyrl - 0x23b1e032: 640, // sr-Cyrl-BA - 0x23b1e0bb: 641, // sr-Cyrl-ME - 0x23b1e103: 642, // sr-Cyrl-RS - 0x23b1e14a: 643, // sr-Cyrl-XK - 0x23b52000: 644, // sr-Latn - 0x23b52032: 645, // sr-Latn-BA - 0x23b520bb: 646, // sr-Latn-ME - 0x23b52103: 647, // sr-Latn-RS - 0x23b5214a: 648, // sr-Latn-XK - 0x24000000: 649, // ss - 0x24100000: 650, // ssy - 0x24200000: 651, // st - 0x24700000: 652, // sv - 0x24700030: 653, // sv-AX - 0x24700070: 654, // sv-FI - 0x2470010a: 655, // sv-SE - 0x24800000: 656, // sw - 0x2480004a: 657, // sw-CD - 0x248000a2: 658, // sw-KE - 0x2480012d: 659, // sw-TZ - 0x2480012f: 660, // sw-UG - 0x24f00000: 661, // syr - 0x25100000: 662, // ta - 0x25100097: 663, // ta-IN - 0x251000b1: 664, // ta-LK - 0x251000ce: 665, // ta-MY - 0x2510010b: 666, // ta-SG - 0x25800000: 667, // te - 0x25800097: 668, // te-IN - 0x25a00000: 669, // teo - 0x25a000a2: 670, // teo-KE - 0x25a0012f: 671, // teo-UG - 0x25d00000: 672, // th - 0x25d00121: 673, // th-TH - 0x26100000: 674, // ti - 0x2610006c: 675, // ti-ER - 0x2610006e: 676, // ti-ET - 0x26200000: 677, // tig - 0x26400000: 678, // tk - 0x26400125: 679, // tk-TM - 0x26b00000: 680, // tn - 0x26c00000: 681, // to - 0x26c00127: 682, // to-TO - 0x26f00000: 683, // tr - 0x26f0005c: 684, // tr-CY - 0x26f00129: 685, // tr-TR - 0x27200000: 686, // ts - 0x27e00000: 687, // twq - 0x27e000d2: 688, // twq-NE - 0x28200000: 689, // tzm - 0x282000b8: 690, // tzm-MA - 0x28400000: 691, // ug - 0x28400052: 692, // ug-CN - 0x28600000: 693, // uk - 0x2860012e: 694, // uk-UA - 0x28c00000: 695, // ur - 0x28c00097: 696, // ur-IN - 0x28c000e6: 697, // ur-PK - 0x28d00000: 698, // uz - 0x28d05000: 699, // uz-Arab - 0x28d05023: 700, // uz-Arab-AF - 0x28d1e000: 701, // uz-Cyrl - 0x28d1e134: 702, // uz-Cyrl-UZ - 0x28d52000: 703, // uz-Latn - 0x28d52134: 704, // uz-Latn-UZ - 0x28e00000: 705, // vai - 0x28e52000: 706, // vai-Latn - 0x28e520b2: 707, // vai-Latn-LR - 0x28ed9000: 708, // vai-Vaii - 0x28ed90b2: 709, // vai-Vaii-LR - 0x28f00000: 710, // ve - 0x29200000: 711, // vi - 0x2920013b: 712, // vi-VN - 0x29700000: 713, // vo - 0x29700001: 714, // vo-001 - 0x29a00000: 715, // vun - 0x29a0012d: 716, // vun-TZ - 0x29b00000: 717, // wa - 0x29c00000: 718, // wae - 0x29c0004d: 719, // wae-CH - 0x2a400000: 720, // wo - 0x2a900000: 721, // xh - 0x2b100000: 722, // xog - 0x2b10012f: 723, // xog-UG - 0x2b700000: 724, // yav - 0x2b700051: 725, // yav-CM - 0x2b900000: 726, // yi - 0x2b900001: 727, // yi-001 - 0x2ba00000: 728, // yo - 0x2ba0003a: 729, // yo-BJ - 0x2ba000d4: 730, // yo-NG - 0x2bd00000: 731, // yue - 0x2bd0008b: 732, // yue-HK - 0x2c300000: 733, // zgh - 0x2c3000b8: 734, // zgh-MA - 0x2c400000: 735, // zh - 0x2c434000: 736, // zh-Hans - 0x2c434052: 737, // zh-Hans-CN - 0x2c43408b: 738, // zh-Hans-HK - 0x2c4340c4: 739, // zh-Hans-MO - 0x2c43410b: 740, // zh-Hans-SG - 0x2c435000: 741, // zh-Hant - 0x2c43508b: 742, // zh-Hant-HK - 0x2c4350c4: 743, // zh-Hant-MO - 0x2c43512c: 744, // zh-Hant-TW - 0x2c600000: 745, // zu - 0x2c60015e: 746, // zu-ZA -} - -// Total table size 4550 bytes (4KiB); checksum: B6D49547 diff --git a/Godeps/_workspace/src/golang.org/x/text/language/tables.go b/Godeps/_workspace/src/golang.org/x/text/language/tables.go deleted file mode 100644 index 5de0f856af..0000000000 --- a/Godeps/_workspace/src/golang.org/x/text/language/tables.go +++ /dev/null @@ -1,2791 +0,0 @@ -// This file was generated by go generate; DO NOT EDIT - -package language - -import "golang.org/x/text/internal/tag" - -// CLDRVersion is the CLDR version from which the tables in this package are derived. -const CLDRVersion = "29" - -const numLanguages = 8654 - -const numScripts = 230 - -const numRegions = 354 - -type fromTo struct { - from uint16 - to uint16 -} - -const nonCanonicalUnd = 649 -const ( - _af = 10 - _am = 17 - _ar = 21 - _az = 36 - _bg = 56 - _bn = 75 - _ca = 97 - _cs = 121 - _da = 128 - _de = 133 - _el = 154 - _en = 155 - _es = 157 - _et = 159 - _fa = 164 - _fi = 168 - _fil = 170 - _fr = 175 - _gu = 211 - _he = 224 - _hi = 225 - _hr = 238 - _hu = 242 - _hy = 243 - _id = 248 - _is = 258 - _it = 259 - _ja = 263 - _ka = 273 - _kk = 303 - _km = 307 - _kn = 309 - _ko = 310 - _ky = 333 - _lo = 357 - _lt = 361 - _lv = 368 - _mk = 396 - _ml = 397 - _mn = 399 - _mo = 402 - _mr = 406 - _ms = 410 - _mul = 414 - _my = 421 - _nb = 431 - _ne = 436 - _nl = 445 - _no = 449 - _pa = 471 - _pl = 487 - _pt = 495 - _ro = 515 - _ru = 519 - _sh = 549 - _si = 552 - _sk = 554 - _sl = 556 - _sq = 570 - _sr = 571 - _sv = 583 - _sw = 584 - _ta = 593 - _te = 600 - _th = 605 - _tl = 616 - _tn = 619 - _tr = 623 - _uk = 646 - _ur = 652 - _uz = 653 - _vi = 658 - _zh = 708 - _zu = 710 - _jbo = 265 - _ami = 1033 - _bnn = 1740 - _hak = 221 - _tlh = 13850 - _lb = 340 - _nv = 458 - _pwn = 11438 - _tao = 13571 - _tay = 13581 - _tsu = 14045 - _nn = 447 - _sfb = 13012 - _vgt = 15084 - _sgg = 13043 - _cmn = 2390 - _nan = 428 - _hsn = 240 -) - -const langPrivateStart = 0x2d09 - -const langPrivateEnd = 0x2f10 - -// lang holds an alphabetically sorted list of ISO-639 language identifiers. -// All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag. -// For 2-byte language identifiers, the two successive bytes have the following meaning: -// - if the first letter of the 2- and 3-letter ISO codes are the same: -// the second and third letter of the 3-letter ISO code. -// - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3. -// For 3-byte language identifiers the 4th byte is 0. -var lang tag.Index = "" + // Size: 2856 bytes - "---\x00aaarabbkabr\x00ace\x00ach\x00ada\x00ady\x00aeveaeb\x00affragq\x00" + - "aho\x00akkaakk\x00aln\x00alt\x00ammhamo\x00anrgaoz\x00arraarc\x00arn\x00" + - "aro\x00arq\x00ary\x00arz\x00assmasa\x00ase\x00ast\x00atj\x00avvaawa\x00a" + - "yymazzebaakbal\x00ban\x00bap\x00bar\x00bas\x00bax\x00bbc\x00bbj\x00bci" + - "\x00beelbej\x00bem\x00bew\x00bez\x00bfd\x00bfq\x00bft\x00bfy\x00bgulbgc" + - "\x00bgn\x00bgx\x00bhihbhb\x00bhi\x00bhk\x00bho\x00biisbik\x00bin\x00bjj" + - "\x00bjn\x00bkm\x00bku\x00blt\x00bmambmq\x00bnenboodbpy\x00bqi\x00bqv\x00" + - "brrebra\x00brh\x00brx\x00bsosbsq\x00bss\x00bto\x00btv\x00bua\x00buc\x00b" + - "ug\x00bum\x00bvb\x00byn\x00byv\x00bze\x00caatcch\x00ccp\x00ceheceb\x00cg" + - "g\x00chhachk\x00chm\x00cho\x00chp\x00chr\x00cja\x00cjm\x00ckb\x00cooscop" + - "\x00cps\x00crrecrj\x00crk\x00crl\x00crm\x00crs\x00csescsb\x00csw\x00ctd" + - "\x00cuhucvhvcyymdaandak\x00dar\x00dav\x00dcc\x00deeuden\x00dgr\x00dje" + - "\x00dnj\x00doi\x00dsb\x00dtm\x00dtp\x00dty\x00dua\x00dvivdyo\x00dyu\x00d" + - "zzoebu\x00eeweefi\x00egl\x00egy\x00eky\x00elllenngeopoes\x00\x05esu\x00e" + - "tstett\x00euusewo\x00ext\x00faasfan\x00ffulffm\x00fiinfia\x00fil\x00fit" + - "\x00fjijfoaofon\x00frrafrc\x00frp\x00frr\x00frs\x00fud\x00fuq\x00fur\x00" + - "fuv\x00fvr\x00fyrygalegaa\x00gag\x00gan\x00gay\x00gbm\x00gbz\x00gcr\x00g" + - "dlagez\x00ggn\x00gil\x00gjk\x00gju\x00gllgglk\x00gnrngom\x00gon\x00gor" + - "\x00gos\x00got\x00grc\x00grt\x00gsw\x00guujgub\x00guc\x00gur\x00guw\x00g" + - "uz\x00gvlvgvr\x00gwi\x00haauhak\x00haw\x00haz\x00heebhiinhif\x00hil\x00h" + - "lu\x00hmd\x00hnd\x00hne\x00hnj\x00hnn\x00hno\x00homohoc\x00hoj\x00hrrvhs" + - "b\x00hsn\x00htathuunhyyehzerianaiba\x00ibb\x00idndieleigboiiiiikpkikt" + - "\x00ilo\x00inndinh\x00iodoisslittaiukuiw\x00\x03izh\x00japnjam\x00jbo" + - "\x00jgo\x00ji\x00\x06jmc\x00jml\x00jut\x00jvavjwavkaatkaa\x00kab\x00kac" + - "\x00kaj\x00kam\x00kao\x00kbd\x00kcg\x00kck\x00kde\x00kdt\x00kea\x00ken" + - "\x00kfo\x00kfr\x00kfy\x00kgonkge\x00kgp\x00kha\x00khb\x00khn\x00khq\x00k" + - "ht\x00khw\x00kiikkiu\x00kjuakjg\x00kkazkkj\x00klalkln\x00kmhmkmb\x00knan" + - "koorkoi\x00kok\x00kos\x00kpe\x00kraukrc\x00kri\x00krj\x00krl\x00kru\x00k" + - "sasksb\x00ksf\x00ksh\x00kuurkum\x00kvomkvr\x00kvx\x00kw\x00\x01kxm\x00kx" + - "p\x00kyirlaatlab\x00lad\x00lag\x00lah\x00laj\x00lbtzlbe\x00lbw\x00lcp" + - "\x00lep\x00lez\x00lgugliimlif\x00lij\x00lis\x00ljp\x00lki\x00lkt\x00lmn" + - "\x00lmo\x00lninloaolol\x00loz\x00lrc\x00ltitltg\x00luublua\x00luo\x00luy" + - "\x00luz\x00lvavlwl\x00lzh\x00lzz\x00mad\x00maf\x00mag\x00mai\x00mak\x00m" + - "an\x00mas\x00maz\x00mdf\x00mdh\x00mdr\x00men\x00mer\x00mfa\x00mfe\x00mgl" + - "gmgh\x00mgo\x00mgp\x00mgy\x00mhahmirimin\x00mis\x00mkkdmlalmls\x00mnonmn" + - "i\x00mnw\x00moolmoe\x00moh\x00mos\x00mrarmrd\x00mrj\x00mro\x00mssamtltmt" + - "r\x00mua\x00mul\x00mus\x00mvy\x00mwk\x00mwr\x00mwv\x00mxc\x00myyamyv\x00" + - "myx\x00myz\x00mzn\x00naaunah\x00nan\x00nap\x00naq\x00nbobnch\x00nddendc" + - "\x00nds\x00neepnew\x00ngdongl\x00nhe\x00nhw\x00nij\x00niu\x00njo\x00nlld" + - "nmg\x00nnnonnh\x00noornod\x00noe\x00non\x00nqo\x00nrblnsk\x00nso\x00nus" + - "\x00nvavnxq\x00nyyanym\x00nyn\x00nzi\x00occiojjiomrmorriosssosa\x00otk" + - "\x00paanpag\x00pal\x00pam\x00pap\x00pau\x00pcd\x00pcm\x00pdc\x00pdt\x00p" + - "eo\x00pfl\x00phn\x00pilipka\x00pko\x00plolpms\x00pnt\x00pon\x00pra\x00pr" + - "d\x00prg\x00psusptorpuu\x00quuequc\x00qug\x00raj\x00rcf\x00rej\x00rgn" + - "\x00ria\x00rif\x00rjs\x00rkt\x00rmohrmf\x00rmo\x00rmt\x00rmu\x00rnunrng" + - "\x00roonrob\x00rof\x00rtm\x00ruusrue\x00rug\x00rw\x00\x04rwk\x00ryu\x00s" + - "aansaf\x00sah\x00saq\x00sas\x00sat\x00saz\x00sbp\x00scrdsck\x00scn\x00sc" + - "o\x00scs\x00sdndsdc\x00sdh\x00semesef\x00seh\x00sei\x00ses\x00sgagsga" + - "\x00sgs\x00sh\x00\x02shi\x00shn\x00siinsid\x00sklkskr\x00sllvsli\x00sly" + - "\x00smmosma\x00smi\x00smj\x00smn\x00smp\x00sms\x00snnasnk\x00soomsou\x00" + - "sqqisrrpsrb\x00srn\x00srr\x00srx\x00ssswssy\x00stotstq\x00suunsuk\x00sus" + - "\x00svweswwaswb\x00swc\x00swg\x00swv\x00sxn\x00syl\x00syr\x00szl\x00taam" + - "taj\x00tbw\x00tcy\x00tdd\x00tdg\x00tdh\x00teeltem\x00teo\x00tet\x00tggkt" + - "hhathl\x00thq\x00thr\x00tiirtig\x00tiv\x00tkuktkl\x00tkr\x00tkt\x00tlglt" + - "ly\x00tmh\x00tnsntoontog\x00tpi\x00trurtru\x00trv\x00tssotsd\x00tsf\x00t" + - "sg\x00tsj\x00ttatttj\x00tts\x00ttt\x00tum\x00tvl\x00twwitwq\x00txg\x00ty" + - "ahtyv\x00tzm\x00udm\x00ugiguga\x00ukkruli\x00umb\x00und\x00unr\x00unx" + - "\x00urrduzzbvai\x00veenvec\x00vep\x00viievic\x00vls\x00vmf\x00vmw\x00voo" + - "lvot\x00vro\x00vun\x00walnwae\x00wal\x00war\x00wbp\x00wbq\x00wbr\x00wls" + - "\x00wni\x00woolwtm\x00wuu\x00xav\x00xcr\x00xhhoxlc\x00xld\x00xmf\x00xmn" + - "\x00xmr\x00xna\x00xnr\x00xog\x00xpr\x00xsa\x00xsr\x00yao\x00yap\x00yav" + - "\x00ybb\x00yiidyooryrl\x00yua\x00yue\x00zahazag\x00zbl\x00zdj\x00zea\x00" + - "zgh\x00zhhozmi\x00zuulzxx\x00zza\x00\xff\xff\xff\xff" - -const langNoIndexOffset = 713 - -// langNoIndex is a bit vector of all 3-letter language codes that are not used as an index -// in lookup tables. The language ids for these language codes are derived directly -// from the letters and are not consecutive. -// Size: 2197 bytes, 2197 elements -var langNoIndex = [2197]uint8{ - // Entry 0 - 3F - 0xff, 0xfd, 0xfd, 0xfe, 0xef, 0xf7, 0xbf, 0xd2, - 0xfb, 0xbf, 0xfe, 0xfa, 0xb7, 0x1d, 0x3c, 0x57, - 0x6f, 0x97, 0x73, 0xf8, 0xff, 0xef, 0xff, 0x70, - 0xaf, 0x03, 0xff, 0xff, 0xcf, 0x05, 0x85, 0x62, - 0xe9, 0xbf, 0xfd, 0xff, 0xff, 0xf7, 0xfd, 0x77, - 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, - 0xc9, 0xff, 0xff, 0xff, 0x4d, 0xb8, 0x0a, 0x6a, - 0x7e, 0xfa, 0xe3, 0xfe, 0x7e, 0xff, 0x77, 0xff, - // Entry 40 - 7F - 0xff, 0xff, 0xff, 0xdf, 0x2b, 0xf4, 0xf1, 0xe0, - 0x5d, 0xe7, 0x9f, 0x14, 0x07, 0x20, 0xdf, 0xed, - 0x9f, 0x3f, 0xc9, 0x21, 0xf8, 0x3f, 0x94, 0xf7, - 0x7e, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, - 0xff, 0xff, 0x5f, 0xfc, 0xdb, 0xfd, 0xbf, 0xb5, - 0x7b, 0xdf, 0x7f, 0xf7, 0xeb, 0xfe, 0xff, 0xa7, - 0xbd, 0xff, 0x7f, 0xf7, 0xff, 0xef, 0xef, 0xef, - 0xff, 0xff, 0x9f, 0xff, 0xff, 0xef, 0xff, 0xdf, - // Entry 80 - BF - 0xff, 0xff, 0xf3, 0xff, 0xfb, 0x2f, 0xff, 0xff, - 0xfb, 0xee, 0xff, 0xbd, 0xdb, 0xff, 0xdf, 0xf7, - 0xff, 0xfa, 0xfd, 0xff, 0x7e, 0xaf, 0x7b, 0xfe, - 0x7f, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xdf, 0xff, - 0xff, 0xdf, 0xfb, 0xff, 0xfd, 0xfc, 0xfb, 0xff, - 0xff, 0xff, 0xff, 0xf7, 0x7f, 0xbf, 0xfd, 0xd5, - 0xa5, 0x77, 0x40, 0xff, 0x9c, 0xc1, 0x41, 0x2c, - 0x08, 0x24, 0x41, 0x00, 0x50, 0x40, 0x00, 0x80, - // Entry C0 - FF - 0xfb, 0x4a, 0xf2, 0x9f, 0xb4, 0x42, 0x41, 0x96, - 0x9b, 0x14, 0x88, 0xf6, 0x7b, 0xe7, 0x17, 0x56, - 0x55, 0x7d, 0x0e, 0x1c, 0x37, 0x71, 0xf3, 0xef, - 0x97, 0xff, 0x5d, 0x38, 0x64, 0x08, 0x00, 0x10, - 0xbc, 0x87, 0xaf, 0xdf, 0xff, 0xf7, 0x73, 0x35, - 0x3e, 0x87, 0xc7, 0xdf, 0xff, 0x00, 0x81, 0x00, - 0xb0, 0x05, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, - 0x40, 0x00, 0x40, 0x92, 0x21, 0xd0, 0xbf, 0x5d, - // Entry 100 - 13F - 0xfd, 0xde, 0xfe, 0x5e, 0x00, 0x00, 0x02, 0x64, - 0x8d, 0x19, 0xc1, 0xdf, 0x79, 0x22, 0x00, 0x00, - 0x00, 0xdf, 0x6d, 0xdc, 0x26, 0xe5, 0xd9, 0xf3, - 0xfe, 0xff, 0xfd, 0xcb, 0x9f, 0x14, 0x01, 0x0c, - 0x86, 0x00, 0xd1, 0x00, 0xf0, 0xc5, 0x67, 0x5f, - 0x56, 0x89, 0x5e, 0xb7, 0xec, 0xef, 0x03, 0x00, - 0x02, 0x00, 0x00, 0x00, 0xc0, 0x77, 0xda, 0x57, - 0x90, 0x69, 0x01, 0x2c, 0x96, 0x79, 0xe0, 0xff, - // Entry 140 - 17F - 0xff, 0x7f, 0x00, 0x00, 0x00, 0x01, 0x08, 0x56, - 0x01, 0x00, 0x00, 0xb0, 0x14, 0x03, 0x50, 0x16, - 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x09, - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x00, 0x00, 0x44, 0x00, 0x00, 0x10, 0x00, 0x04, - 0x08, 0x00, 0x00, 0x04, 0x00, 0x80, 0x28, 0x04, - 0x00, 0x00, 0x50, 0xd5, 0x2d, 0x00, 0x64, 0x35, - 0x24, 0x53, 0xf5, 0xd4, 0xbd, 0xe2, 0xcd, 0x03, - // Entry 180 - 1BF - 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x17, 0x39, 0x01, 0xdd, 0x57, 0x98, - 0x21, 0x98, 0xa5, 0x00, 0x00, 0x01, 0x40, 0x82, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x40, 0x00, 0x44, 0x00, 0x00, 0xb0, 0xfe, - 0xa9, 0x39, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - // Entry 1C0 - 1FF - 0x00, 0x01, 0x28, 0x05, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x20, 0x04, 0xa6, 0x08, 0x04, 0x00, 0x08, - 0x81, 0x50, 0x00, 0x00, 0x08, 0x11, 0x86, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x06, 0x55, - 0x02, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x60, - 0x3b, 0x83, 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xbe, 0xdf, 0xff, 0xfe, 0xbf, - // Entry 200 - 23F - 0xdf, 0xc7, 0x83, 0x82, 0xc0, 0xff, 0xdf, 0x27, - 0xcf, 0x5f, 0xe7, 0x01, 0x10, 0x20, 0xb2, 0xc5, - 0xa4, 0x45, 0x25, 0x9b, 0x03, 0xcf, 0xf0, 0xdf, - 0x03, 0xc4, 0x08, 0x10, 0x01, 0x0e, 0x01, 0xe3, - 0x92, 0x54, 0xdb, 0x38, 0xf1, 0x7f, 0xf7, 0x6d, - 0xf9, 0xff, 0x1c, 0x7d, 0x04, 0x08, 0x00, 0x01, - 0x21, 0x12, 0x6c, 0x5f, 0xdd, 0x0f, 0x85, 0x4f, - 0x40, 0x40, 0x00, 0x04, 0xf9, 0xfd, 0xbd, 0xd4, - // Entry 240 - 27F - 0xe8, 0x13, 0xf4, 0x27, 0xa3, 0x0d, 0x00, 0x00, - 0x20, 0x7b, 0x39, 0x02, 0x05, 0x84, 0x00, 0xf0, - 0xbf, 0x7f, 0xda, 0x00, 0x18, 0x04, 0x81, 0x00, - 0x00, 0x00, 0x80, 0x10, 0x94, 0x1c, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x04, - 0x08, 0xb4, 0x7c, 0xa5, 0x0c, 0x40, 0x00, 0x00, - 0x11, 0x04, 0x04, 0x6c, 0x00, 0x20, 0x70, 0xff, - 0xfb, 0x7f, 0x60, 0x00, 0x05, 0x9b, 0xdd, 0x6e, - // Entry 280 - 2BF - 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x40, 0x05, - 0xb5, 0xb6, 0x80, 0x08, 0x04, 0x00, 0x04, 0x51, - 0xe2, 0xff, 0xfd, 0x3f, 0x05, 0x09, 0x08, 0x05, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x02, 0x60, - 0xe5, 0x48, 0x14, 0x89, 0x20, 0xc0, 0x47, 0x80, - 0x07, 0x00, 0x00, 0x00, 0xcc, 0x50, 0x40, 0x24, - 0x85, 0x47, 0x84, 0x40, 0x20, 0x10, 0x00, 0x20, - // Entry 2C0 - 2FF - 0x02, 0x50, 0x88, 0x11, 0x00, 0xd1, 0x6c, 0xee, - 0x50, 0x27, 0x1d, 0x11, 0x69, 0x06, 0x59, 0xe9, - 0x33, 0x08, 0x00, 0x20, 0x05, 0x40, 0x10, 0x00, - 0x00, 0x00, 0x50, 0x44, 0x96, 0x49, 0xd6, 0x5d, - 0xa7, 0x81, 0x47, 0x97, 0xfb, 0x00, 0x10, 0x00, - 0x08, 0x00, 0x80, 0x00, 0x40, 0x45, 0x00, 0x01, - 0x02, 0x00, 0x01, 0x40, 0x80, 0x00, 0x04, 0x08, - 0xf8, 0xeb, 0xf6, 0x39, 0xc4, 0x89, 0x16, 0x00, - // Entry 300 - 33F - 0x00, 0x0c, 0x04, 0x01, 0x20, 0x20, 0xdd, 0xa2, - 0x01, 0x00, 0x00, 0x00, 0x12, 0x04, 0x00, 0x00, - 0x04, 0x10, 0xf0, 0x9d, 0x95, 0x13, 0x04, 0x80, - 0x00, 0x01, 0xd0, 0x12, 0x40, 0x00, 0x10, 0xb0, - 0x10, 0x62, 0x4c, 0xd2, 0x02, 0x01, 0x4a, 0x00, - 0x46, 0x04, 0x00, 0x08, 0x02, 0x00, 0x20, 0xc0, - 0x00, 0x80, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0xf0, 0xd8, 0x6f, 0x15, 0x02, 0x08, 0x00, - // Entry 340 - 37F - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, - 0x00, 0x10, 0x00, 0x00, 0x00, 0xf8, 0x85, 0xe3, - 0xdd, 0xff, 0xff, 0xff, 0xbb, 0xff, 0x7f, 0xfb, - 0xff, 0xfc, 0xfe, 0xdf, 0xff, 0xff, 0xff, 0xf6, - 0xfb, 0xfe, 0xf7, 0x1f, 0xff, 0xb3, 0xed, 0xff, - 0xdb, 0xed, 0xff, 0xfe, 0xff, 0xfe, 0xdf, 0xff, - 0xff, 0xff, 0xf7, 0xff, 0xfd, 0xff, 0xff, 0xff, - 0xfd, 0xff, 0xdf, 0xaf, 0x9c, 0xff, 0xfb, 0xff, - // Entry 380 - 3BF - 0xff, 0xff, 0xff, 0xff, 0xef, 0xd2, 0xbb, 0xdf, - 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xef, - 0xfd, 0xff, 0xff, 0xf7, 0xfd, 0xff, 0xff, 0xff, - 0xef, 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x5f, 0xd3, 0x7b, 0xfd, 0xd9, 0xdf, 0xef, - 0xbc, 0x18, 0x05, 0x2c, 0xff, 0x07, 0xf0, 0xff, - 0xf7, 0x5f, 0x00, 0x08, 0x00, 0xc3, 0x3d, 0x1b, - 0x06, 0xe6, 0x72, 0xf0, 0xdd, 0x3c, 0x7f, 0x44, - // Entry 3C0 - 3FF - 0x02, 0x30, 0x9f, 0x7a, 0x16, 0xfd, 0xff, 0x57, - 0xf2, 0xff, 0x39, 0xff, 0xf2, 0x1e, 0x95, 0xf7, - 0xf7, 0xff, 0x45, 0x80, 0x01, 0x02, 0x00, 0x00, - 0x40, 0x54, 0x9f, 0x8a, 0xd9, 0xd9, 0x0e, 0x11, - 0x84, 0x51, 0xc0, 0xf3, 0xfb, 0x47, 0x00, 0x01, - 0x05, 0xd1, 0x50, 0x58, 0x00, 0x00, 0x00, 0x10, - 0x04, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x17, 0xd2, - 0xf9, 0xfd, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, - // Entry 400 - 43F - 0xd7, 0x6f, 0xff, 0xff, 0xdf, 0x7d, 0xbb, 0xff, - 0xff, 0xff, 0xf7, 0xf3, 0xef, 0xff, 0xff, 0xf7, - 0xff, 0xdf, 0xdb, 0x7f, 0xff, 0xff, 0x7f, 0xff, - 0xff, 0xff, 0xef, 0xff, 0xbc, 0xff, 0xff, 0xfb, - 0xff, 0xfb, 0xff, 0xde, 0x76, 0xbd, 0xff, 0xf7, - 0xff, 0xff, 0xf7, 0xff, 0xff, 0xdf, 0xf3, 0xfe, - 0xef, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xde, - 0xf7, 0xbb, 0xef, 0xf7, 0xff, 0xfb, 0xbf, 0xdf, - // Entry 440 - 47F - 0xfd, 0xfe, 0xff, 0xff, 0xfe, 0xff, 0x5f, 0x7d, - 0x7f, 0xff, 0xff, 0xf7, 0xe5, 0xfc, 0xff, 0xfd, - 0x7f, 0x7f, 0xff, 0x9e, 0xae, 0xff, 0xee, 0xff, - 0x7f, 0xf7, 0x7b, 0x02, 0x82, 0x04, 0xff, 0xf7, - 0xff, 0xbf, 0xd7, 0xef, 0xfe, 0xdf, 0xf7, 0xfe, - 0xe2, 0x8e, 0xe7, 0xff, 0xf7, 0xff, 0x56, 0xbd, - 0xcd, 0xff, 0xfb, 0xff, 0xff, 0xdf, 0xef, 0xff, - 0xe5, 0xdf, 0x7d, 0x0f, 0xa7, 0x51, 0x04, 0x44, - // Entry 480 - 4BF - 0x13, 0xd0, 0x5d, 0xaf, 0xa6, 0xfd, 0xb9, 0xff, - 0x63, 0x5d, 0x5b, 0xff, 0xff, 0xbf, 0x3f, 0x20, - 0x14, 0x00, 0x57, 0x51, 0x82, 0x65, 0xf5, 0x49, - 0xe2, 0xff, 0xfc, 0xdf, 0x00, 0x05, 0xc5, 0x05, - 0x00, 0x22, 0x00, 0x74, 0x69, 0x10, 0x08, 0x04, - 0x41, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x51, 0x60, 0x05, 0x04, 0x01, 0x00, 0x00, - 0x06, 0x01, 0x20, 0x00, 0x18, 0x01, 0x92, 0xb1, - // Entry 4C0 - 4FF - 0xfd, 0x67, 0x4b, 0x06, 0x95, 0x06, 0x57, 0xed, - 0xfb, 0x4c, 0x9d, 0x7b, 0x83, 0x04, 0x62, 0x40, - 0x00, 0x15, 0x42, 0x00, 0x00, 0x00, 0x54, 0x83, - 0xf9, 0x4f, 0x10, 0x8c, 0xc9, 0x46, 0xde, 0xf7, - 0x13, 0x31, 0x00, 0x20, 0x00, 0x00, 0x00, 0x90, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x00, - 0x01, 0x40, 0x00, 0xf0, 0x5b, 0xf4, 0xbe, 0x7d, - 0xba, 0xcf, 0xf7, 0xaf, 0x42, 0x04, 0x84, 0x41, - // Entry 500 - 53F - 0xb0, 0xff, 0x79, 0x7a, 0x04, 0x00, 0x00, 0x49, - 0x2d, 0x14, 0x27, 0x77, 0xed, 0xf1, 0xbf, 0xef, - 0x3f, 0x00, 0x00, 0x02, 0xc6, 0xa0, 0x1e, 0xfc, - 0xbb, 0xff, 0xfd, 0xfb, 0xb7, 0xfd, 0xf5, 0xff, - 0xfd, 0xfc, 0xd5, 0xed, 0x47, 0xf4, 0x7f, 0x10, - 0x01, 0x01, 0x84, 0x6d, 0xff, 0xf7, 0xdd, 0xf9, - 0x5f, 0x05, 0x86, 0xef, 0xf5, 0x77, 0xbd, 0x3c, - 0x00, 0x00, 0x00, 0x43, 0x71, 0x42, 0x00, 0x40, - // Entry 540 - 57F - 0x00, 0x00, 0x01, 0x43, 0x19, 0x00, 0x08, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - // Entry 580 - 5BF - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xab, 0xbd, 0xe7, 0x57, 0xee, 0x13, 0x5d, - 0x09, 0xc1, 0x40, 0x21, 0xfa, 0x17, 0x01, 0x80, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0xde, 0xff, 0xbf, - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, - 0x00, 0x30, 0x95, 0xe3, 0x10, 0x00, 0x00, 0x00, - 0x11, 0x04, 0x16, 0x00, 0x01, 0x02, 0x00, 0x81, - 0xa3, 0x01, 0x50, 0x00, 0x00, 0x83, 0x11, 0x40, - // Entry 5C0 - 5FF - 0x00, 0x00, 0x00, 0xf0, 0xdd, 0x7b, 0x7e, 0x02, - 0xaa, 0x10, 0x5d, 0xd8, 0x52, 0x00, 0x80, 0x20, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x02, 0x02, - 0x19, 0x00, 0x10, 0x02, 0x10, 0x61, 0x5a, 0x9d, - 0x31, 0x00, 0x00, 0x00, 0x01, 0x50, 0x02, 0x20, - 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x20, 0x00, - 0x00, 0x1f, 0xdf, 0xf2, 0xfd, 0xff, 0xfd, 0x3f, - 0x9f, 0x18, 0xcf, 0x9c, 0xbf, 0xaf, 0x5f, 0xfe, - // Entry 600 - 63F - 0x7b, 0x4b, 0x40, 0x10, 0xe1, 0xfd, 0xaf, 0xfd, - 0xb7, 0xf7, 0xff, 0xf3, 0xdf, 0xff, 0x6f, 0xf1, - 0x7b, 0xf1, 0x7f, 0xdf, 0x7f, 0xbf, 0xfe, 0xb7, - 0xee, 0x1c, 0xfb, 0xdb, 0xef, 0xdf, 0xff, 0xfd, - 0x7e, 0xbe, 0x57, 0xff, 0x6f, 0x81, 0x76, 0x1f, - 0xd4, 0x77, 0xf5, 0xfd, 0xff, 0xff, 0xeb, 0xfe, - 0xbf, 0x5f, 0x57, 0x1b, 0xeb, 0x5f, 0x50, 0x18, - 0x02, 0xfa, 0xff, 0x9d, 0x15, 0x97, 0x15, 0x0f, - // Entry 640 - 67F - 0x75, 0xc4, 0x7d, 0x81, 0x82, 0xf1, 0xd7, 0x7e, - 0xff, 0xff, 0xff, 0xef, 0xff, 0xfd, 0xdd, 0xde, - 0xfc, 0xfd, 0xf6, 0x5f, 0x7a, 0x1f, 0x40, 0x98, - 0x02, 0xff, 0xe3, 0xff, 0xf3, 0xd6, 0xf2, 0xff, - 0xfb, 0xdf, 0x7d, 0x50, 0x1e, 0x15, 0x7b, 0xb4, - 0xf5, 0xbe, 0xff, 0xff, 0xf3, 0xf7, 0xff, 0xf7, - 0x7f, 0xff, 0xff, 0xbe, 0xdb, 0xf7, 0xd7, 0xf9, - 0xef, 0x2f, 0x80, 0xbf, 0xc5, 0xff, 0xff, 0xf3, - // Entry 680 - 6BF - 0x97, 0x9d, 0xff, 0xff, 0xf7, 0xcf, 0xfd, 0xbf, - 0xde, 0x7f, 0x06, 0x1d, 0x57, 0xff, 0xf8, 0xda, - 0x5d, 0xce, 0x7d, 0x16, 0xb9, 0xea, 0x69, 0xa0, - 0x1a, 0x20, 0x00, 0x30, 0x02, 0x04, 0x24, 0x48, - 0x04, 0x00, 0x00, 0x40, 0xd4, 0x02, 0x04, 0x00, - 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x01, 0x06, - 0x50, 0x00, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00, - 0x04, 0x00, 0x10, 0x8c, 0x58, 0xd5, 0x0d, 0x0f, - // Entry 6C0 - 6FF - 0x14, 0x4d, 0xf1, 0x16, 0x44, 0xd1, 0x42, 0x08, - 0x40, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00, - 0x00, 0xdc, 0xff, 0xeb, 0x1f, 0x58, 0x08, 0x41, - 0x04, 0xa0, 0x04, 0x00, 0x30, 0x12, 0x40, 0x22, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x80, 0x10, 0x10, 0xaf, - 0x6f, 0x93, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x80, 0x25, 0x00, 0x00, - // Entry 700 - 73F - 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, - 0x80, 0x86, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x01, - 0xdf, 0x18, 0x00, 0x00, 0x02, 0xf0, 0xfd, 0x79, - 0x3b, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, - 0x03, 0x00, 0x09, 0x20, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 740 - 77F - 0x00, 0x00, 0x00, 0xef, 0xf7, 0xfd, 0xcf, 0x7e, - 0xa0, 0x11, 0x10, 0x00, 0x00, 0x92, 0x01, 0x44, - 0xcd, 0xf9, 0x5e, 0x00, 0x01, 0x00, 0x30, 0x14, - 0x04, 0x55, 0x10, 0x01, 0x04, 0xf6, 0x3f, 0x7a, - 0x05, 0x04, 0x00, 0xb0, 0x80, 0x00, 0x55, 0x55, - 0x97, 0x7c, 0x9f, 0x71, 0xcc, 0x78, 0xd1, 0x43, - 0xf5, 0x57, 0x67, 0x14, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x2c, 0xf7, 0xdb, 0x1f, 0x54, 0x60, - // Entry 780 - 7BF - 0x03, 0x68, 0x01, 0x10, 0x8b, 0x38, 0xaa, 0x01, - 0x00, 0x00, 0x30, 0x00, 0x24, 0x44, 0x00, 0x00, - 0x10, 0x03, 0x11, 0x02, 0x01, 0x00, 0x00, 0xf0, - 0xf5, 0xff, 0xd5, 0xd7, 0xbc, 0x70, 0xd6, 0x78, - 0x78, 0x15, 0x50, 0x00, 0xa4, 0x84, 0xe9, 0x41, - 0x00, 0x00, 0x00, 0x6b, 0x39, 0x52, 0x74, 0x00, - 0xe8, 0x30, 0x90, 0x6a, 0x92, 0x00, 0x00, 0x02, - 0xff, 0xef, 0xff, 0x4f, 0x85, 0x53, 0xf4, 0xed, - // Entry 7C0 - 7FF - 0xdd, 0xbf, 0x72, 0x19, 0xc7, 0x0c, 0xf5, 0x42, - 0x54, 0xdd, 0x77, 0x14, 0x00, 0x80, 0xc0, 0x56, - 0xcc, 0x16, 0x9e, 0xfb, 0x35, 0x7d, 0xef, 0xff, - 0xbd, 0xa4, 0xaf, 0x01, 0x44, 0x18, 0x01, 0x5d, - 0x4e, 0x4a, 0x08, 0x50, 0x28, 0x30, 0xe0, 0x80, - 0x10, 0x20, 0x24, 0x00, 0xff, 0x3f, 0xdf, 0x67, - 0xfe, 0x01, 0x06, 0x88, 0x0a, 0x40, 0x16, 0x01, - 0x01, 0x15, 0x2b, 0x3e, 0x01, 0x00, 0x00, 0x10, - // Entry 800 - 83F - 0x90, 0x69, 0x45, 0x02, 0x02, 0x01, 0xe1, 0xbf, - 0xbf, 0x03, 0x00, 0x00, 0x10, 0xd4, 0xa7, 0xd1, - 0x54, 0x9e, 0x44, 0xdf, 0xfd, 0x8f, 0x66, 0xb3, - 0x55, 0x20, 0xd4, 0xc3, 0xd8, 0x30, 0x3d, 0x80, - 0x00, 0x00, 0x00, 0x4c, 0xd4, 0x11, 0xc5, 0x84, - 0x6e, 0x50, 0x00, 0x22, 0x50, 0x6e, 0xbf, 0xdb, - 0x07, 0x00, 0x20, 0x10, 0x84, 0xb2, 0x45, 0x10, - 0x06, 0x44, 0x00, 0x00, 0x12, 0x02, 0x11, 0x00, - // Entry 840 - 87F - 0xf0, 0xfb, 0xfd, 0x3f, 0x05, 0x00, 0x12, 0x81, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x02, 0x28, - 0x84, 0x00, 0x33, 0xc0, 0x23, 0x24, 0x00, 0x00, - 0x00, 0xcb, 0xe4, 0x3a, 0x42, 0xc8, 0x14, 0xf1, - 0xef, 0xff, 0x7f, 0x16, 0x01, 0x01, 0x84, 0x50, - 0x07, 0xfc, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x40, - 0x10, 0x38, 0x01, 0x01, 0x1c, 0x12, 0x40, 0xe1, - // Entry 880 - 8BF - 0x76, 0x16, 0x08, 0x03, 0x10, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x24, - 0x0a, 0x00, 0x80, 0x00, 0x00, -} - -// altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives -// to 2-letter language codes that cannot be derived using the method described above. -// Each 3-letter code is followed by its 1-byte langID. -var altLangISO3 tag.Index = "---\x00cor\x00hbs\x01heb\x02kin\x03spa\x04yid\x05\xff\xff\xff\xff" - -// altLangIndex is used to convert indexes in altLangISO3 to langIDs. -// Size: 12 bytes, 6 elements -var altLangIndex = [6]uint16{ - 0x014a, 0x0225, 0x0105, 0x020a, 0x009d, 0x010b, -} - -// langAliasMap maps langIDs to their suggested replacements. -// Size: 640 bytes, 160 elements -var langAliasMap = [160]fromTo{ - 0: {from: 0xc4, to: 0xda}, - 1: {from: 0xff, to: 0xf8}, - 2: {from: 0x105, to: 0xe0}, - 3: {from: 0x10b, to: 0x2b9}, - 4: {from: 0x110, to: 0x10f}, - 5: {from: 0x192, to: 0x203}, - 6: {from: 0x1af, to: 0x1c1}, - 7: {from: 0x225, to: 0x23b}, - 8: {from: 0x268, to: 0xaa}, - 9: {from: 0x274, to: 0x252}, - 10: {from: 0x27d, to: 0xd}, - 11: {from: 0x2d5, to: 0x2db}, - 12: {from: 0x326, to: 0x93}, - 13: {from: 0x3c7, to: 0x1c48}, - 14: {from: 0x3e8, to: 0x23a}, - 15: {from: 0x3f9, to: 0x23a}, - 16: {from: 0x484, to: 0x15}, - 17: {from: 0x48f, to: 0xf3}, - 18: {from: 0x4d5, to: 0x1f38}, - 19: {from: 0x54a, to: 0x23}, - 20: {from: 0x550, to: 0x2732}, - 21: {from: 0x55c, to: 0x24}, - 22: {from: 0x57d, to: 0xa1}, - 23: {from: 0x5a3, to: 0x26}, - 24: {from: 0x5ac, to: 0x42}, - 25: {from: 0x615, to: 0x5a7}, - 26: {from: 0x65a, to: 0xc7a}, - 27: {from: 0x786, to: 0x1a5}, - 28: {from: 0x7cd, to: 0x16e}, - 29: {from: 0x7d4, to: 0x59}, - 30: {from: 0x855, to: 0x30b9}, - 31: {from: 0x8cf, to: 0x2c4}, - 32: {from: 0x90c, to: 0x23f1}, - 33: {from: 0x915, to: 0x95a}, - 34: {from: 0x932, to: 0x24f}, - 35: {from: 0x953, to: 0x3fc0}, - 36: {from: 0x956, to: 0x2c4}, - 37: {from: 0x995, to: 0x2b3e}, - 38: {from: 0x9c5, to: 0x2f18}, - 39: {from: 0xa50, to: 0x73}, - 40: {from: 0xa9f, to: 0x79}, - 41: {from: 0xb5f, to: 0x8a}, - 42: {from: 0xb6e, to: 0x1a2}, - 43: {from: 0xb8f, to: 0xb92}, - 44: {from: 0xb95, to: 0x2c8}, - 45: {from: 0xc76, to: 0x1df1}, - 46: {from: 0xc85, to: 0x2c31}, - 47: {from: 0xcd0, to: 0x1bd}, - 48: {from: 0xe67, to: 0x9f}, - 49: {from: 0xe9b, to: 0x179}, - 50: {from: 0xf37, to: 0xfc}, - 51: {from: 0x1010, to: 0xd}, - 52: {from: 0x11bb, to: 0xaf}, - 53: {from: 0x1207, to: 0xa6}, - 54: {from: 0x12b6, to: 0xb32}, - 55: {from: 0x12ba, to: 0x1d2}, - 56: {from: 0x12c9, to: 0x145c}, - 57: {from: 0x1317, to: 0x111}, - 58: {from: 0x131a, to: 0x85}, - 59: {from: 0x133a, to: 0x3a46}, - 60: {from: 0x1401, to: 0xcc}, - 61: {from: 0x145f, to: 0x9a}, - 62: {from: 0x1497, to: 0x278f}, - 63: {from: 0x14af, to: 0xca}, - 64: {from: 0x14be, to: 0xcd6}, - 65: {from: 0x1511, to: 0x12bb}, - 66: {from: 0x15a0, to: 0x154d}, - 67: {from: 0x15ad, to: 0x168a}, - 68: {from: 0x1621, to: 0x23f}, - 69: {from: 0x1710, to: 0x1a98}, - 70: {from: 0x180b, to: 0x2947}, - 71: {from: 0x1821, to: 0x102}, - 72: {from: 0x18f1, to: 0x104}, - 73: {from: 0x191d, to: 0x12ac}, - 74: {from: 0x1dcf, to: 0x3548}, - 75: {from: 0x1dd4, to: 0x1e74}, - 76: {from: 0x1df1, to: 0x18f}, - 77: {from: 0x1e7a, to: 0x145}, - 78: {from: 0x1e85, to: 0x13b}, - 79: {from: 0x1e89, to: 0x122}, - 80: {from: 0x1e90, to: 0x138}, - 81: {from: 0x1ea6, to: 0x1f82}, - 82: {from: 0x1ecc, to: 0x147}, - 83: {from: 0x1f30, to: 0x8d}, - 84: {from: 0x1f65, to: 0x12f8}, - 85: {from: 0x1f7d, to: 0x4235}, - 86: {from: 0x1f8b, to: 0x371a}, - 87: {from: 0x1fc4, to: 0x8d}, - 88: {from: 0x1fce, to: 0x8d}, - 89: {from: 0x1ff9, to: 0x6c1}, - 90: {from: 0x20ad, to: 0x2fbd}, - 91: {from: 0x2119, to: 0x30fc}, - 92: {from: 0x2209, to: 0x170}, - 93: {from: 0x227b, to: 0x18c}, - 94: {from: 0x2287, to: 0x189}, - 95: {from: 0x2291, to: 0x19a}, - 96: {from: 0x22e7, to: 0x8f2}, - 97: {from: 0x2340, to: 0x69}, - 98: {from: 0x23d5, to: 0x179}, - 99: {from: 0x2460, to: 0x244b}, - 100: {from: 0x2490, to: 0x1f4}, - 101: {from: 0x24be, to: 0x3a46}, - 102: {from: 0x24fc, to: 0x244b}, - 103: {from: 0x2520, to: 0x40ef}, - 104: {from: 0x2686, to: 0x25ce}, - 105: {from: 0x26ab, to: 0x1b4}, - 106: {from: 0x271d, to: 0x2b3e}, - 107: {from: 0x28b1, to: 0x1d1}, - 108: {from: 0x2993, to: 0x1d3}, - 109: {from: 0x29d6, to: 0x3a46}, - 110: {from: 0x2a93, to: 0x1ee}, - 111: {from: 0x2aaa, to: 0x32e}, - 112: {from: 0x2ade, to: 0xa4}, - 113: {from: 0x2adf, to: 0xa4}, - 114: {from: 0x2b96, to: 0x183}, - 115: {from: 0x2b9f, to: 0x1763}, - 116: {from: 0x2bb1, to: 0x2b2c}, - 117: {from: 0x2bb8, to: 0x152}, - 118: {from: 0x2beb, to: 0x37}, - 119: {from: 0x2bfc, to: 0x2019}, - 120: {from: 0x2c37, to: 0x2c32}, - 121: {from: 0x2c86, to: 0x2c6e}, - 122: {from: 0x2f2a, to: 0x1f1}, - 123: {from: 0x30fd, to: 0x3125}, - 124: {from: 0x31c1, to: 0x203}, - 125: {from: 0x3285, to: 0x1667}, - 126: {from: 0x337d, to: 0x22a}, - 127: {from: 0x33ef, to: 0x132}, - 128: {from: 0x340d, to: 0x215}, - 129: {from: 0x3494, to: 0x248}, - 130: {from: 0x3557, to: 0x8d}, - 131: {from: 0x35ad, to: 0x3689}, - 132: {from: 0x35c2, to: 0x2a32}, - 133: {from: 0x35c6, to: 0x4c}, - 134: {from: 0x35c9, to: 0x2fbf}, - 135: {from: 0x3603, to: 0x373d}, - 136: {from: 0x3629, to: 0x3d57}, - 137: {from: 0x363c, to: 0x376e}, - 138: {from: 0x364b, to: 0x1d3b}, - 139: {from: 0x364c, to: 0x2c31}, - 140: {from: 0x36f3, to: 0x26a}, - 141: {from: 0x38e5, to: 0xb28}, - 142: {from: 0x390f, to: 0xe91}, - 143: {from: 0x3a30, to: 0x28d}, - 144: {from: 0x3d54, to: 0x7f}, - 145: {from: 0x3f9f, to: 0x828}, - 146: {from: 0x4055, to: 0x30a}, - 147: {from: 0x4090, to: 0x3cf7}, - 148: {from: 0x410f, to: 0x13a}, - 149: {from: 0x4162, to: 0x3462}, - 150: {from: 0x4164, to: 0x86}, - 151: {from: 0x4246, to: 0x30b9}, - 152: {from: 0x427a, to: 0x2b9}, - 153: {from: 0x4361, to: 0x21a0}, - 154: {from: 0x4374, to: 0x2473}, - 155: {from: 0x43a7, to: 0x4645}, - 156: {from: 0x4445, to: 0x4437}, - 157: {from: 0x44d5, to: 0x44dc}, - 158: {from: 0x46ad, to: 0x19a}, - 159: {from: 0x473e, to: 0x2be}, -} - -// Size: 160 bytes, 160 elements -var langAliasTypes = [160]langAliasType{ - // Entry 0 - 3F - 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 1, 0, 0, 1, 2, 1, - 1, 2, 0, 1, 0, 1, 2, 1, 1, 0, 0, 2, 1, 1, 0, 2, - 0, 0, 1, 0, 1, 0, 0, 1, 2, 1, 1, 1, 1, 0, 0, 2, - 1, 1, 1, 1, 2, 1, 0, 1, 1, 2, 2, 0, 1, 2, 0, 1, - // Entry 40 - 7F - 0, 1, 1, 1, 1, 0, 0, 2, 1, 0, 0, 0, 1, 1, 1, 1, - 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 2, 2, 2, - 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, - 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 2, 0, 2, 1, - // Entry 80 - BF - 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, - 2, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, -} - -const ( - _Latn = 82 - _Hani = 50 - _Hans = 52 - _Hant = 53 - _Qaaa = 131 - _Qaai = 139 - _Qabx = 180 - _Zinh = 224 - _Zyyy = 229 - _Zzzz = 230 -) - -// script is an alphabetically sorted list of ISO 15924 codes. The index -// of the script in the string, divided by 4, is the internal scriptID. -var script tag.Index = "" + // Size: 928 bytes - "----AdlmAfakAghbAhomArabAranArmiArmnAvstBaliBamuBassBatkBengBhksBlisBopo" + - "BrahBraiBugiBuhdCakmCansCariChamCherCirtCoptCprtCyrlCyrsDevaDsrtDuplEgyd" + - "EgyhEgypElbaEthiGeokGeorGlagGothGranGrekGujrGuruHanbHangHaniHanoHansHant" + - "HatrHebrHiraHluwHmngHrktHungIndsItalJamoJavaJpanJurcKaliKanaKharKhmrKhoj" + - "KitlKitsKndaKoreKpelKthiLanaLaooLatfLatgLatnLekeLepcLimbLinaLinbLisuLoma" + - "LyciLydiMahjMandManiMarcMayaMendMercMeroMlymModiMongMoonMrooMteiMultMymr" + - "NarbNbatNewaNkgbNkooNshuOgamOlckOrkhOryaOsgeOsmaPalmPaucPermPhagPhliPhlp" + - "PhlvPhnxPiqdPlrdPrtiQaaaQaabQaacQaadQaaeQaafQaagQaahQaaiQaajQaakQaalQaam" + - "QaanQaaoQaapQaaqQaarQaasQaatQaauQaavQaawQaaxQaayQaazQabaQabbQabcQabdQabe" + - "QabfQabgQabhQabiQabjQabkQablQabmQabnQaboQabpQabqQabrQabsQabtQabuQabvQabw" + - "QabxRjngRoroRunrSamrSaraSarbSaurSgnwShawShrdSiddSindSinhSoraSundSyloSyrc" + - "SyreSyrjSyrnTagbTakrTaleTaluTamlTangTavtTeluTengTfngTglgThaaThaiTibtTirh" + - "UgarVaiiVispWaraWoleXpeoXsuxYiiiZinhZmthZsyeZsymZxxxZyyyZzzz\xff\xff\xff" + - "\xff" - -// suppressScript is an index from langID to the dominant script for that language, -// if it exists. If a script is given, it should be suppressed from the language tag. -// Size: 713 bytes, 713 elements -var suppressScript = [713]uint8{ - // Entry 0 - 3F - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x27, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 40 - 7F - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, - // Entry 80 - BF - 0x52, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, - 0xd4, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x2d, 0x52, 0x52, 0x52, 0x00, 0x52, - 0x00, 0x52, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x52, 0x00, 0x00, 0x00, 0x52, 0x52, 0x00, 0x52, - 0x00, 0x00, 0x52, 0x52, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x52, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry C0 - FF - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x52, 0x2e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x37, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x52, - 0x00, 0x52, 0x52, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, - // Entry 100 - 13F - 0x00, 0x00, 0x52, 0x52, 0x00, 0x37, 0x00, 0x41, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, - 0x00, 0x52, 0x00, 0x46, 0x00, 0x4a, 0x4b, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 140 - 17F - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0x4f, 0x00, 0x00, - 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, - // Entry 180 - 1BF - 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x00, 0x00, 0x00, 0x1e, 0x64, 0x00, 0x00, - 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, - 0x00, 0x00, 0x52, 0x52, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, - 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x52, - 0x00, 0x52, 0x00, 0x52, 0x20, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x52, 0x00, 0x52, 0x00, 0x52, - // Entry 1C0 - 1FF - 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, 0x52, 0x00, - 0x52, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x52, 0x75, 0x00, 0x00, 0x00, 0x2f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x52, - 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, - // Entry 200 - 23F - 0x00, 0x52, 0x00, 0x52, 0x00, 0x00, 0x00, 0x1e, - 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc1, 0x00, 0x52, 0x00, 0x52, 0x00, 0x00, 0x52, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 240 - 27F - 0x52, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x52, - 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xd0, 0x52, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, - 0x00, 0x27, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, - 0x52, 0x00, 0x52, 0x52, 0x52, 0x00, 0x52, 0x52, - 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, - // Entry 280 - 2BF - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x52, - 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 2C0 - 2FF - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, - 0x00, -} - -const ( - _001 = 1 - _419 = 30 - _BR = 64 - _CA = 72 - _ES = 109 - _GB = 121 - _MD = 186 - _PT = 236 - _UK = 304 - _US = 306 - _ZZ = 354 - _XA = 320 - _XC = 322 - _XK = 330 -) - -// isoRegionOffset needs to be added to the index of regionISO to obtain the regionID -// for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for -// the UN.M49 codes used for groups.) -const isoRegionOffset = 31 - -// regionTypes defines the status of a region for various standards. -// Size: 355 bytes, 355 elements -var regionTypes = [355]uint8{ - // Entry 0 - 3F - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - // Entry 40 - 7F - 0x06, 0x06, 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x04, 0x00, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, - 0x04, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x04, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x04, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - // Entry 80 - BF - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x00, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, - // Entry C0 - FF - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, - 0x06, 0x06, 0x00, 0x06, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, - 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - // Entry 100 - 13F - 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x02, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, - // Entry 140 - 17F - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x04, 0x06, 0x06, 0x04, 0x06, 0x06, - 0x04, 0x06, 0x05, -} - -// regionISO holds a list of alphabetically sorted 2-letter ISO region codes. -// Each 2-letter codes is followed by two bytes with the following meaning: -// - [A-Z}{2}: the first letter of the 2-letter code plus these two -// letters form the 3-letter ISO code. -// - 0, n: index into altRegionISO3. -var regionISO tag.Index = "" + // Size: 1300 bytes - "AAAAACSCADNDAEREAFFGAGTGAIIAALLBAMRMANNTAOGOAQTAARRGASSMATUTAUUSAWBWAXLA" + - "AZZEBAIHBBRBBDGDBEELBFFABGGRBHHRBIDIBJENBLLMBMMUBNRNBOOLBQESBRRABSHSBTTN" + - "BUURBVVTBWWABYLRBZLZCAANCCCKCDODCFAFCGOGCHHECIIVCKOKCLHLCMMRCNHNCOOLCPPT" + - "CRRICS\x00\x00CTTECUUBCVPVCWUWCXXRCYYPCZZEDDDRDEEUDGGADJJIDKNKDMMADOOMDY" + - "HYDZZAEA ECCUEESTEGGYEHSHERRIESSPETTHEU\x00\x03FIINFJJIFKLKFMSMFOROFQ" + - "\x00\x18FRRAFXXXGAABGBBRGDRDGEEOGFUFGGGYGHHAGIIBGLRLGMMBGNINGPLPGQNQGRRC" + - "GS\x00\x06GTTMGUUMGWNBGYUYHKKGHMMDHNNDHRRVHTTIHUUNHVVOIC IDDNIERLILSRIM" + - "MNINNDIOOTIQRQIRRNISSLITTAJEEYJMAMJOORJPPNJTTNKEENKGGZKHHMKIIRKM\x00\x09" + - "KNNAKP\x00\x0cKRORKWWTKY\x00\x0fKZAZLAAOLBBNLCCALIIELKKALRBRLSSOLTTULUUX" + - "LVVALYBYMAARMCCOMDDAMENEMFAFMGDGMHHLMIIDMKKDMLLIMMMRMNNGMOACMPNPMQTQMRRT" + - "MSSRMTLTMUUSMVDVMWWIMXEXMYYSMZOZNAAMNCCLNEERNFFKNGGANHHBNIICNLLDNOORNPPL" + - "NQ\x00\x1eNRRUNTTZNUIUNZZLOMMNPAANPCCIPEERPFYFPGNGPHHLPKAKPLOLPM\x00\x12" + - "PNCNPRRIPSSEPTRTPUUSPWLWPYRYPZCZQAATQMMMQNNNQOOOQPPPQQQQQRRRQSSSQTTTQU" + - "\x00\x03QVVVQWWWQXXXQYYYQZZZREEURHHOROOURS\x00\x15RUUSRWWASAAUSBLBSCYCSD" + - "DNSEWESGGPSHHNSIVNSJJMSKVKSLLESMMRSNENSOOMSRURSSSDSTTPSUUNSVLVSXXMSYYRSZ" + - "WZTAAATCCATDCDTF\x00\x18TGGOTHHATJJKTKKLTLLSTMKMTNUNTOONTPMPTRURTTTOTVUV" + - "TWWNTZZAUAKRUGGAUK UMMIUSSAUYRYUZZBVAATVCCTVDDRVEENVGGBVIIRVNNMVUUTWFLF" + - "WKAKWSSMXAAAXBBBXCCCXDDDXEEEXFFFXGGGXHHHXIIIXJJJXKKKXLLLXMMMXNNNXOOOXPPP" + - "XQQQXRRRXSSSXTTTXUUUXVVVXWWWXXXXXYYYXZZZYDMDYEEMYT\x00\x1bYUUGZAAFZMMBZR" + - "ARZWWEZZZZ\xff\xff\xff\xff" - -// altRegionISO3 holds a list of 3-letter region codes that cannot be -// mapped to 2-letter codes using the default algorithm. This is a short list. -var altRegionISO3 string = "SCGQUUSGSCOMPRKCYMSPMSRBATFMYTATN" - -// altRegionIDs holds a list of regionIDs the positions of which match those -// of the 3-letter ISO codes in altRegionISO3. -// Size: 22 bytes, 11 elements -var altRegionIDs = [11]uint16{ - 0x0056, 0x006f, 0x0086, 0x00a6, 0x00a8, 0x00ab, 0x00e8, 0x0103, - 0x011f, 0x015c, 0x00da, -} - -// Size: 80 bytes, 20 elements -var regionOldMap = [20]fromTo{ - 0: {from: 0x43, to: 0xc2}, - 1: {from: 0x57, to: 0xa5}, - 2: {from: 0x5e, to: 0x5f}, - 3: {from: 0x65, to: 0x3a}, - 4: {from: 0x77, to: 0x76}, - 5: {from: 0x91, to: 0x36}, - 6: {from: 0xa1, to: 0x131}, - 7: {from: 0xbf, to: 0x131}, - 8: {from: 0xd5, to: 0x13c}, - 9: {from: 0xda, to: 0x2a}, - 10: {from: 0xed, to: 0x131}, - 11: {from: 0xf0, to: 0xe0}, - 12: {from: 0xfa, to: 0x6f}, - 13: {from: 0x101, to: 0x161}, - 14: {from: 0x128, to: 0x124}, - 15: {from: 0x130, to: 0x79}, - 16: {from: 0x137, to: 0x13b}, - 17: {from: 0x13e, to: 0x131}, - 18: {from: 0x15a, to: 0x15b}, - 19: {from: 0x160, to: 0x4a}, -} - -// m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are -// codes indicating collections of regions. -// Size: 710 bytes, 355 elements -var m49 = [355]int16{ - // Entry 0 - 3F - 0, 1, 2, 3, 5, 9, 11, 13, - 14, 15, 17, 18, 19, 21, 29, 30, - 34, 35, 39, 53, 54, 57, 61, 142, - 143, 145, 150, 151, 154, 155, 419, 958, - 0, 20, 784, 4, 28, 660, 8, 51, - 530, 24, 10, 32, 16, 40, 36, 533, - 248, 31, 70, 52, 50, 56, 854, 100, - 48, 108, 204, 652, 60, 96, 68, 535, - // Entry 40 - 7F - 76, 44, 64, 104, 74, 72, 112, 84, - 124, 166, 180, 140, 178, 756, 384, 184, - 152, 120, 156, 170, 0, 188, 891, 296, - 192, 132, 531, 162, 196, 203, 278, 276, - 0, 262, 208, 212, 214, 204, 12, 0, - 218, 233, 818, 732, 232, 724, 231, 967, - 246, 242, 238, 583, 234, 0, 250, 249, - 266, 826, 308, 268, 254, 831, 288, 292, - // Entry 80 - BF - 304, 270, 324, 312, 226, 300, 239, 320, - 316, 624, 328, 344, 334, 340, 191, 332, - 348, 854, 0, 360, 372, 376, 833, 356, - 86, 368, 364, 352, 380, 832, 388, 400, - 392, 581, 404, 417, 116, 296, 174, 659, - 408, 410, 414, 136, 398, 418, 422, 662, - 438, 144, 430, 426, 440, 442, 428, 434, - 504, 492, 498, 499, 663, 450, 584, 581, - // Entry C0 - FF - 807, 466, 104, 496, 446, 580, 474, 478, - 500, 470, 480, 462, 454, 484, 458, 508, - 516, 540, 562, 574, 566, 548, 558, 528, - 578, 524, 10, 520, 536, 570, 554, 512, - 591, 0, 604, 258, 598, 608, 586, 616, - 666, 612, 630, 275, 620, 581, 585, 600, - 591, 634, 959, 960, 961, 962, 963, 964, - 965, 966, 967, 968, 969, 970, 971, 972, - // Entry 100 - 13F - 638, 716, 642, 688, 643, 646, 682, 90, - 690, 729, 752, 702, 654, 705, 744, 703, - 694, 674, 686, 706, 740, 728, 678, 810, - 222, 534, 760, 748, 0, 796, 148, 260, - 768, 764, 762, 772, 626, 795, 788, 776, - 626, 792, 780, 798, 158, 834, 804, 800, - 826, 581, 840, 858, 860, 336, 670, 704, - 862, 92, 850, 704, 548, 876, 581, 882, - // Entry 140 - 17F - 973, 974, 975, 976, 977, 978, 979, 980, - 981, 982, 983, 984, 985, 986, 987, 988, - 989, 990, 991, 992, 993, 994, 995, 996, - 997, 998, 720, 887, 175, 891, 710, 894, - 180, 716, 999, -} - -// m49Index gives indexes into fromM49 based on the three most significant bits -// of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in -// fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]] -// for an entry where the first 7 bits match the 7 lsb of the UN.M49 code. -// The region code is stored in the 9 lsb of the indexed value. -// Size: 18 bytes, 9 elements -var m49Index = [9]int16{ - 0, 59, 107, 142, 180, 219, 258, 290, - 332, -} - -// fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details. -// Size: 664 bytes, 332 elements -var fromM49 = [332]uint16{ - // Entry 0 - 3F - 0x0201, 0x0402, 0x0603, 0x0823, 0x0a04, 0x1026, 0x1205, 0x142a, - 0x1606, 0x1866, 0x1a07, 0x1c08, 0x1e09, 0x202c, 0x220a, 0x240b, - 0x260c, 0x2821, 0x2a0d, 0x3029, 0x3824, 0x3a0e, 0x3c0f, 0x3e31, - 0x402b, 0x4410, 0x4611, 0x482e, 0x4e12, 0x502d, 0x5841, 0x6038, - 0x6434, 0x6627, 0x6833, 0x6a13, 0x6c14, 0x7035, 0x7215, 0x783c, - 0x7a16, 0x8042, 0x883e, 0x8c32, 0x9045, 0x9444, 0x9840, 0xa847, - 0xac98, 0xb507, 0xb939, 0xc03d, 0xc837, 0xd0c2, 0xd839, 0xe046, - 0xe8a4, 0xf051, 0xf848, 0x0859, 0x10ab, 0x184b, 0x1c17, 0x1e18, - // Entry 40 - 7F - 0x20b1, 0x2219, 0x291e, 0x2c1a, 0x2e1b, 0x3050, 0x341c, 0x361d, - 0x3852, 0x3d2c, 0x445b, 0x4c49, 0x5453, 0x5ca6, 0x5f5c, 0x644c, - 0x684a, 0x704f, 0x7855, 0x7e8e, 0x8058, 0x885c, 0x965d, 0x983a, - 0xa062, 0xa863, 0xac64, 0xb468, 0xbd18, 0xc484, 0xcc6e, 0xce6e, - 0xd06c, 0xd269, 0xd474, 0xdc72, 0xde86, 0xe471, 0xec70, 0xf030, - 0xf277, 0xf476, 0xfc7c, 0x04e3, 0x091f, 0x0c61, 0x1478, 0x187b, - 0x1c81, 0x26eb, 0x285f, 0x2c5e, 0x305f, 0x407e, 0x487f, 0x50a5, - 0x5885, 0x6080, 0x687a, 0x7083, 0x7888, 0x8087, 0x8882, 0x908a, - // Entry 80 - BF - 0x988f, 0x9c8c, 0xa135, 0xa88d, 0xb08b, 0xb890, 0xc09b, 0xc897, - 0xd093, 0xd89a, 0xe099, 0xe894, 0xf095, 0xf89c, 0x004e, 0x089e, - 0x10a0, 0x1cac, 0x209f, 0x28a2, 0x30a8, 0x34a9, 0x3caa, 0x42a3, - 0x44ad, 0x461e, 0x4cae, 0x54b3, 0x58b6, 0x5cb2, 0x64b7, 0x6cb0, - 0x70b4, 0x74b5, 0x7cc4, 0x84bd, 0x8ccc, 0x94ce, 0x9ccb, 0xa4c1, - 0xacc9, 0xb4c6, 0xbcc7, 0xc0ca, 0xc8cd, 0xd8b9, 0xe0c3, 0xe4ba, - 0xe6bb, 0xe8c8, 0xf0b8, 0xf8cf, 0x00df, 0x08d0, 0x10db, 0x18d9, - 0x20d7, 0x2428, 0x265a, 0x2a2f, 0x2d19, 0x2e3f, 0x30dc, 0x38d1, - // Entry C0 - FF - 0x493c, 0x54de, 0x5cd6, 0x64d2, 0x6cd4, 0x74dd, 0x7cd3, 0x84d8, - 0x88c5, 0x8b31, 0x8e73, 0x90be, 0x92ee, 0x94e6, 0x9ee0, 0xace4, - 0xb0ef, 0xb8e2, 0xc0e5, 0xc8e9, 0xd0e7, 0xd8ec, 0xe089, 0xe524, - 0xecea, 0xf4f1, 0xfd00, 0x0502, 0x0704, 0x0d05, 0x183b, 0x1d0c, - 0x26a7, 0x2825, 0x2caf, 0x2ebc, 0x34e8, 0x3d36, 0x4511, 0x4d16, - 0x5506, 0x5d12, 0x6103, 0x6508, 0x6d10, 0x7d0b, 0x7f0f, 0x813b, - 0x830d, 0x8513, 0x8d5e, 0x9961, 0xa15a, 0xa86d, 0xb115, 0xb309, - 0xb86b, 0xc109, 0xc914, 0xd10e, 0xd91b, 0xe10a, 0xe84d, 0xf11a, - // Entry 100 - 13F - 0xf522, 0xf921, 0x0120, 0x0923, 0x1127, 0x192a, 0x2022, 0x2926, - 0x3129, 0x3725, 0x391d, 0x3d2b, 0x412f, 0x492e, 0x4ec0, 0x5517, - 0x646a, 0x7479, 0x7e7d, 0x809d, 0x8296, 0x852d, 0x9132, 0xa53a, - 0xac36, 0xb533, 0xb934, 0xbd38, 0xd93d, 0xe53f, 0xed5b, 0xef5b, - 0xf656, 0xfd5f, 0x7c1f, 0x7ef2, 0x80f3, 0x82f4, 0x84f5, 0x86f6, - 0x88f7, 0x8af8, 0x8cf9, 0x8e6f, 0x90fb, 0x92fc, 0x94fd, 0x96fe, - 0x98ff, 0x9b40, 0x9d41, 0x9f42, 0xa143, 0xa344, 0xa545, 0xa746, - 0xa947, 0xab48, 0xad49, 0xaf4a, 0xb14b, 0xb34c, 0xb54d, 0xb74e, - // Entry 140 - 17F - 0xb94f, 0xbb50, 0xbd51, 0xbf52, 0xc153, 0xc354, 0xc555, 0xc756, - 0xc957, 0xcb58, 0xcd59, 0xcf62, -} - -// Size: 1444 bytes -var variantIndex = map[string]uint8{ - "1606nict": 0x0, - "1694acad": 0x1, - "1901": 0x2, - "1959acad": 0x3, - "1994": 0x45, - "1996": 0x4, - "abl1943": 0x5, - "alalc97": 0x47, - "aluku": 0x6, - "ao1990": 0x7, - "arevela": 0x8, - "arevmda": 0x9, - "baku1926": 0xa, - "balanka": 0xb, - "barla": 0xc, - "basiceng": 0xd, - "bauddha": 0xe, - "biscayan": 0xf, - "biske": 0x40, - "bohoric": 0x10, - "boont": 0x11, - "colb1945": 0x12, - "cornu": 0x13, - "dajnko": 0x14, - "ekavsk": 0x15, - "emodeng": 0x16, - "fonipa": 0x48, - "fonupa": 0x49, - "fonxsamp": 0x4a, - "hepburn": 0x17, - "heploc": 0x46, - "hognorsk": 0x18, - "ijekavsk": 0x19, - "itihasa": 0x1a, - "jauer": 0x1b, - "jyutping": 0x1c, - "kkcor": 0x1d, - "kociewie": 0x1e, - "kscor": 0x1f, - "laukika": 0x20, - "lipaw": 0x41, - "luna1918": 0x21, - "metelko": 0x22, - "monoton": 0x23, - "ndyuka": 0x24, - "nedis": 0x25, - "newfound": 0x26, - "njiva": 0x42, - "nulik": 0x27, - "osojs": 0x43, - "oxendict": 0x28, - "pamaka": 0x29, - "petr1708": 0x2a, - "pinyin": 0x2b, - "polyton": 0x2c, - "puter": 0x2d, - "rigik": 0x2e, - "rozaj": 0x2f, - "rumgr": 0x30, - "scotland": 0x31, - "scouse": 0x32, - "simple": 0x4b, - "solba": 0x44, - "sotav": 0x33, - "surmiran": 0x34, - "sursilv": 0x35, - "sutsilv": 0x36, - "tarask": 0x37, - "uccor": 0x38, - "ucrcor": 0x39, - "ulster": 0x3a, - "unifon": 0x3b, - "vaidika": 0x3c, - "valencia": 0x3d, - "vallader": 0x3e, - "wadegile": 0x3f, -} - -// variantNumSpecialized is the number of specialized variants in variants. -const variantNumSpecialized = 71 - -// nRegionGroups is the number of region groups. -const nRegionGroups = 32 - -type likelyLangRegion struct { - lang uint16 - region uint16 -} - -// likelyScript is a lookup table, indexed by scriptID, for the most likely -// languages and regions given a script. -// Size: 928 bytes, 232 elements -var likelyScript = [232]likelyLangRegion{ - 1: {lang: 0xa6, region: 0x82}, - 3: {lang: 0x159, region: 0x104}, - 4: {lang: 0xc, region: 0x97}, - 5: {lang: 0x15, region: 0x6a}, - 7: {lang: 0x16, region: 0x9a}, - 8: {lang: 0xf3, region: 0x27}, - 9: {lang: 0x8, region: 0x9a}, - 10: {lang: 0x27, region: 0x93}, - 11: {lang: 0x2b, region: 0x51}, - 12: {lang: 0x55, region: 0xb2}, - 13: {lang: 0x2c, region: 0x93}, - 14: {lang: 0x4b, region: 0x34}, - 15: {lang: 0x20d, region: 0x97}, - 17: {lang: 0x2c4, region: 0x12c}, - 18: {lang: 0x1e5, region: 0x97}, - 19: {lang: 0xaf, region: 0x76}, - 20: {lang: 0x5b, region: 0x93}, - 21: {lang: 0x47, region: 0xe5}, - 22: {lang: 0x63, region: 0x34}, - 23: {lang: 0x73, region: 0x48}, - 24: {lang: 0x2a8, region: 0x129}, - 25: {lang: 0x6e, region: 0x13b}, - 26: {lang: 0x6c, region: 0x132}, - 28: {lang: 0x71, region: 0x6a}, - 29: {lang: 0xd0, region: 0x5c}, - 30: {lang: 0x207, region: 0x104}, - 32: {lang: 0xe1, region: 0x97}, - 34: {lang: 0xaf, region: 0x76}, - 37: {lang: 0x98, region: 0x6a}, - 38: {lang: 0x23a, region: 0x26}, - 39: {lang: 0x11, region: 0x6e}, - 41: {lang: 0x111, region: 0x7b}, - 42: {lang: 0x7d, region: 0x37}, - 43: {lang: 0xcf, region: 0x12e}, - 44: {lang: 0x20d, region: 0x97}, - 45: {lang: 0x9a, region: 0x85}, - 46: {lang: 0xd3, region: 0x97}, - 47: {lang: 0x1d7, region: 0x97}, - 48: {lang: 0x2c4, region: 0x12c}, - 49: {lang: 0x136, region: 0xa9}, - 50: {lang: 0x2c4, region: 0x52}, - 51: {lang: 0xe9, region: 0xe5}, - 52: {lang: 0x2c4, region: 0x52}, - 53: {lang: 0x2c4, region: 0x12c}, - 54: {lang: 0x18b, region: 0x99}, - 55: {lang: 0xe0, region: 0x95}, - 56: {lang: 0x107, region: 0xa0}, - 57: {lang: 0xe4, region: 0x129}, - 58: {lang: 0xe8, region: 0xad}, - 60: {lang: 0xf2, region: 0x90}, - 62: {lang: 0xa0, region: 0x9c}, - 63: {lang: 0x136, region: 0xa9}, - 64: {lang: 0x10f, region: 0x93}, - 65: {lang: 0x107, region: 0xa0}, - 67: {lang: 0x99, region: 0xc2}, - 68: {lang: 0x107, region: 0xa0}, - 69: {lang: 0x1eb, region: 0xe6}, - 70: {lang: 0x133, region: 0xa4}, - 71: {lang: 0x21a, region: 0x97}, - 74: {lang: 0x135, region: 0x97}, - 75: {lang: 0x136, region: 0xa9}, - 77: {lang: 0x40, region: 0x97}, - 78: {lang: 0x1c2, region: 0x121}, - 79: {lang: 0x165, region: 0xad}, - 84: {lang: 0x158, region: 0x97}, - 85: {lang: 0x15c, region: 0x97}, - 86: {lang: 0x14f, region: 0x85}, - 87: {lang: 0xd0, region: 0x85}, - 88: {lang: 0x15e, region: 0x52}, - 90: {lang: 0x2aa, region: 0x129}, - 91: {lang: 0x2ab, region: 0x129}, - 92: {lang: 0xe1, region: 0x97}, - 93: {lang: 0x1a8, region: 0x9a}, - 94: {lang: 0x2ad, region: 0x52}, - 95: {lang: 0x4c, region: 0x52}, - 97: {lang: 0x17f, region: 0x110}, - 98: {lang: 0x2ae, region: 0x109}, - 99: {lang: 0x2ae, region: 0x109}, - 100: {lang: 0x18d, region: 0x97}, - 101: {lang: 0x196, region: 0x97}, - 102: {lang: 0x18f, region: 0x52}, - 104: {lang: 0x199, region: 0x34}, - 105: {lang: 0x190, region: 0x97}, - 106: {lang: 0x22b, region: 0xe6}, - 107: {lang: 0x1a5, region: 0xc2}, - 108: {lang: 0x2af, region: 0x106}, - 109: {lang: 0x16, region: 0x9f}, - 110: {lang: 0x1b5, region: 0xd9}, - 112: {lang: 0x179, region: 0x82}, - 114: {lang: 0x223, region: 0x94}, - 115: {lang: 0x212, region: 0x97}, - 116: {lang: 0x1d6, region: 0xc3}, - 117: {lang: 0x1d3, region: 0x97}, - 118: {lang: 0x1d5, region: 0x132}, - 119: {lang: 0x238, region: 0x113}, - 120: {lang: 0x16, region: 0x11a}, - 121: {lang: 0x7c, region: 0xc2}, - 122: {lang: 0x147, region: 0x104}, - 123: {lang: 0x172, region: 0x52}, - 124: {lang: 0x1d9, region: 0x9a}, - 125: {lang: 0x1d9, region: 0x52}, - 127: {lang: 0x1e3, region: 0xae}, - 129: {lang: 0xe5, region: 0x52}, - 130: {lang: 0x2b2, region: 0x9a}, - 181: {lang: 0x1f6, region: 0x93}, - 183: {lang: 0x1c4, region: 0x10a}, - 184: {lang: 0x234, region: 0x95}, - 186: {lang: 0x2b3, region: 0x15b}, - 187: {lang: 0x213, region: 0x97}, - 188: {lang: 0x1e, region: 0x132}, - 189: {lang: 0x9b, region: 0x79}, - 190: {lang: 0x20d, region: 0x97}, - 191: {lang: 0x20d, region: 0x97}, - 192: {lang: 0x21a, region: 0x97}, - 193: {lang: 0x228, region: 0xb1}, - 194: {lang: 0x23c, region: 0x97}, - 195: {lang: 0x244, region: 0x93}, - 196: {lang: 0x24e, region: 0x34}, - 197: {lang: 0x24f, region: 0x99}, - 201: {lang: 0x253, region: 0xe5}, - 202: {lang: 0x8a, region: 0x97}, - 203: {lang: 0x255, region: 0x52}, - 204: {lang: 0x126, region: 0x52}, - 205: {lang: 0x251, region: 0x97}, - 206: {lang: 0x27f, region: 0x52}, - 207: {lang: 0x48, region: 0x13b}, - 208: {lang: 0x258, region: 0x97}, - 210: {lang: 0x2c3, region: 0xb8}, - 211: {lang: 0xaa, region: 0xe5}, - 212: {lang: 0x90, region: 0xcb}, - 213: {lang: 0x25d, region: 0x121}, - 214: {lang: 0x4c, region: 0x52}, - 215: {lang: 0x177, region: 0x97}, - 216: {lang: 0x285, region: 0x11a}, - 217: {lang: 0x28e, region: 0xb2}, - 219: {lang: 0xec, region: 0x97}, - 221: {lang: 0x1e1, region: 0x9a}, - 222: {lang: 0xe, region: 0x99}, - 223: {lang: 0xfb, region: 0x52}, -} - -type likelyScriptRegion struct { - region uint16 - script uint8 - flags uint8 -} - -// likelyLang is a lookup table, indexed by langID, for the most likely -// scripts and regions given incomplete information. If more entries exist for a -// given language, region and script are the index and size respectively -// of the list in likelyLangList. -// Size: 2852 bytes, 713 elements -var likelyLang = [713]likelyScriptRegion{ - 0: {region: 0x132, script: 0x52, flags: 0x0}, - 1: {region: 0x6e, script: 0x52, flags: 0x0}, - 2: {region: 0x7b, script: 0x1e, flags: 0x0}, - 3: {region: 0x7e, script: 0x52, flags: 0x0}, - 4: {region: 0x93, script: 0x52, flags: 0x0}, - 5: {region: 0x12f, script: 0x52, flags: 0x0}, - 6: {region: 0x7e, script: 0x52, flags: 0x0}, - 7: {region: 0x104, script: 0x1e, flags: 0x0}, - 8: {region: 0x9a, script: 0x9, flags: 0x0}, - 9: {region: 0x126, script: 0x5, flags: 0x0}, - 10: {region: 0x15e, script: 0x52, flags: 0x0}, - 11: {region: 0x51, script: 0x52, flags: 0x0}, - 12: {region: 0x97, script: 0x4, flags: 0x0}, - 13: {region: 0x7e, script: 0x52, flags: 0x0}, - 14: {region: 0x99, script: 0xde, flags: 0x0}, - 15: {region: 0x14a, script: 0x52, flags: 0x0}, - 16: {region: 0x104, script: 0x1e, flags: 0x0}, - 17: {region: 0x6e, script: 0x27, flags: 0x0}, - 18: {region: 0xd4, script: 0x52, flags: 0x0}, - 20: {region: 0x93, script: 0x52, flags: 0x0}, - 21: {region: 0x6a, script: 0x5, flags: 0x0}, - 22: {region: 0x0, script: 0x3, flags: 0x1}, - 23: {region: 0x50, script: 0x52, flags: 0x0}, - 24: {region: 0x3e, script: 0x52, flags: 0x0}, - 25: {region: 0x66, script: 0x5, flags: 0x0}, - 26: {region: 0xb8, script: 0x5, flags: 0x0}, - 27: {region: 0x6a, script: 0x5, flags: 0x0}, - 28: {region: 0x97, script: 0xe, flags: 0x0}, - 29: {region: 0x12d, script: 0x52, flags: 0x0}, - 30: {region: 0x132, script: 0xbc, flags: 0x0}, - 31: {region: 0x6d, script: 0x52, flags: 0x0}, - 32: {region: 0x48, script: 0x52, flags: 0x0}, - 33: {region: 0x104, script: 0x1e, flags: 0x0}, - 34: {region: 0x97, script: 0x20, flags: 0x0}, - 35: {region: 0x3e, script: 0x52, flags: 0x0}, - 36: {region: 0x3, script: 0x5, flags: 0x1}, - 37: {region: 0x104, script: 0x1e, flags: 0x0}, - 38: {region: 0xe6, script: 0x5, flags: 0x0}, - 39: {region: 0x93, script: 0x52, flags: 0x0}, - 40: {region: 0xd9, script: 0x20, flags: 0x0}, - 41: {region: 0x2d, script: 0x52, flags: 0x0}, - 42: {region: 0x51, script: 0x52, flags: 0x0}, - 43: {region: 0x51, script: 0xb, flags: 0x0}, - 44: {region: 0x93, script: 0x52, flags: 0x0}, - 45: {region: 0x51, script: 0x52, flags: 0x0}, - 46: {region: 0x4e, script: 0x52, flags: 0x0}, - 47: {region: 0x46, script: 0x1e, flags: 0x0}, - 48: {region: 0x109, script: 0x5, flags: 0x0}, - 49: {region: 0x15f, script: 0x52, flags: 0x0}, - 50: {region: 0x93, script: 0x52, flags: 0x0}, - 51: {region: 0x12d, script: 0x52, flags: 0x0}, - 52: {region: 0x51, script: 0x52, flags: 0x0}, - 53: {region: 0x97, script: 0xcd, flags: 0x0}, - 54: {region: 0xe6, script: 0x5, flags: 0x0}, - 55: {region: 0x97, script: 0x20, flags: 0x0}, - 56: {region: 0x37, script: 0x1e, flags: 0x0}, - 57: {region: 0x97, script: 0x20, flags: 0x0}, - 58: {region: 0xe6, script: 0x5, flags: 0x0}, - 59: {region: 0x129, script: 0x2d, flags: 0x0}, - 61: {region: 0x97, script: 0x20, flags: 0x0}, - 62: {region: 0x97, script: 0x20, flags: 0x0}, - 63: {region: 0xe5, script: 0x52, flags: 0x0}, - 64: {region: 0x97, script: 0x20, flags: 0x0}, - 65: {region: 0x13c, script: 0x52, flags: 0x0}, - 66: {region: 0xe5, script: 0x52, flags: 0x0}, - 67: {region: 0xd4, script: 0x52, flags: 0x0}, - 68: {region: 0x97, script: 0x20, flags: 0x0}, - 69: {region: 0x93, script: 0x52, flags: 0x0}, - 70: {region: 0x51, script: 0x52, flags: 0x0}, - 71: {region: 0xe5, script: 0x52, flags: 0x0}, - 72: {region: 0x13b, script: 0xcf, flags: 0x0}, - 73: {region: 0xc1, script: 0x52, flags: 0x0}, - 74: {region: 0xc1, script: 0x52, flags: 0x0}, - 75: {region: 0x34, script: 0xe, flags: 0x0}, - 76: {region: 0x52, script: 0xd6, flags: 0x0}, - 77: {region: 0x97, script: 0xe, flags: 0x0}, - 78: {region: 0x9a, script: 0x5, flags: 0x0}, - 79: {region: 0x4e, script: 0x52, flags: 0x0}, - 80: {region: 0x76, script: 0x52, flags: 0x0}, - 81: {region: 0x97, script: 0x20, flags: 0x0}, - 82: {region: 0xe6, script: 0x5, flags: 0x0}, - 83: {region: 0x97, script: 0x20, flags: 0x0}, - 84: {region: 0x32, script: 0x52, flags: 0x0}, - 85: {region: 0xb2, script: 0xc, flags: 0x0}, - 86: {region: 0x51, script: 0x52, flags: 0x0}, - 87: {region: 0xe5, script: 0x52, flags: 0x0}, - 88: {region: 0xe6, script: 0x20, flags: 0x0}, - 89: {region: 0x104, script: 0x1e, flags: 0x0}, - 90: {region: 0x15c, script: 0x52, flags: 0x0}, - 91: {region: 0x93, script: 0x52, flags: 0x0}, - 92: {region: 0x51, script: 0x52, flags: 0x0}, - 93: {region: 0x84, script: 0x52, flags: 0x0}, - 94: {region: 0x6c, script: 0x27, flags: 0x0}, - 95: {region: 0x51, script: 0x52, flags: 0x0}, - 96: {region: 0xc1, script: 0x52, flags: 0x0}, - 97: {region: 0x6d, script: 0x52, flags: 0x0}, - 98: {region: 0xd4, script: 0x52, flags: 0x0}, - 99: {region: 0x8, script: 0x2, flags: 0x1}, - 100: {region: 0x104, script: 0x1e, flags: 0x0}, - 101: {region: 0xe5, script: 0x52, flags: 0x0}, - 102: {region: 0x12f, script: 0x52, flags: 0x0}, - 103: {region: 0x88, script: 0x52, flags: 0x0}, - 104: {region: 0x73, script: 0x52, flags: 0x0}, - 105: {region: 0x104, script: 0x1e, flags: 0x0}, - 106: {region: 0x132, script: 0x52, flags: 0x0}, - 107: {region: 0x48, script: 0x52, flags: 0x0}, - 108: {region: 0x132, script: 0x1a, flags: 0x0}, - 109: {region: 0xa4, script: 0x5, flags: 0x0}, - 110: {region: 0x13b, script: 0x19, flags: 0x0}, - 111: {region: 0x99, script: 0x5, flags: 0x0}, - 112: {region: 0x76, script: 0x52, flags: 0x0}, - 113: {region: 0x6a, script: 0x1c, flags: 0x0}, - 114: {region: 0xe5, script: 0x52, flags: 0x0}, - 115: {region: 0x48, script: 0x17, flags: 0x0}, - 116: {region: 0x48, script: 0x17, flags: 0x0}, - 117: {region: 0x48, script: 0x17, flags: 0x0}, - 118: {region: 0x48, script: 0x17, flags: 0x0}, - 119: {region: 0x48, script: 0x17, flags: 0x0}, - 120: {region: 0x108, script: 0x52, flags: 0x0}, - 121: {region: 0x5d, script: 0x52, flags: 0x0}, - 122: {region: 0xe7, script: 0x52, flags: 0x0}, - 123: {region: 0x48, script: 0x17, flags: 0x0}, - 124: {region: 0xc2, script: 0x79, flags: 0x0}, - 125: {region: 0xa, script: 0x2, flags: 0x1}, - 126: {region: 0x104, script: 0x1e, flags: 0x0}, - 127: {region: 0x79, script: 0x52, flags: 0x0}, - 128: {region: 0x62, script: 0x52, flags: 0x0}, - 129: {region: 0x132, script: 0x52, flags: 0x0}, - 130: {region: 0x104, script: 0x1e, flags: 0x0}, - 131: {region: 0xa2, script: 0x52, flags: 0x0}, - 132: {region: 0x97, script: 0x5, flags: 0x0}, - 133: {region: 0x5f, script: 0x52, flags: 0x0}, - 134: {region: 0x48, script: 0x52, flags: 0x0}, - 135: {region: 0x48, script: 0x52, flags: 0x0}, - 136: {region: 0xd2, script: 0x52, flags: 0x0}, - 137: {region: 0x4e, script: 0x52, flags: 0x0}, - 138: {region: 0x97, script: 0x5, flags: 0x0}, - 139: {region: 0x5f, script: 0x52, flags: 0x0}, - 140: {region: 0xc1, script: 0x52, flags: 0x0}, - 141: {region: 0xce, script: 0x52, flags: 0x0}, - 142: {region: 0xd9, script: 0x20, flags: 0x0}, - 143: {region: 0x51, script: 0x52, flags: 0x0}, - 144: {region: 0xcb, script: 0xd4, flags: 0x0}, - 145: {region: 0x112, script: 0x52, flags: 0x0}, - 146: {region: 0x36, script: 0x52, flags: 0x0}, - 147: {region: 0x42, script: 0xd6, flags: 0x0}, - 148: {region: 0xa2, script: 0x52, flags: 0x0}, - 149: {region: 0x7e, script: 0x52, flags: 0x0}, - 150: {region: 0xd4, script: 0x52, flags: 0x0}, - 151: {region: 0x9c, script: 0x52, flags: 0x0}, - 152: {region: 0x6a, script: 0x25, flags: 0x0}, - 153: {region: 0xc2, script: 0x43, flags: 0x0}, - 154: {region: 0x85, script: 0x2d, flags: 0x0}, - 155: {region: 0xc, script: 0x2, flags: 0x1}, - 156: {region: 0x1, script: 0x52, flags: 0x0}, - 157: {region: 0x6d, script: 0x52, flags: 0x0}, - 158: {region: 0x132, script: 0x52, flags: 0x0}, - 159: {region: 0x69, script: 0x52, flags: 0x0}, - 160: {region: 0x9c, script: 0x3e, flags: 0x0}, - 161: {region: 0x6d, script: 0x52, flags: 0x0}, - 162: {region: 0x51, script: 0x52, flags: 0x0}, - 163: {region: 0x6d, script: 0x52, flags: 0x0}, - 164: {region: 0x9a, script: 0x5, flags: 0x0}, - 165: {region: 0x84, script: 0x52, flags: 0x0}, - 166: {region: 0xe, script: 0x2, flags: 0x1}, - 167: {region: 0xc1, script: 0x52, flags: 0x0}, - 168: {region: 0x70, script: 0x52, flags: 0x0}, - 169: {region: 0x109, script: 0x5, flags: 0x0}, - 170: {region: 0xe5, script: 0x52, flags: 0x0}, - 171: {region: 0x10a, script: 0x52, flags: 0x0}, - 172: {region: 0x71, script: 0x52, flags: 0x0}, - 173: {region: 0x74, script: 0x52, flags: 0x0}, - 174: {region: 0x3a, script: 0x52, flags: 0x0}, - 175: {region: 0x76, script: 0x52, flags: 0x0}, - 176: {region: 0x132, script: 0x52, flags: 0x0}, - 177: {region: 0x76, script: 0x52, flags: 0x0}, - 178: {region: 0x5f, script: 0x52, flags: 0x0}, - 179: {region: 0x5f, script: 0x52, flags: 0x0}, - 180: {region: 0x13d, script: 0x52, flags: 0x0}, - 181: {region: 0xd2, script: 0x52, flags: 0x0}, - 182: {region: 0x9c, script: 0x52, flags: 0x0}, - 183: {region: 0xd4, script: 0x52, flags: 0x0}, - 184: {region: 0x109, script: 0x52, flags: 0x0}, - 185: {region: 0xd7, script: 0x52, flags: 0x0}, - 186: {region: 0x94, script: 0x52, flags: 0x0}, - 187: {region: 0x7e, script: 0x52, flags: 0x0}, - 188: {region: 0xba, script: 0x52, flags: 0x0}, - 189: {region: 0x52, script: 0x34, flags: 0x0}, - 190: {region: 0x93, script: 0x52, flags: 0x0}, - 191: {region: 0x97, script: 0x20, flags: 0x0}, - 192: {region: 0x9a, script: 0x5, flags: 0x0}, - 193: {region: 0x7c, script: 0x52, flags: 0x0}, - 194: {region: 0x79, script: 0x52, flags: 0x0}, - 195: {region: 0x6e, script: 0x27, flags: 0x0}, - 196: {region: 0xd9, script: 0x20, flags: 0x0}, - 197: {region: 0xa5, script: 0x52, flags: 0x0}, - 198: {region: 0xe6, script: 0x5, flags: 0x0}, - 199: {region: 0xe6, script: 0x5, flags: 0x0}, - 200: {region: 0x6d, script: 0x52, flags: 0x0}, - 201: {region: 0x9a, script: 0x5, flags: 0x0}, - 202: {region: 0xef, script: 0x52, flags: 0x0}, - 203: {region: 0x97, script: 0x20, flags: 0x0}, - 204: {region: 0x97, script: 0xd0, flags: 0x0}, - 205: {region: 0x93, script: 0x52, flags: 0x0}, - 206: {region: 0xd7, script: 0x52, flags: 0x0}, - 207: {region: 0x12e, script: 0x2b, flags: 0x0}, - 208: {region: 0x10, script: 0x2, flags: 0x1}, - 209: {region: 0x97, script: 0xe, flags: 0x0}, - 210: {region: 0x4d, script: 0x52, flags: 0x0}, - 211: {region: 0x97, script: 0x2e, flags: 0x0}, - 212: {region: 0x40, script: 0x52, flags: 0x0}, - 213: {region: 0x53, script: 0x52, flags: 0x0}, - 214: {region: 0x7e, script: 0x52, flags: 0x0}, - 216: {region: 0xa2, script: 0x52, flags: 0x0}, - 217: {region: 0x96, script: 0x52, flags: 0x0}, - 218: {region: 0xd9, script: 0x20, flags: 0x0}, - 219: {region: 0x48, script: 0x52, flags: 0x0}, - 220: {region: 0x12, script: 0x3, flags: 0x1}, - 221: {region: 0x52, script: 0x34, flags: 0x0}, - 222: {region: 0x132, script: 0x52, flags: 0x0}, - 223: {region: 0x23, script: 0x5, flags: 0x0}, - 224: {region: 0x95, script: 0x37, flags: 0x0}, - 225: {region: 0x97, script: 0x20, flags: 0x0}, - 226: {region: 0x71, script: 0x52, flags: 0x0}, - 227: {region: 0xe5, script: 0x52, flags: 0x0}, - 228: {region: 0x129, script: 0x39, flags: 0x0}, - 229: {region: 0x52, script: 0x81, flags: 0x0}, - 230: {region: 0xe6, script: 0x5, flags: 0x0}, - 231: {region: 0x97, script: 0x20, flags: 0x0}, - 232: {region: 0xad, script: 0x3a, flags: 0x0}, - 233: {region: 0xe5, script: 0x52, flags: 0x0}, - 234: {region: 0xe6, script: 0x5, flags: 0x0}, - 235: {region: 0xe4, script: 0x52, flags: 0x0}, - 236: {region: 0x97, script: 0x20, flags: 0x0}, - 237: {region: 0x97, script: 0x20, flags: 0x0}, - 238: {region: 0x8e, script: 0x52, flags: 0x0}, - 239: {region: 0x5f, script: 0x52, flags: 0x0}, - 240: {region: 0x52, script: 0x34, flags: 0x0}, - 241: {region: 0x8f, script: 0x52, flags: 0x0}, - 242: {region: 0x90, script: 0x52, flags: 0x0}, - 243: {region: 0x27, script: 0x8, flags: 0x0}, - 244: {region: 0xd0, script: 0x52, flags: 0x0}, - 245: {region: 0x76, script: 0x52, flags: 0x0}, - 246: {region: 0xce, script: 0x52, flags: 0x0}, - 247: {region: 0xd4, script: 0x52, flags: 0x0}, - 248: {region: 0x93, script: 0x52, flags: 0x0}, - 250: {region: 0xd4, script: 0x52, flags: 0x0}, - 251: {region: 0x52, script: 0xdf, flags: 0x0}, - 252: {region: 0x132, script: 0x52, flags: 0x0}, - 253: {region: 0x48, script: 0x52, flags: 0x0}, - 254: {region: 0xe5, script: 0x52, flags: 0x0}, - 255: {region: 0x93, script: 0x52, flags: 0x0}, - 256: {region: 0x104, script: 0x1e, flags: 0x0}, - 258: {region: 0x9b, script: 0x52, flags: 0x0}, - 259: {region: 0x9c, script: 0x52, flags: 0x0}, - 260: {region: 0x48, script: 0x17, flags: 0x0}, - 261: {region: 0x95, script: 0x37, flags: 0x0}, - 262: {region: 0x104, script: 0x52, flags: 0x0}, - 263: {region: 0xa0, script: 0x41, flags: 0x0}, - 264: {region: 0x9e, script: 0x52, flags: 0x0}, - 266: {region: 0x51, script: 0x52, flags: 0x0}, - 267: {region: 0x12e, script: 0x37, flags: 0x0}, - 268: {region: 0x12d, script: 0x52, flags: 0x0}, - 269: {region: 0xd9, script: 0x20, flags: 0x0}, - 270: {region: 0x62, script: 0x52, flags: 0x0}, - 271: {region: 0x93, script: 0x52, flags: 0x0}, - 272: {region: 0x93, script: 0x52, flags: 0x0}, - 273: {region: 0x7b, script: 0x29, flags: 0x0}, - 274: {region: 0x134, script: 0x1e, flags: 0x0}, - 275: {region: 0x66, script: 0x52, flags: 0x0}, - 276: {region: 0xc2, script: 0x52, flags: 0x0}, - 277: {region: 0xd4, script: 0x52, flags: 0x0}, - 278: {region: 0xa2, script: 0x52, flags: 0x0}, - 279: {region: 0xc1, script: 0x52, flags: 0x0}, - 280: {region: 0x104, script: 0x1e, flags: 0x0}, - 281: {region: 0xd4, script: 0x52, flags: 0x0}, - 282: {region: 0x161, script: 0x52, flags: 0x0}, - 283: {region: 0x12d, script: 0x52, flags: 0x0}, - 284: {region: 0x121, script: 0xd5, flags: 0x0}, - 285: {region: 0x59, script: 0x52, flags: 0x0}, - 286: {region: 0x51, script: 0x52, flags: 0x0}, - 287: {region: 0x4e, script: 0x52, flags: 0x0}, - 288: {region: 0x97, script: 0x20, flags: 0x0}, - 289: {region: 0x97, script: 0x20, flags: 0x0}, - 290: {region: 0x4a, script: 0x52, flags: 0x0}, - 291: {region: 0x93, script: 0x52, flags: 0x0}, - 292: {region: 0x40, script: 0x52, flags: 0x0}, - 293: {region: 0x97, script: 0x52, flags: 0x0}, - 294: {region: 0x52, script: 0xcc, flags: 0x0}, - 295: {region: 0x97, script: 0x20, flags: 0x0}, - 296: {region: 0xc1, script: 0x52, flags: 0x0}, - 297: {region: 0x97, script: 0x6b, flags: 0x0}, - 298: {region: 0xe6, script: 0x5, flags: 0x0}, - 299: {region: 0xa2, script: 0x52, flags: 0x0}, - 300: {region: 0x129, script: 0x52, flags: 0x0}, - 301: {region: 0xd0, script: 0x52, flags: 0x0}, - 302: {region: 0xad, script: 0x4f, flags: 0x0}, - 303: {region: 0x15, script: 0x6, flags: 0x1}, - 304: {region: 0x51, script: 0x52, flags: 0x0}, - 305: {region: 0x80, script: 0x52, flags: 0x0}, - 306: {region: 0xa2, script: 0x52, flags: 0x0}, - 307: {region: 0xa4, script: 0x46, flags: 0x0}, - 308: {region: 0x29, script: 0x52, flags: 0x0}, - 309: {region: 0x97, script: 0x4a, flags: 0x0}, - 310: {region: 0xa9, script: 0x4b, flags: 0x0}, - 311: {region: 0x104, script: 0x1e, flags: 0x0}, - 312: {region: 0x97, script: 0x20, flags: 0x0}, - 313: {region: 0x73, script: 0x52, flags: 0x0}, - 314: {region: 0xb2, script: 0x52, flags: 0x0}, - 316: {region: 0x104, script: 0x1e, flags: 0x0}, - 317: {region: 0x110, script: 0x52, flags: 0x0}, - 318: {region: 0xe5, script: 0x52, flags: 0x0}, - 319: {region: 0x104, script: 0x52, flags: 0x0}, - 320: {region: 0x97, script: 0x20, flags: 0x0}, - 321: {region: 0x97, script: 0x5, flags: 0x0}, - 322: {region: 0x12d, script: 0x52, flags: 0x0}, - 323: {region: 0x51, script: 0x52, flags: 0x0}, - 324: {region: 0x5f, script: 0x52, flags: 0x0}, - 325: {region: 0x1b, script: 0x3, flags: 0x1}, - 326: {region: 0x104, script: 0x1e, flags: 0x0}, - 327: {region: 0x104, script: 0x1e, flags: 0x0}, - 328: {region: 0x93, script: 0x52, flags: 0x0}, - 329: {region: 0xe6, script: 0x5, flags: 0x0}, - 330: {region: 0x79, script: 0x52, flags: 0x0}, - 331: {region: 0x121, script: 0xd5, flags: 0x0}, - 332: {region: 0xe6, script: 0x5, flags: 0x0}, - 333: {region: 0x1e, script: 0x5, flags: 0x1}, - 334: {region: 0x135, script: 0x52, flags: 0x0}, - 335: {region: 0x85, script: 0x56, flags: 0x0}, - 336: {region: 0x95, script: 0x37, flags: 0x0}, - 337: {region: 0x12d, script: 0x52, flags: 0x0}, - 338: {region: 0xe6, script: 0x5, flags: 0x0}, - 339: {region: 0x12f, script: 0x52, flags: 0x0}, - 340: {region: 0xb5, script: 0x52, flags: 0x0}, - 341: {region: 0x104, script: 0x1e, flags: 0x0}, - 342: {region: 0x93, script: 0x52, flags: 0x0}, - 343: {region: 0x52, script: 0xd5, flags: 0x0}, - 344: {region: 0x97, script: 0x54, flags: 0x0}, - 345: {region: 0x104, script: 0x1e, flags: 0x0}, - 346: {region: 0x12f, script: 0x52, flags: 0x0}, - 347: {region: 0xd7, script: 0x52, flags: 0x0}, - 348: {region: 0x23, script: 0x2, flags: 0x1}, - 349: {region: 0x9c, script: 0x52, flags: 0x0}, - 350: {region: 0x52, script: 0x58, flags: 0x0}, - 351: {region: 0x93, script: 0x52, flags: 0x0}, - 352: {region: 0x9a, script: 0x5, flags: 0x0}, - 353: {region: 0x132, script: 0x52, flags: 0x0}, - 354: {region: 0x97, script: 0xd0, flags: 0x0}, - 355: {region: 0x9c, script: 0x52, flags: 0x0}, - 356: {region: 0x4a, script: 0x52, flags: 0x0}, - 357: {region: 0xad, script: 0x4f, flags: 0x0}, - 358: {region: 0x4a, script: 0x52, flags: 0x0}, - 359: {region: 0x15f, script: 0x52, flags: 0x0}, - 360: {region: 0x9a, script: 0x5, flags: 0x0}, - 361: {region: 0xb4, script: 0x52, flags: 0x0}, - 362: {region: 0xb6, script: 0x52, flags: 0x0}, - 363: {region: 0x4a, script: 0x52, flags: 0x0}, - 364: {region: 0x4a, script: 0x52, flags: 0x0}, - 365: {region: 0xa2, script: 0x52, flags: 0x0}, - 366: {region: 0xa2, script: 0x52, flags: 0x0}, - 367: {region: 0x9a, script: 0x5, flags: 0x0}, - 368: {region: 0xb6, script: 0x52, flags: 0x0}, - 369: {region: 0x121, script: 0xd5, flags: 0x0}, - 370: {region: 0x52, script: 0x34, flags: 0x0}, - 371: {region: 0x129, script: 0x52, flags: 0x0}, - 372: {region: 0x93, script: 0x52, flags: 0x0}, - 373: {region: 0x51, script: 0x52, flags: 0x0}, - 374: {region: 0x97, script: 0x20, flags: 0x0}, - 375: {region: 0x97, script: 0x20, flags: 0x0}, - 376: {region: 0x93, script: 0x52, flags: 0x0}, - 377: {region: 0x25, script: 0x3, flags: 0x1}, - 378: {region: 0xa2, script: 0x52, flags: 0x0}, - 379: {region: 0xcd, script: 0x52, flags: 0x0}, - 380: {region: 0x104, script: 0x1e, flags: 0x0}, - 381: {region: 0xe5, script: 0x52, flags: 0x0}, - 382: {region: 0x93, script: 0x52, flags: 0x0}, - 383: {region: 0x110, script: 0x52, flags: 0x0}, - 384: {region: 0xa2, script: 0x52, flags: 0x0}, - 385: {region: 0x121, script: 0x5, flags: 0x0}, - 386: {region: 0xca, script: 0x52, flags: 0x0}, - 387: {region: 0xbd, script: 0x52, flags: 0x0}, - 388: {region: 0xcf, script: 0x52, flags: 0x0}, - 389: {region: 0x51, script: 0x52, flags: 0x0}, - 390: {region: 0xd9, script: 0x20, flags: 0x0}, - 391: {region: 0x12d, script: 0x52, flags: 0x0}, - 392: {region: 0xbe, script: 0x52, flags: 0x0}, - 393: {region: 0xde, script: 0x52, flags: 0x0}, - 394: {region: 0x93, script: 0x52, flags: 0x0}, - 395: {region: 0x99, script: 0x36, flags: 0x0}, - 396: {region: 0xc0, script: 0x1e, flags: 0x0}, - 397: {region: 0x97, script: 0x64, flags: 0x0}, - 398: {region: 0x109, script: 0x52, flags: 0x0}, - 399: {region: 0x28, script: 0x3, flags: 0x1}, - 400: {region: 0x97, script: 0xe, flags: 0x0}, - 401: {region: 0xc2, script: 0x6b, flags: 0x0}, - 403: {region: 0x48, script: 0x52, flags: 0x0}, - 404: {region: 0x48, script: 0x52, flags: 0x0}, - 405: {region: 0x36, script: 0x52, flags: 0x0}, - 406: {region: 0x97, script: 0x20, flags: 0x0}, - 407: {region: 0xd9, script: 0x20, flags: 0x0}, - 408: {region: 0x104, script: 0x1e, flags: 0x0}, - 409: {region: 0x34, script: 0x68, flags: 0x0}, - 410: {region: 0x2b, script: 0x3, flags: 0x1}, - 411: {region: 0xc9, script: 0x52, flags: 0x0}, - 412: {region: 0x97, script: 0x20, flags: 0x0}, - 413: {region: 0x51, script: 0x52, flags: 0x0}, - 415: {region: 0x132, script: 0x52, flags: 0x0}, - 416: {region: 0xe6, script: 0x5, flags: 0x0}, - 417: {region: 0xc1, script: 0x52, flags: 0x0}, - 418: {region: 0x97, script: 0x20, flags: 0x0}, - 419: {region: 0x93, script: 0x52, flags: 0x0}, - 420: {region: 0x161, script: 0x52, flags: 0x0}, - 421: {region: 0xc2, script: 0x6b, flags: 0x0}, - 422: {region: 0x104, script: 0x1e, flags: 0x0}, - 423: {region: 0x12f, script: 0x52, flags: 0x0}, - 424: {region: 0x9a, script: 0x5d, flags: 0x0}, - 425: {region: 0x9a, script: 0x5, flags: 0x0}, - 426: {region: 0xdb, script: 0x52, flags: 0x0}, - 428: {region: 0x52, script: 0x34, flags: 0x0}, - 429: {region: 0x9c, script: 0x52, flags: 0x0}, - 430: {region: 0xd0, script: 0x52, flags: 0x0}, - 431: {region: 0xd8, script: 0x52, flags: 0x0}, - 432: {region: 0xcd, script: 0x52, flags: 0x0}, - 433: {region: 0x161, script: 0x52, flags: 0x0}, - 434: {region: 0xcf, script: 0x52, flags: 0x0}, - 435: {region: 0x5f, script: 0x52, flags: 0x0}, - 436: {region: 0xd9, script: 0x20, flags: 0x0}, - 437: {region: 0xd9, script: 0x20, flags: 0x0}, - 438: {region: 0xd0, script: 0x52, flags: 0x0}, - 439: {region: 0xcf, script: 0x52, flags: 0x0}, - 440: {region: 0xcd, script: 0x52, flags: 0x0}, - 441: {region: 0xcd, script: 0x52, flags: 0x0}, - 442: {region: 0x93, script: 0x52, flags: 0x0}, - 443: {region: 0xdd, script: 0x52, flags: 0x0}, - 444: {region: 0x97, script: 0x52, flags: 0x0}, - 445: {region: 0xd7, script: 0x52, flags: 0x0}, - 446: {region: 0x51, script: 0x52, flags: 0x0}, - 447: {region: 0xd8, script: 0x52, flags: 0x0}, - 448: {region: 0x51, script: 0x52, flags: 0x0}, - 449: {region: 0xd8, script: 0x52, flags: 0x0}, - 450: {region: 0x121, script: 0x4e, flags: 0x0}, - 451: {region: 0x97, script: 0x20, flags: 0x0}, - 452: {region: 0x10a, script: 0xb7, flags: 0x0}, - 453: {region: 0x82, script: 0x70, flags: 0x0}, - 454: {region: 0x15e, script: 0x52, flags: 0x0}, - 455: {region: 0x48, script: 0x17, flags: 0x0}, - 456: {region: 0x15e, script: 0x52, flags: 0x0}, - 457: {region: 0x115, script: 0x52, flags: 0x0}, - 458: {region: 0x132, script: 0x52, flags: 0x0}, - 459: {region: 0x52, script: 0x52, flags: 0x0}, - 460: {region: 0xcc, script: 0x52, flags: 0x0}, - 461: {region: 0x12d, script: 0x52, flags: 0x0}, - 462: {region: 0x12f, script: 0x52, flags: 0x0}, - 463: {region: 0x7e, script: 0x52, flags: 0x0}, - 464: {region: 0x76, script: 0x52, flags: 0x0}, - 466: {region: 0x6e, script: 0x52, flags: 0x0}, - 467: {region: 0x97, script: 0x75, flags: 0x0}, - 468: {region: 0x7b, script: 0x1e, flags: 0x0}, - 469: {region: 0x132, script: 0x76, flags: 0x0}, - 470: {region: 0xc3, script: 0x74, flags: 0x0}, - 471: {region: 0x2e, script: 0x3, flags: 0x1}, - 472: {region: 0xe5, script: 0x52, flags: 0x0}, - 473: {region: 0x31, script: 0x2, flags: 0x1}, - 474: {region: 0xe5, script: 0x52, flags: 0x0}, - 475: {region: 0x2f, script: 0x52, flags: 0x0}, - 476: {region: 0xee, script: 0x52, flags: 0x0}, - 477: {region: 0x76, script: 0x52, flags: 0x0}, - 478: {region: 0xd4, script: 0x52, flags: 0x0}, - 479: {region: 0x132, script: 0x52, flags: 0x0}, - 480: {region: 0x48, script: 0x52, flags: 0x0}, - 481: {region: 0x9a, script: 0xdd, flags: 0x0}, - 482: {region: 0x5f, script: 0x52, flags: 0x0}, - 483: {region: 0xae, script: 0x7f, flags: 0x0}, - 485: {region: 0x97, script: 0x12, flags: 0x0}, - 486: {region: 0xa2, script: 0x52, flags: 0x0}, - 487: {region: 0xe7, script: 0x52, flags: 0x0}, - 488: {region: 0x9c, script: 0x52, flags: 0x0}, - 489: {region: 0x85, script: 0x2d, flags: 0x0}, - 490: {region: 0x73, script: 0x52, flags: 0x0}, - 491: {region: 0xe6, script: 0x45, flags: 0x0}, - 492: {region: 0x9a, script: 0x5, flags: 0x0}, - 493: {region: 0x1, script: 0x52, flags: 0x0}, - 494: {region: 0x23, script: 0x5, flags: 0x0}, - 495: {region: 0x40, script: 0x52, flags: 0x0}, - 496: {region: 0x78, script: 0x52, flags: 0x0}, - 497: {region: 0xe2, script: 0x52, flags: 0x0}, - 498: {region: 0x87, script: 0x52, flags: 0x0}, - 499: {region: 0x68, script: 0x52, flags: 0x0}, - 500: {region: 0x97, script: 0x20, flags: 0x0}, - 501: {region: 0x100, script: 0x52, flags: 0x0}, - 502: {region: 0x93, script: 0x52, flags: 0x0}, - 503: {region: 0x9c, script: 0x52, flags: 0x0}, - 504: {region: 0x97, script: 0x52, flags: 0x0}, - 505: {region: 0x33, script: 0x2, flags: 0x1}, - 506: {region: 0xd9, script: 0x20, flags: 0x0}, - 507: {region: 0x34, script: 0xe, flags: 0x0}, - 508: {region: 0x4d, script: 0x52, flags: 0x0}, - 509: {region: 0x70, script: 0x52, flags: 0x0}, - 510: {region: 0x4d, script: 0x52, flags: 0x0}, - 511: {region: 0x9a, script: 0x5, flags: 0x0}, - 512: {region: 0x10a, script: 0x52, flags: 0x0}, - 513: {region: 0x39, script: 0x52, flags: 0x0}, - 514: {region: 0xcf, script: 0x52, flags: 0x0}, - 515: {region: 0x102, script: 0x52, flags: 0x0}, - 516: {region: 0x93, script: 0x52, flags: 0x0}, - 517: {region: 0x12d, script: 0x52, flags: 0x0}, - 518: {region: 0x71, script: 0x52, flags: 0x0}, - 519: {region: 0x104, script: 0x1e, flags: 0x0}, - 520: {region: 0x12e, script: 0x1e, flags: 0x0}, - 521: {region: 0x107, script: 0x52, flags: 0x0}, - 522: {region: 0x105, script: 0x52, flags: 0x0}, - 523: {region: 0x12d, script: 0x52, flags: 0x0}, - 524: {region: 0xa0, script: 0x44, flags: 0x0}, - 525: {region: 0x97, script: 0x20, flags: 0x0}, - 526: {region: 0x7e, script: 0x52, flags: 0x0}, - 527: {region: 0x104, script: 0x1e, flags: 0x0}, - 528: {region: 0xa2, script: 0x52, flags: 0x0}, - 529: {region: 0x93, script: 0x52, flags: 0x0}, - 530: {region: 0x97, script: 0x52, flags: 0x0}, - 531: {region: 0x97, script: 0xbb, flags: 0x0}, - 532: {region: 0x12d, script: 0x52, flags: 0x0}, - 533: {region: 0x9c, script: 0x52, flags: 0x0}, - 534: {region: 0x97, script: 0x20, flags: 0x0}, - 535: {region: 0x9c, script: 0x52, flags: 0x0}, - 536: {region: 0x79, script: 0x52, flags: 0x0}, - 537: {region: 0x48, script: 0x52, flags: 0x0}, - 538: {region: 0x35, script: 0x4, flags: 0x1}, - 539: {region: 0x9c, script: 0x52, flags: 0x0}, - 540: {region: 0x9a, script: 0x5, flags: 0x0}, - 541: {region: 0xd8, script: 0x52, flags: 0x0}, - 542: {region: 0x4e, script: 0x52, flags: 0x0}, - 543: {region: 0xcf, script: 0x52, flags: 0x0}, - 544: {region: 0xcd, script: 0x52, flags: 0x0}, - 545: {region: 0xc1, script: 0x52, flags: 0x0}, - 546: {region: 0x4b, script: 0x52, flags: 0x0}, - 547: {region: 0x94, script: 0x72, flags: 0x0}, - 548: {region: 0xb4, script: 0x52, flags: 0x0}, - 550: {region: 0xb8, script: 0xd2, flags: 0x0}, - 551: {region: 0xc2, script: 0x6b, flags: 0x0}, - 552: {region: 0xb1, script: 0xc1, flags: 0x0}, - 553: {region: 0x6e, script: 0x52, flags: 0x0}, - 554: {region: 0x10f, script: 0x52, flags: 0x0}, - 555: {region: 0xe6, script: 0x5, flags: 0x0}, - 556: {region: 0x10d, script: 0x52, flags: 0x0}, - 557: {region: 0xe7, script: 0x52, flags: 0x0}, - 558: {region: 0x93, script: 0x52, flags: 0x0}, - 559: {region: 0x13f, script: 0x52, flags: 0x0}, - 560: {region: 0x10a, script: 0x52, flags: 0x0}, - 562: {region: 0x10a, script: 0x52, flags: 0x0}, - 563: {region: 0x70, script: 0x52, flags: 0x0}, - 564: {region: 0x95, script: 0xb8, flags: 0x0}, - 565: {region: 0x70, script: 0x52, flags: 0x0}, - 566: {region: 0x161, script: 0x52, flags: 0x0}, - 567: {region: 0xc1, script: 0x52, flags: 0x0}, - 568: {region: 0x113, script: 0x52, flags: 0x0}, - 569: {region: 0x121, script: 0xd5, flags: 0x0}, - 570: {region: 0x26, script: 0x52, flags: 0x0}, - 571: {region: 0x39, script: 0x5, flags: 0x1}, - 572: {region: 0x97, script: 0xc2, flags: 0x0}, - 573: {region: 0x114, script: 0x52, flags: 0x0}, - 574: {region: 0x112, script: 0x52, flags: 0x0}, - 575: {region: 0x97, script: 0x20, flags: 0x0}, - 576: {region: 0x15e, script: 0x52, flags: 0x0}, - 577: {region: 0x6c, script: 0x52, flags: 0x0}, - 578: {region: 0x15e, script: 0x52, flags: 0x0}, - 579: {region: 0x5f, script: 0x52, flags: 0x0}, - 580: {region: 0x93, script: 0x52, flags: 0x0}, - 581: {region: 0x12d, script: 0x52, flags: 0x0}, - 582: {region: 0x82, script: 0x52, flags: 0x0}, - 583: {region: 0x10a, script: 0x52, flags: 0x0}, - 584: {region: 0x12d, script: 0x52, flags: 0x0}, - 585: {region: 0x15c, script: 0x5, flags: 0x0}, - 586: {region: 0x4a, script: 0x52, flags: 0x0}, - 587: {region: 0x5f, script: 0x52, flags: 0x0}, - 588: {region: 0x97, script: 0x20, flags: 0x0}, - 589: {region: 0x93, script: 0x52, flags: 0x0}, - 590: {region: 0x34, script: 0xe, flags: 0x0}, - 591: {region: 0x99, script: 0xc5, flags: 0x0}, - 592: {region: 0xe7, script: 0x52, flags: 0x0}, - 593: {region: 0x97, script: 0xcd, flags: 0x0}, - 594: {region: 0xd9, script: 0x20, flags: 0x0}, - 595: {region: 0xe5, script: 0x52, flags: 0x0}, - 596: {region: 0x97, script: 0x4a, flags: 0x0}, - 597: {region: 0x52, script: 0xcb, flags: 0x0}, - 598: {region: 0xd9, script: 0x20, flags: 0x0}, - 599: {region: 0xd9, script: 0x20, flags: 0x0}, - 600: {region: 0x97, script: 0xd0, flags: 0x0}, - 601: {region: 0x110, script: 0x52, flags: 0x0}, - 602: {region: 0x12f, script: 0x52, flags: 0x0}, - 603: {region: 0x124, script: 0x52, flags: 0x0}, - 604: {region: 0x3e, script: 0x3, flags: 0x1}, - 605: {region: 0x121, script: 0xd5, flags: 0x0}, - 606: {region: 0xd9, script: 0x20, flags: 0x0}, - 607: {region: 0xd9, script: 0x20, flags: 0x0}, - 608: {region: 0xd9, script: 0x20, flags: 0x0}, - 609: {region: 0x6e, script: 0x27, flags: 0x0}, - 610: {region: 0x6c, script: 0x27, flags: 0x0}, - 611: {region: 0xd4, script: 0x52, flags: 0x0}, - 612: {region: 0x125, script: 0x52, flags: 0x0}, - 613: {region: 0x123, script: 0x52, flags: 0x0}, - 614: {region: 0x31, script: 0x52, flags: 0x0}, - 615: {region: 0xd9, script: 0x20, flags: 0x0}, - 616: {region: 0xe5, script: 0x52, flags: 0x0}, - 617: {region: 0x31, script: 0x52, flags: 0x0}, - 618: {region: 0xd2, script: 0x52, flags: 0x0}, - 619: {region: 0x15e, script: 0x52, flags: 0x0}, - 620: {region: 0x127, script: 0x52, flags: 0x0}, - 621: {region: 0xcc, script: 0x52, flags: 0x0}, - 622: {region: 0xe4, script: 0x52, flags: 0x0}, - 623: {region: 0x129, script: 0x52, flags: 0x0}, - 624: {region: 0x129, script: 0x52, flags: 0x0}, - 625: {region: 0x12c, script: 0x52, flags: 0x0}, - 626: {region: 0x15e, script: 0x52, flags: 0x0}, - 627: {region: 0x85, script: 0x2d, flags: 0x0}, - 628: {region: 0xd9, script: 0x20, flags: 0x0}, - 629: {region: 0xe5, script: 0x52, flags: 0x0}, - 630: {region: 0x42, script: 0xd6, flags: 0x0}, - 631: {region: 0x104, script: 0x1e, flags: 0x0}, - 632: {region: 0x12f, script: 0x52, flags: 0x0}, - 633: {region: 0x121, script: 0xd5, flags: 0x0}, - 634: {region: 0x31, script: 0x52, flags: 0x0}, - 635: {region: 0xcc, script: 0x52, flags: 0x0}, - 636: {region: 0x12b, script: 0x52, flags: 0x0}, - 638: {region: 0xd2, script: 0x52, flags: 0x0}, - 639: {region: 0x52, script: 0xce, flags: 0x0}, - 640: {region: 0xe3, script: 0x52, flags: 0x0}, - 641: {region: 0x104, script: 0x1e, flags: 0x0}, - 642: {region: 0xb8, script: 0x52, flags: 0x0}, - 643: {region: 0x104, script: 0x1e, flags: 0x0}, - 644: {region: 0x41, script: 0x4, flags: 0x1}, - 645: {region: 0x11a, script: 0xd8, flags: 0x0}, - 646: {region: 0x12e, script: 0x1e, flags: 0x0}, - 647: {region: 0x73, script: 0x52, flags: 0x0}, - 648: {region: 0x29, script: 0x52, flags: 0x0}, - 650: {region: 0x45, script: 0x3, flags: 0x1}, - 651: {region: 0x97, script: 0xe, flags: 0x0}, - 652: {region: 0xe6, script: 0x5, flags: 0x0}, - 653: {region: 0x48, script: 0x4, flags: 0x1}, - 654: {region: 0xb2, script: 0xd9, flags: 0x0}, - 655: {region: 0x15e, script: 0x52, flags: 0x0}, - 656: {region: 0x9c, script: 0x52, flags: 0x0}, - 657: {region: 0x104, script: 0x52, flags: 0x0}, - 658: {region: 0x13b, script: 0x52, flags: 0x0}, - 659: {region: 0x119, script: 0x52, flags: 0x0}, - 660: {region: 0x35, script: 0x52, flags: 0x0}, - 661: {region: 0x5f, script: 0x52, flags: 0x0}, - 662: {region: 0xcf, script: 0x52, flags: 0x0}, - 663: {region: 0x1, script: 0x52, flags: 0x0}, - 664: {region: 0x104, script: 0x52, flags: 0x0}, - 665: {region: 0x69, script: 0x52, flags: 0x0}, - 666: {region: 0x12d, script: 0x52, flags: 0x0}, - 667: {region: 0x35, script: 0x52, flags: 0x0}, - 668: {region: 0x4d, script: 0x52, flags: 0x0}, - 669: {region: 0x6e, script: 0x27, flags: 0x0}, - 670: {region: 0xe5, script: 0x52, flags: 0x0}, - 671: {region: 0x2e, script: 0x52, flags: 0x0}, - 672: {region: 0x97, script: 0xd0, flags: 0x0}, - 673: {region: 0x97, script: 0x20, flags: 0x0}, - 674: {region: 0x13d, script: 0x52, flags: 0x0}, - 675: {region: 0xa6, script: 0x5, flags: 0x0}, - 676: {region: 0x112, script: 0x52, flags: 0x0}, - 677: {region: 0x97, script: 0x20, flags: 0x0}, - 678: {region: 0x52, script: 0x34, flags: 0x0}, - 679: {region: 0x40, script: 0x52, flags: 0x0}, - 680: {region: 0x129, script: 0x18, flags: 0x0}, - 681: {region: 0x15e, script: 0x52, flags: 0x0}, - 682: {region: 0x129, script: 0x5a, flags: 0x0}, - 683: {region: 0x129, script: 0x5b, flags: 0x0}, - 684: {region: 0x7b, script: 0x29, flags: 0x0}, - 685: {region: 0x52, script: 0x5e, flags: 0x0}, - 686: {region: 0x109, script: 0x62, flags: 0x0}, - 687: {region: 0x106, script: 0x6c, flags: 0x0}, - 688: {region: 0x97, script: 0x20, flags: 0x0}, - 689: {region: 0x12f, script: 0x52, flags: 0x0}, - 690: {region: 0x9a, script: 0x82, flags: 0x0}, - 691: {region: 0x15b, script: 0xba, flags: 0x0}, - 692: {region: 0xd9, script: 0x20, flags: 0x0}, - 693: {region: 0xcf, script: 0x52, flags: 0x0}, - 694: {region: 0x73, script: 0x52, flags: 0x0}, - 695: {region: 0x51, script: 0x52, flags: 0x0}, - 696: {region: 0x51, script: 0x52, flags: 0x0}, - 697: {region: 0x1, script: 0x37, flags: 0x0}, - 698: {region: 0xd4, script: 0x52, flags: 0x0}, - 699: {region: 0x40, script: 0x52, flags: 0x0}, - 700: {region: 0xcd, script: 0x52, flags: 0x0}, - 701: {region: 0x4c, script: 0x3, flags: 0x1}, - 702: {region: 0x52, script: 0x52, flags: 0x0}, - 703: {region: 0x109, script: 0x52, flags: 0x0}, - 705: {region: 0xa6, script: 0x5, flags: 0x0}, - 706: {region: 0xd7, script: 0x52, flags: 0x0}, - 707: {region: 0xb8, script: 0xd2, flags: 0x0}, - 708: {region: 0x4f, script: 0x14, flags: 0x1}, - 709: {region: 0xce, script: 0x52, flags: 0x0}, - 710: {region: 0x15e, script: 0x52, flags: 0x0}, - 712: {region: 0x129, script: 0x52, flags: 0x0}, -} - -// likelyLangList holds lists info associated with likelyLang. -// Size: 396 bytes, 99 elements -var likelyLangList = [99]likelyScriptRegion{ - 0: {region: 0x9a, script: 0x7, flags: 0x0}, - 1: {region: 0x9f, script: 0x6d, flags: 0x2}, - 2: {region: 0x11a, script: 0x78, flags: 0x2}, - 3: {region: 0x31, script: 0x52, flags: 0x0}, - 4: {region: 0x99, script: 0x5, flags: 0x4}, - 5: {region: 0x9a, script: 0x5, flags: 0x4}, - 6: {region: 0x104, script: 0x1e, flags: 0x4}, - 7: {region: 0x9a, script: 0x5, flags: 0x2}, - 8: {region: 0x97, script: 0xe, flags: 0x0}, - 9: {region: 0x34, script: 0x16, flags: 0x2}, - 10: {region: 0x104, script: 0x1e, flags: 0x0}, - 11: {region: 0x37, script: 0x2a, flags: 0x2}, - 12: {region: 0x132, script: 0x52, flags: 0x0}, - 13: {region: 0x79, script: 0xbd, flags: 0x2}, - 14: {region: 0x112, script: 0x52, flags: 0x0}, - 15: {region: 0x82, script: 0x1, flags: 0x2}, - 16: {region: 0x5c, script: 0x1d, flags: 0x0}, - 17: {region: 0x85, script: 0x57, flags: 0x2}, - 18: {region: 0xd4, script: 0x52, flags: 0x0}, - 19: {region: 0x51, script: 0x5, flags: 0x4}, - 20: {region: 0x109, script: 0x5, flags: 0x4}, - 21: {region: 0xac, script: 0x1e, flags: 0x0}, - 22: {region: 0x23, script: 0x5, flags: 0x4}, - 23: {region: 0x52, script: 0x5, flags: 0x4}, - 24: {region: 0x9a, script: 0x5, flags: 0x4}, - 25: {region: 0xc3, script: 0x5, flags: 0x4}, - 26: {region: 0x52, script: 0x5, flags: 0x2}, - 27: {region: 0x129, script: 0x52, flags: 0x0}, - 28: {region: 0xae, script: 0x5, flags: 0x4}, - 29: {region: 0x99, script: 0x5, flags: 0x2}, - 30: {region: 0xa3, script: 0x1e, flags: 0x0}, - 31: {region: 0x52, script: 0x5, flags: 0x4}, - 32: {region: 0x129, script: 0x52, flags: 0x4}, - 33: {region: 0x52, script: 0x5, flags: 0x2}, - 34: {region: 0x129, script: 0x52, flags: 0x2}, - 35: {region: 0xd9, script: 0x20, flags: 0x0}, - 36: {region: 0x97, script: 0x55, flags: 0x2}, - 37: {region: 0x81, script: 0x52, flags: 0x0}, - 38: {region: 0x82, script: 0x70, flags: 0x4}, - 39: {region: 0x82, script: 0x70, flags: 0x2}, - 40: {region: 0xc3, script: 0x1e, flags: 0x0}, - 41: {region: 0x52, script: 0x66, flags: 0x4}, - 42: {region: 0x52, script: 0x66, flags: 0x2}, - 43: {region: 0xce, script: 0x52, flags: 0x0}, - 44: {region: 0x49, script: 0x5, flags: 0x4}, - 45: {region: 0x93, script: 0x5, flags: 0x4}, - 46: {region: 0x97, script: 0x2f, flags: 0x0}, - 47: {region: 0xe6, script: 0x5, flags: 0x4}, - 48: {region: 0xe6, script: 0x5, flags: 0x2}, - 49: {region: 0x9a, script: 0x7c, flags: 0x0}, - 50: {region: 0x52, script: 0x7d, flags: 0x2}, - 51: {region: 0xb8, script: 0xd2, flags: 0x0}, - 52: {region: 0xd7, script: 0x52, flags: 0x4}, - 53: {region: 0xe6, script: 0x5, flags: 0x0}, - 54: {region: 0x97, script: 0x20, flags: 0x2}, - 55: {region: 0x97, script: 0x47, flags: 0x2}, - 56: {region: 0x97, script: 0xc0, flags: 0x2}, - 57: {region: 0x103, script: 0x1e, flags: 0x0}, - 58: {region: 0xbb, script: 0x52, flags: 0x4}, - 59: {region: 0x102, script: 0x52, flags: 0x4}, - 60: {region: 0x104, script: 0x52, flags: 0x4}, - 61: {region: 0x129, script: 0x52, flags: 0x4}, - 62: {region: 0x122, script: 0x1e, flags: 0x0}, - 63: {region: 0xe6, script: 0x5, flags: 0x4}, - 64: {region: 0xe6, script: 0x5, flags: 0x2}, - 65: {region: 0x52, script: 0x5, flags: 0x0}, - 66: {region: 0xac, script: 0x1e, flags: 0x4}, - 67: {region: 0xc3, script: 0x1e, flags: 0x4}, - 68: {region: 0xac, script: 0x1e, flags: 0x2}, - 69: {region: 0x97, script: 0xe, flags: 0x0}, - 70: {region: 0xd9, script: 0x20, flags: 0x4}, - 71: {region: 0xd9, script: 0x20, flags: 0x2}, - 72: {region: 0x134, script: 0x52, flags: 0x0}, - 73: {region: 0x23, script: 0x5, flags: 0x4}, - 74: {region: 0x52, script: 0x1e, flags: 0x4}, - 75: {region: 0x23, script: 0x5, flags: 0x2}, - 76: {region: 0x8b, script: 0x35, flags: 0x0}, - 77: {region: 0x52, script: 0x34, flags: 0x4}, - 78: {region: 0x52, script: 0x34, flags: 0x2}, - 79: {region: 0x52, script: 0x34, flags: 0x0}, - 80: {region: 0x2e, script: 0x35, flags: 0x4}, - 81: {region: 0x3d, script: 0x35, flags: 0x4}, - 82: {region: 0x79, script: 0x35, flags: 0x4}, - 83: {region: 0x7c, script: 0x35, flags: 0x4}, - 84: {region: 0x8b, script: 0x35, flags: 0x4}, - 85: {region: 0x93, script: 0x35, flags: 0x4}, - 86: {region: 0xc4, script: 0x35, flags: 0x4}, - 87: {region: 0xce, script: 0x35, flags: 0x4}, - 88: {region: 0xe0, script: 0x35, flags: 0x4}, - 89: {region: 0xe3, script: 0x35, flags: 0x4}, - 90: {region: 0xe5, script: 0x35, flags: 0x4}, - 91: {region: 0x114, script: 0x35, flags: 0x4}, - 92: {region: 0x121, script: 0x35, flags: 0x4}, - 93: {region: 0x12c, script: 0x35, flags: 0x4}, - 94: {region: 0x132, script: 0x35, flags: 0x4}, - 95: {region: 0x13b, script: 0x35, flags: 0x4}, - 96: {region: 0x12c, script: 0x11, flags: 0x2}, - 97: {region: 0x12c, script: 0x30, flags: 0x2}, - 98: {region: 0x12c, script: 0x35, flags: 0x2}, -} - -type likelyLangScript struct { - lang uint16 - script uint8 - flags uint8 -} - -// likelyRegion is a lookup table, indexed by regionID, for the most likely -// languages and scripts given incomplete information. If more entries exist -// for a given regionID, lang and script are the index and size respectively -// of the list in likelyRegionList. -// TODO: exclude containers and user-definable regions from the list. -// Size: 1420 bytes, 355 elements -var likelyRegion = [355]likelyLangScript{ - 33: {lang: 0x61, script: 0x52, flags: 0x0}, - 34: {lang: 0x15, script: 0x5, flags: 0x0}, - 35: {lang: 0x0, script: 0x2, flags: 0x1}, - 38: {lang: 0x2, script: 0x2, flags: 0x1}, - 39: {lang: 0x4, script: 0x2, flags: 0x1}, - 41: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 42: {lang: 0x0, script: 0x52, flags: 0x0}, - 43: {lang: 0x9d, script: 0x52, flags: 0x0}, - 44: {lang: 0x22f, script: 0x52, flags: 0x0}, - 45: {lang: 0x85, script: 0x52, flags: 0x0}, - 47: {lang: 0x1bd, script: 0x52, flags: 0x0}, - 48: {lang: 0x247, script: 0x52, flags: 0x0}, - 49: {lang: 0x24, script: 0x52, flags: 0x0}, - 50: {lang: 0x6, script: 0x2, flags: 0x1}, - 52: {lang: 0x4b, script: 0xe, flags: 0x0}, - 53: {lang: 0x1bd, script: 0x52, flags: 0x0}, - 54: {lang: 0xaf, script: 0x52, flags: 0x0}, - 55: {lang: 0x38, script: 0x1e, flags: 0x0}, - 56: {lang: 0x15, script: 0x5, flags: 0x0}, - 57: {lang: 0x201, script: 0x52, flags: 0x0}, - 58: {lang: 0xaf, script: 0x52, flags: 0x0}, - 59: {lang: 0xaf, script: 0x52, flags: 0x0}, - 61: {lang: 0x19a, script: 0x52, flags: 0x0}, - 62: {lang: 0x9d, script: 0x52, flags: 0x0}, - 63: {lang: 0x1db, script: 0x52, flags: 0x0}, - 64: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 66: {lang: 0x8, script: 0x2, flags: 0x1}, - 68: {lang: 0x0, script: 0x52, flags: 0x0}, - 70: {lang: 0x2f, script: 0x1e, flags: 0x0}, - 72: {lang: 0x2b9, script: 0x37, flags: 0x2}, - 73: {lang: 0x19a, script: 0x5, flags: 0x2}, - 74: {lang: 0x248, script: 0x52, flags: 0x0}, - 75: {lang: 0xaf, script: 0x52, flags: 0x0}, - 76: {lang: 0xaf, script: 0x52, flags: 0x0}, - 77: {lang: 0x85, script: 0x52, flags: 0x0}, - 78: {lang: 0xaf, script: 0x52, flags: 0x0}, - 80: {lang: 0x9d, script: 0x52, flags: 0x0}, - 81: {lang: 0xaf, script: 0x52, flags: 0x0}, - 82: {lang: 0xa, script: 0x5, flags: 0x1}, - 83: {lang: 0x9d, script: 0x52, flags: 0x0}, - 84: {lang: 0x0, script: 0x52, flags: 0x0}, - 85: {lang: 0x9d, script: 0x52, flags: 0x0}, - 88: {lang: 0x9d, script: 0x52, flags: 0x0}, - 89: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 90: {lang: 0x1db, script: 0x52, flags: 0x0}, - 92: {lang: 0xf, script: 0x2, flags: 0x1}, - 93: {lang: 0x79, script: 0x52, flags: 0x0}, - 95: {lang: 0x85, script: 0x52, flags: 0x0}, - 97: {lang: 0x1, script: 0x52, flags: 0x0}, - 98: {lang: 0x80, script: 0x52, flags: 0x0}, - 100: {lang: 0x9d, script: 0x52, flags: 0x0}, - 102: {lang: 0x11, script: 0x2, flags: 0x1}, - 103: {lang: 0x9d, script: 0x52, flags: 0x0}, - 104: {lang: 0x9d, script: 0x52, flags: 0x0}, - 105: {lang: 0x9f, script: 0x52, flags: 0x0}, - 106: {lang: 0x15, script: 0x5, flags: 0x0}, - 107: {lang: 0x15, script: 0x5, flags: 0x0}, - 108: {lang: 0x261, script: 0x27, flags: 0x0}, - 109: {lang: 0x9d, script: 0x52, flags: 0x0}, - 110: {lang: 0x13, script: 0x2, flags: 0x1}, - 112: {lang: 0xa8, script: 0x52, flags: 0x0}, - 113: {lang: 0xe2, script: 0x20, flags: 0x2}, - 116: {lang: 0xad, script: 0x52, flags: 0x0}, - 118: {lang: 0xaf, script: 0x52, flags: 0x0}, - 120: {lang: 0xaf, script: 0x52, flags: 0x0}, - 121: {lang: 0x15, script: 0x2, flags: 0x1}, - 123: {lang: 0x17, script: 0x3, flags: 0x1}, - 124: {lang: 0xaf, script: 0x52, flags: 0x0}, - 126: {lang: 0xd, script: 0x52, flags: 0x0}, - 128: {lang: 0x131, script: 0x52, flags: 0x0}, - 130: {lang: 0xaf, script: 0x52, flags: 0x0}, - 131: {lang: 0xaf, script: 0x52, flags: 0x0}, - 132: {lang: 0x9d, script: 0x52, flags: 0x0}, - 133: {lang: 0x1a, script: 0x2, flags: 0x1}, - 134: {lang: 0x0, script: 0x52, flags: 0x0}, - 135: {lang: 0x9d, script: 0x52, flags: 0x0}, - 137: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 139: {lang: 0x2c4, script: 0x35, flags: 0x0}, - 140: {lang: 0x0, script: 0x52, flags: 0x0}, - 141: {lang: 0x9d, script: 0x52, flags: 0x0}, - 142: {lang: 0xee, script: 0x52, flags: 0x0}, - 143: {lang: 0xf1, script: 0x52, flags: 0x0}, - 144: {lang: 0xf2, script: 0x52, flags: 0x0}, - 146: {lang: 0x9d, script: 0x52, flags: 0x0}, - 147: {lang: 0x1c, script: 0x2, flags: 0x1}, - 149: {lang: 0xe0, script: 0x37, flags: 0x0}, - 151: {lang: 0x1e, script: 0x3, flags: 0x1}, - 153: {lang: 0x15, script: 0x5, flags: 0x0}, - 154: {lang: 0x21, script: 0x2, flags: 0x1}, - 155: {lang: 0x102, script: 0x52, flags: 0x0}, - 156: {lang: 0x103, script: 0x52, flags: 0x0}, - 159: {lang: 0x15, script: 0x5, flags: 0x0}, - 160: {lang: 0x107, script: 0x41, flags: 0x0}, - 162: {lang: 0x248, script: 0x52, flags: 0x0}, - 163: {lang: 0x14d, script: 0x1e, flags: 0x0}, - 164: {lang: 0x23, script: 0x3, flags: 0x1}, - 166: {lang: 0x26, script: 0x2, flags: 0x1}, - 168: {lang: 0x136, script: 0x4b, flags: 0x0}, - 169: {lang: 0x136, script: 0x4b, flags: 0x0}, - 170: {lang: 0x15, script: 0x5, flags: 0x0}, - 172: {lang: 0x207, script: 0x1e, flags: 0x0}, - 173: {lang: 0x28, script: 0x2, flags: 0x1}, - 174: {lang: 0x15, script: 0x5, flags: 0x0}, - 176: {lang: 0x85, script: 0x52, flags: 0x0}, - 177: {lang: 0x228, script: 0xc1, flags: 0x0}, - 179: {lang: 0x242, script: 0x52, flags: 0x0}, - 180: {lang: 0x169, script: 0x52, flags: 0x0}, - 181: {lang: 0xaf, script: 0x52, flags: 0x0}, - 182: {lang: 0x170, script: 0x52, flags: 0x0}, - 183: {lang: 0x15, script: 0x5, flags: 0x0}, - 184: {lang: 0x2a, script: 0x2, flags: 0x1}, - 185: {lang: 0xaf, script: 0x52, flags: 0x0}, - 186: {lang: 0x2c, script: 0x2, flags: 0x1}, - 187: {lang: 0x23b, script: 0x52, flags: 0x0}, - 188: {lang: 0xaf, script: 0x52, flags: 0x0}, - 189: {lang: 0x183, script: 0x52, flags: 0x0}, - 192: {lang: 0x2e, script: 0x2, flags: 0x1}, - 193: {lang: 0x49, script: 0x52, flags: 0x0}, - 194: {lang: 0x30, script: 0x2, flags: 0x1}, - 195: {lang: 0x32, script: 0x2, flags: 0x1}, - 196: {lang: 0x34, script: 0x2, flags: 0x1}, - 198: {lang: 0xaf, script: 0x52, flags: 0x0}, - 199: {lang: 0x36, script: 0x2, flags: 0x1}, - 201: {lang: 0x19b, script: 0x52, flags: 0x0}, - 202: {lang: 0x38, script: 0x3, flags: 0x1}, - 203: {lang: 0x90, script: 0xd4, flags: 0x0}, - 205: {lang: 0x9d, script: 0x52, flags: 0x0}, - 206: {lang: 0x19a, script: 0x52, flags: 0x0}, - 207: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 208: {lang: 0xa, script: 0x52, flags: 0x0}, - 209: {lang: 0xaf, script: 0x52, flags: 0x0}, - 210: {lang: 0xdc, script: 0x52, flags: 0x0}, - 212: {lang: 0xdc, script: 0x5, flags: 0x2}, - 214: {lang: 0x9d, script: 0x52, flags: 0x0}, - 215: {lang: 0x1bd, script: 0x52, flags: 0x0}, - 216: {lang: 0x1af, script: 0x52, flags: 0x0}, - 217: {lang: 0x1b4, script: 0x20, flags: 0x0}, - 223: {lang: 0x15, script: 0x5, flags: 0x0}, - 224: {lang: 0x9d, script: 0x52, flags: 0x0}, - 226: {lang: 0x9d, script: 0x52, flags: 0x0}, - 227: {lang: 0xaf, script: 0x52, flags: 0x0}, - 228: {lang: 0x26e, script: 0x52, flags: 0x0}, - 229: {lang: 0xaa, script: 0x52, flags: 0x0}, - 230: {lang: 0x3b, script: 0x3, flags: 0x1}, - 231: {lang: 0x3e, script: 0x2, flags: 0x1}, - 232: {lang: 0xaf, script: 0x52, flags: 0x0}, - 234: {lang: 0x9d, script: 0x52, flags: 0x0}, - 235: {lang: 0x15, script: 0x5, flags: 0x0}, - 236: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 238: {lang: 0x1dc, script: 0x52, flags: 0x0}, - 239: {lang: 0xca, script: 0x52, flags: 0x0}, - 241: {lang: 0x15, script: 0x5, flags: 0x0}, - 256: {lang: 0xaf, script: 0x52, flags: 0x0}, - 258: {lang: 0x40, script: 0x2, flags: 0x1}, - 259: {lang: 0x23b, script: 0x1e, flags: 0x0}, - 260: {lang: 0x42, script: 0x2, flags: 0x1}, - 261: {lang: 0x20a, script: 0x52, flags: 0x0}, - 262: {lang: 0x15, script: 0x5, flags: 0x0}, - 264: {lang: 0xaf, script: 0x52, flags: 0x0}, - 265: {lang: 0x15, script: 0x5, flags: 0x0}, - 266: {lang: 0x44, script: 0x2, flags: 0x1}, - 269: {lang: 0x22c, script: 0x52, flags: 0x0}, - 270: {lang: 0x1af, script: 0x52, flags: 0x0}, - 271: {lang: 0x46, script: 0x2, flags: 0x1}, - 273: {lang: 0x103, script: 0x52, flags: 0x0}, - 274: {lang: 0xaf, script: 0x52, flags: 0x0}, - 275: {lang: 0x238, script: 0x52, flags: 0x0}, - 276: {lang: 0x1bd, script: 0x52, flags: 0x0}, - 278: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 280: {lang: 0x9d, script: 0x52, flags: 0x0}, - 282: {lang: 0x48, script: 0x2, flags: 0x1}, - 286: {lang: 0xaf, script: 0x52, flags: 0x0}, - 287: {lang: 0xaf, script: 0x52, flags: 0x0}, - 288: {lang: 0xaf, script: 0x52, flags: 0x0}, - 289: {lang: 0x4a, script: 0x3, flags: 0x1}, - 290: {lang: 0x4d, script: 0x2, flags: 0x1}, - 291: {lang: 0x265, script: 0x52, flags: 0x0}, - 292: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 293: {lang: 0x264, script: 0x52, flags: 0x0}, - 294: {lang: 0x4f, script: 0x2, flags: 0x1}, - 295: {lang: 0x26c, script: 0x52, flags: 0x0}, - 297: {lang: 0x51, script: 0x4, flags: 0x1}, - 299: {lang: 0x27c, script: 0x52, flags: 0x0}, - 300: {lang: 0x55, script: 0x2, flags: 0x1}, - 301: {lang: 0x248, script: 0x52, flags: 0x0}, - 302: {lang: 0x57, script: 0x3, flags: 0x1}, - 303: {lang: 0x248, script: 0x52, flags: 0x0}, - 306: {lang: 0x2b9, script: 0x37, flags: 0x2}, - 307: {lang: 0x9d, script: 0x52, flags: 0x0}, - 308: {lang: 0x28d, script: 0x52, flags: 0x0}, - 309: {lang: 0x103, script: 0x52, flags: 0x0}, - 312: {lang: 0x9d, script: 0x52, flags: 0x0}, - 315: {lang: 0x292, script: 0x52, flags: 0x0}, - 316: {lang: 0x41, script: 0x52, flags: 0x0}, - 317: {lang: 0xaf, script: 0x52, flags: 0x0}, - 319: {lang: 0x22f, script: 0x52, flags: 0x0}, - 330: {lang: 0x5a, script: 0x2, flags: 0x1}, - 347: {lang: 0x15, script: 0x5, flags: 0x0}, - 348: {lang: 0x5c, script: 0x2, flags: 0x1}, - 353: {lang: 0x236, script: 0x52, flags: 0x0}, -} - -// likelyRegionList holds lists info associated with likelyRegion. -// Size: 376 bytes, 94 elements -var likelyRegionList = [94]likelyLangScript{ - 0: {lang: 0xa4, script: 0x5, flags: 0x0}, - 1: {lang: 0x264, script: 0x52, flags: 0x0}, - 2: {lang: 0x23a, script: 0x52, flags: 0x0}, - 3: {lang: 0x18c, script: 0x1e, flags: 0x0}, - 4: {lang: 0xf3, script: 0x8, flags: 0x0}, - 5: {lang: 0x145, script: 0x52, flags: 0x0}, - 6: {lang: 0x54, script: 0x52, flags: 0x0}, - 7: {lang: 0x23b, script: 0x1e, flags: 0x0}, - 8: {lang: 0x93, script: 0xd6, flags: 0x0}, - 9: {lang: 0x1b4, script: 0x20, flags: 0x0}, - 10: {lang: 0x2c4, script: 0x34, flags: 0x0}, - 11: {lang: 0x284, script: 0x5, flags: 0x0}, - 12: {lang: 0x2bd, script: 0x35, flags: 0x0}, - 13: {lang: 0x2be, script: 0x52, flags: 0x0}, - 14: {lang: 0x157, script: 0xd5, flags: 0x0}, - 15: {lang: 0x9a, script: 0x2d, flags: 0x0}, - 16: {lang: 0x26f, script: 0x52, flags: 0x0}, - 17: {lang: 0x15, script: 0x5, flags: 0x0}, - 18: {lang: 0xaf, script: 0x52, flags: 0x0}, - 19: {lang: 0x11, script: 0x27, flags: 0x0}, - 20: {lang: 0x9b, script: 0x52, flags: 0x0}, - 21: {lang: 0x141, script: 0x5, flags: 0x2}, - 22: {lang: 0x2b9, script: 0x37, flags: 0x2}, - 23: {lang: 0x111, script: 0x29, flags: 0x0}, - 24: {lang: 0x2, script: 0x1e, flags: 0x0}, - 25: {lang: 0x145, script: 0x52, flags: 0x0}, - 26: {lang: 0x9a, script: 0x2d, flags: 0x0}, - 27: {lang: 0x18c, script: 0x1e, flags: 0x0}, - 28: {lang: 0xf8, script: 0x52, flags: 0x0}, - 29: {lang: 0x19a, script: 0x5, flags: 0x0}, - 30: {lang: 0xe1, script: 0x20, flags: 0x0}, - 31: {lang: 0x28c, script: 0x5, flags: 0x0}, - 32: {lang: 0x129, script: 0x6b, flags: 0x0}, - 33: {lang: 0xa4, script: 0x5, flags: 0x0}, - 34: {lang: 0x264, script: 0x52, flags: 0x0}, - 35: {lang: 0x133, script: 0x46, flags: 0x0}, - 36: {lang: 0x6d, script: 0x5, flags: 0x0}, - 37: {lang: 0x11c, script: 0xd5, flags: 0x0}, - 38: {lang: 0x15, script: 0x5, flags: 0x0}, - 39: {lang: 0xaf, script: 0x52, flags: 0x0}, - 40: {lang: 0x165, script: 0x4f, flags: 0x0}, - 41: {lang: 0x11c, script: 0xd5, flags: 0x0}, - 42: {lang: 0x15, script: 0x5, flags: 0x0}, - 43: {lang: 0xaf, script: 0x52, flags: 0x0}, - 44: {lang: 0x203, script: 0x52, flags: 0x0}, - 45: {lang: 0x286, script: 0x1e, flags: 0x0}, - 46: {lang: 0x18c, script: 0x1e, flags: 0x0}, - 47: {lang: 0x23a, script: 0x52, flags: 0x0}, - 48: {lang: 0x1a5, script: 0x6b, flags: 0x0}, - 49: {lang: 0x114, script: 0x52, flags: 0x0}, - 50: {lang: 0x18f, script: 0x1e, flags: 0x0}, - 51: {lang: 0x12f, script: 0x5, flags: 0x0}, - 52: {lang: 0x2c4, script: 0x35, flags: 0x0}, - 53: {lang: 0x1ef, script: 0x52, flags: 0x0}, - 54: {lang: 0x15, script: 0x5, flags: 0x0}, - 55: {lang: 0xaf, script: 0x52, flags: 0x0}, - 56: {lang: 0x182, script: 0x52, flags: 0x0}, - 57: {lang: 0x28c, script: 0x5, flags: 0x0}, - 58: {lang: 0x40, script: 0x20, flags: 0x0}, - 59: {lang: 0x28c, script: 0x5, flags: 0x0}, - 60: {lang: 0x28c, script: 0x5, flags: 0x0}, - 61: {lang: 0x58, script: 0x20, flags: 0x0}, - 62: {lang: 0x1e7, script: 0x52, flags: 0x0}, - 63: {lang: 0x2f, script: 0x1e, flags: 0x0}, - 64: {lang: 0x203, script: 0x52, flags: 0x0}, - 65: {lang: 0x38, script: 0x1e, flags: 0x0}, - 66: {lang: 0x207, script: 0x1e, flags: 0x0}, - 67: {lang: 0x13f, script: 0x52, flags: 0x0}, - 68: {lang: 0x247, script: 0x52, flags: 0x0}, - 69: {lang: 0x2b9, script: 0x37, flags: 0x0}, - 70: {lang: 0x22a, script: 0x52, flags: 0x0}, - 71: {lang: 0x286, script: 0x1e, flags: 0x0}, - 72: {lang: 0x15, script: 0x5, flags: 0x0}, - 73: {lang: 0xaf, script: 0x52, flags: 0x0}, - 74: {lang: 0x25d, script: 0xd5, flags: 0x0}, - 75: {lang: 0x181, script: 0x5, flags: 0x0}, - 76: {lang: 0x191, script: 0x6b, flags: 0x0}, - 77: {lang: 0x25c, script: 0x1e, flags: 0x0}, - 78: {lang: 0xa4, script: 0x5, flags: 0x0}, - 79: {lang: 0x15, script: 0x5, flags: 0x0}, - 80: {lang: 0xaf, script: 0x52, flags: 0x0}, - 81: {lang: 0x26f, script: 0x52, flags: 0x0}, - 82: {lang: 0x24, script: 0x5, flags: 0x0}, - 83: {lang: 0x118, script: 0x1e, flags: 0x0}, - 84: {lang: 0x3b, script: 0x2d, flags: 0x0}, - 85: {lang: 0x2c4, script: 0x35, flags: 0x0}, - 86: {lang: 0x271, script: 0x52, flags: 0x0}, - 87: {lang: 0x286, script: 0x1e, flags: 0x0}, - 88: {lang: 0x2b9, script: 0x37, flags: 0x0}, - 89: {lang: 0x1e7, script: 0x52, flags: 0x0}, - 90: {lang: 0x23a, script: 0x52, flags: 0x0}, - 91: {lang: 0x23b, script: 0x1e, flags: 0x0}, - 92: {lang: 0xaf, script: 0x52, flags: 0x0}, - 93: {lang: 0x249, script: 0x5, flags: 0x0}, -} - -type likelyTag struct { - lang uint16 - region uint16 - script uint8 -} - -// Size: 192 bytes, 32 elements -var likelyRegionGroup = [32]likelyTag{ - 1: {lang: 0x9b, region: 0xd4, script: 0x52}, - 2: {lang: 0x9b, region: 0x132, script: 0x52}, - 3: {lang: 0x1ef, region: 0x40, script: 0x52}, - 4: {lang: 0x9b, region: 0x2e, script: 0x52}, - 5: {lang: 0x9b, region: 0xd4, script: 0x52}, - 6: {lang: 0x9d, region: 0xcd, script: 0x52}, - 7: {lang: 0x248, region: 0x12d, script: 0x52}, - 8: {lang: 0x15, region: 0x6a, script: 0x5}, - 9: {lang: 0x248, region: 0x4a, script: 0x52}, - 10: {lang: 0x9b, region: 0x15e, script: 0x52}, - 11: {lang: 0x9b, region: 0x132, script: 0x52}, - 12: {lang: 0x9b, region: 0x132, script: 0x52}, - 13: {lang: 0x9d, region: 0x58, script: 0x52}, - 14: {lang: 0x2c4, region: 0x52, script: 0x34}, - 15: {lang: 0xe1, region: 0x97, script: 0x20}, - 16: {lang: 0xf8, region: 0x93, script: 0x52}, - 17: {lang: 0x103, region: 0x9c, script: 0x52}, - 18: {lang: 0x9b, region: 0x2e, script: 0x52}, - 19: {lang: 0x9b, region: 0xe4, script: 0x52}, - 20: {lang: 0x9b, region: 0x88, script: 0x52}, - 21: {lang: 0x22f, region: 0x13f, script: 0x52}, - 22: {lang: 0x2c4, region: 0x52, script: 0x34}, - 23: {lang: 0x28d, region: 0x134, script: 0x52}, - 24: {lang: 0x15, region: 0x106, script: 0x5}, - 25: {lang: 0x207, region: 0x104, script: 0x1e}, - 26: {lang: 0x207, region: 0x104, script: 0x1e}, - 27: {lang: 0x9b, region: 0x79, script: 0x52}, - 28: {lang: 0x85, region: 0x5f, script: 0x52}, - 29: {lang: 0x9d, region: 0x1e, script: 0x52}, - 30: {lang: 0x9b, region: 0x98, script: 0x52}, - 31: {lang: 0x9b, region: 0x79, script: 0x52}, -} - -type mutualIntelligibility struct { - want uint16 - have uint16 - conf uint8 - oneway bool -} - -type scriptIntelligibility struct { - lang uint16 - want uint8 - have uint8 - conf uint8 -} - -// matchLang holds pairs of langIDs of base languages that are typically -// mutually intelligible. Each pair is associated with a confidence and -// whether the intelligibility goes one or both ways. -// Size: 708 bytes, 118 elements -var matchLang = [118]mutualIntelligibility{ - 0: {want: 0x1c1, have: 0x1af, conf: 0x2, oneway: false}, - 1: {want: 0x145, have: 0x6f, conf: 0x2, oneway: false}, - 2: {want: 0xee, have: 0x54, conf: 0x2, oneway: false}, - 3: {want: 0x225, have: 0x54, conf: 0x2, oneway: false}, - 4: {want: 0x23b, have: 0x54, conf: 0x2, oneway: false}, - 5: {want: 0x225, have: 0xee, conf: 0x2, oneway: false}, - 6: {want: 0x23b, have: 0xee, conf: 0x2, oneway: false}, - 7: {want: 0x225, have: 0x23b, conf: 0x2, oneway: false}, - 8: {want: 0x241, have: 0x1, conf: 0x2, oneway: false}, - 9: {want: 0xd2, have: 0x85, conf: 0x2, oneway: true}, - 10: {want: 0x154, have: 0x85, conf: 0x2, oneway: true}, - 11: {want: 0x80, have: 0x1c1, conf: 0x2, oneway: false}, - 12: {want: 0x80, have: 0x1af, conf: 0x2, oneway: false}, - 13: {want: 0x6f, have: 0x145, conf: 0x2, oneway: false}, - 14: {want: 0x2, have: 0x207, conf: 0x2, oneway: true}, - 15: {want: 0x5, have: 0x9b, conf: 0x2, oneway: true}, - 16: {want: 0xa, have: 0x1bd, conf: 0x2, oneway: true}, - 17: {want: 0xd, have: 0x9b, conf: 0x2, oneway: true}, - 18: {want: 0x23, have: 0x9d, conf: 0x2, oneway: true}, - 19: {want: 0x24, have: 0x207, conf: 0x2, oneway: true}, - 20: {want: 0x2f, have: 0x207, conf: 0x2, oneway: true}, - 21: {want: 0x31, have: 0x9b, conf: 0x2, oneway: true}, - 22: {want: 0x3c, have: 0xe1, conf: 0x2, oneway: true}, - 23: {want: 0x4b, have: 0x9b, conf: 0x2, oneway: true}, - 24: {want: 0x50, have: 0xaf, conf: 0x2, oneway: true}, - 25: {want: 0x65, have: 0xaa, conf: 0x2, oneway: true}, - 26: {want: 0x6c, have: 0x9b, conf: 0x2, oneway: true}, - 27: {want: 0x6f, have: 0x15, conf: 0x2, oneway: true}, - 28: {want: 0x70, have: 0xaf, conf: 0x2, oneway: true}, - 29: {want: 0x78, have: 0xaf, conf: 0x2, oneway: true}, - 30: {want: 0x7f, have: 0x9b, conf: 0x2, oneway: true}, - 31: {want: 0x95, have: 0x9b, conf: 0x2, oneway: true}, - 32: {want: 0x9c, have: 0x9b, conf: 0x2, oneway: true}, - 33: {want: 0x9f, have: 0xa8, conf: 0x2, oneway: true}, - 34: {want: 0xa1, have: 0x9d, conf: 0x2, oneway: true}, - 35: {want: 0xad, have: 0x80, conf: 0x2, oneway: true}, - 36: {want: 0xb9, have: 0x1bd, conf: 0x2, oneway: true}, - 37: {want: 0xba, have: 0x9b, conf: 0x2, oneway: true}, - 38: {want: 0xbb, have: 0x9b, conf: 0x2, oneway: true}, - 39: {want: 0xc2, have: 0x9b, conf: 0x2, oneway: true}, - 40: {want: 0xc8, have: 0x9d, conf: 0x2, oneway: true}, - 41: {want: 0xca, have: 0x9d, conf: 0x2, oneway: true}, - 42: {want: 0xd3, have: 0xe1, conf: 0x2, oneway: true}, - 43: {want: 0xdc, have: 0x9b, conf: 0x2, oneway: true}, - 44: {want: 0xde, have: 0x9b, conf: 0x2, oneway: true}, - 45: {want: 0xf1, have: 0xaf, conf: 0x2, oneway: true}, - 46: {want: 0xf3, have: 0x207, conf: 0x2, oneway: true}, - 47: {want: 0xf5, have: 0x9b, conf: 0x2, oneway: true}, - 48: {want: 0xfa, have: 0x9b, conf: 0x2, oneway: true}, - 49: {want: 0x102, have: 0x9b, conf: 0x2, oneway: true}, - 50: {want: 0x10f, have: 0xf8, conf: 0x2, oneway: true}, - 51: {want: 0x111, have: 0x9b, conf: 0x2, oneway: true}, - 52: {want: 0x122, have: 0xaf, conf: 0x2, oneway: true}, - 53: {want: 0x12f, have: 0x207, conf: 0x2, oneway: true}, - 54: {want: 0x133, have: 0x9b, conf: 0x2, oneway: true}, - 55: {want: 0x135, have: 0x9b, conf: 0x2, oneway: true}, - 56: {want: 0x13d, have: 0x9b, conf: 0x2, oneway: true}, - 57: {want: 0x145, have: 0x26f, conf: 0x2, oneway: true}, - 58: {want: 0x14d, have: 0x207, conf: 0x2, oneway: true}, - 59: {want: 0x14e, have: 0x103, conf: 0x2, oneway: true}, - 60: {want: 0x15a, have: 0x9b, conf: 0x2, oneway: true}, - 61: {want: 0x164, have: 0xaf, conf: 0x2, oneway: true}, - 62: {want: 0x165, have: 0x9b, conf: 0x2, oneway: true}, - 63: {want: 0x167, have: 0x9b, conf: 0x2, oneway: true}, - 64: {want: 0x16c, have: 0xaf, conf: 0x2, oneway: true}, - 65: {want: 0x182, have: 0x9b, conf: 0x2, oneway: true}, - 66: {want: 0x183, have: 0xaf, conf: 0x2, oneway: true}, - 67: {want: 0x189, have: 0x9b, conf: 0x2, oneway: true}, - 68: {want: 0x18c, have: 0x38, conf: 0x2, oneway: true}, - 69: {want: 0x18d, have: 0x9b, conf: 0x2, oneway: true}, - 70: {want: 0x18f, have: 0x207, conf: 0x2, oneway: true}, - 71: {want: 0x196, have: 0xe1, conf: 0x2, oneway: true}, - 72: {want: 0x19a, have: 0xf8, conf: 0x2, oneway: true}, - 73: {want: 0x19b, have: 0x9b, conf: 0x2, oneway: true}, - 74: {want: 0x1a5, have: 0x9b, conf: 0x2, oneway: true}, - 75: {want: 0x1b4, have: 0x9b, conf: 0x2, oneway: true}, - 76: {want: 0x1bf, have: 0x1af, conf: 0x2, oneway: false}, - 77: {want: 0x1bf, have: 0x1c1, conf: 0x2, oneway: true}, - 78: {want: 0x1c8, have: 0x9b, conf: 0x2, oneway: true}, - 79: {want: 0x1cc, have: 0x9b, conf: 0x2, oneway: true}, - 80: {want: 0x1ce, have: 0x9b, conf: 0x2, oneway: true}, - 81: {want: 0x1d0, have: 0xaf, conf: 0x2, oneway: true}, - 82: {want: 0x1d2, have: 0x9b, conf: 0x2, oneway: true}, - 83: {want: 0x1d3, have: 0x9b, conf: 0x2, oneway: true}, - 84: {want: 0x1d7, have: 0x9b, conf: 0x2, oneway: true}, - 85: {want: 0x1de, have: 0x9b, conf: 0x2, oneway: true}, - 86: {want: 0x1ee, have: 0x9b, conf: 0x2, oneway: true}, - 87: {want: 0x1f1, have: 0x9d, conf: 0x2, oneway: true}, - 88: {want: 0x1fc, have: 0x85, conf: 0x2, oneway: true}, - 89: {want: 0x201, have: 0x9b, conf: 0x2, oneway: true}, - 90: {want: 0x20a, have: 0xaf, conf: 0x2, oneway: true}, - 91: {want: 0x20d, have: 0xe1, conf: 0x2, oneway: true}, - 92: {want: 0x21a, have: 0x9b, conf: 0x2, oneway: true}, - 93: {want: 0x228, have: 0x9b, conf: 0x2, oneway: true}, - 94: {want: 0x236, have: 0x9b, conf: 0x2, oneway: true}, - 95: {want: 0x238, have: 0x9b, conf: 0x2, oneway: true}, - 96: {want: 0x23a, have: 0x9b, conf: 0x2, oneway: true}, - 97: {want: 0x242, have: 0x9b, conf: 0x2, oneway: true}, - 98: {want: 0x244, have: 0xf8, conf: 0x2, oneway: true}, - 99: {want: 0x248, have: 0x9b, conf: 0x2, oneway: true}, - 100: {want: 0x251, have: 0x9b, conf: 0x2, oneway: true}, - 101: {want: 0x258, have: 0x9b, conf: 0x2, oneway: true}, - 102: {want: 0x25c, have: 0x207, conf: 0x2, oneway: true}, - 103: {want: 0x261, have: 0x9b, conf: 0x2, oneway: true}, - 104: {want: 0x264, have: 0x207, conf: 0x2, oneway: true}, - 105: {want: 0x361a, have: 0x9b, conf: 0x2, oneway: true}, - 106: {want: 0x26b, have: 0x9b, conf: 0x2, oneway: true}, - 107: {want: 0x26c, have: 0x9b, conf: 0x2, oneway: true}, - 108: {want: 0x277, have: 0x207, conf: 0x2, oneway: true}, - 109: {want: 0x27b, have: 0x9b, conf: 0x2, oneway: true}, - 110: {want: 0x284, have: 0x2c4, conf: 0x2, oneway: true}, - 111: {want: 0x28c, have: 0x9b, conf: 0x2, oneway: true}, - 112: {want: 0x28d, have: 0x207, conf: 0x2, oneway: true}, - 113: {want: 0x2a4, have: 0xaf, conf: 0x2, oneway: true}, - 114: {want: 0x2a9, have: 0x9b, conf: 0x2, oneway: true}, - 115: {want: 0x2b9, have: 0x9b, conf: 0x2, oneway: true}, - 116: {want: 0x2ba, have: 0x9b, conf: 0x2, oneway: true}, - 117: {want: 0x2c6, have: 0x9b, conf: 0x2, oneway: true}, -} - -// matchScript holds pairs of scriptIDs where readers of one script -// can typically also read the other. Each is associated with a confidence. -// Size: 24 bytes, 4 elements -var matchScript = [4]scriptIntelligibility{ - 0: {lang: 0x23b, want: 0x52, have: 0x1e, conf: 0x2}, - 1: {lang: 0x23b, want: 0x1e, have: 0x52, conf: 0x2}, - 2: {lang: 0x0, want: 0x34, have: 0x35, conf: 0x1}, - 3: {lang: 0x0, want: 0x35, have: 0x34, conf: 0x1}, -} - -// Size: 128 bytes, 32 elements -var regionContainment = [32]uint32{ - 0xffffffff, 0x000007a2, 0x00003044, 0x00000008, - 0x403c0010, 0x00000020, 0x00000040, 0x00000080, - 0x00000100, 0x00000200, 0x00000400, 0x2000384c, - 0x00001000, 0x00002000, 0x00004000, 0x00008000, - 0x00010000, 0x00020000, 0x00040000, 0x00080000, - 0x00100000, 0x00200000, 0x01c1c000, 0x00800000, - 0x01000000, 0x1e020000, 0x04000000, 0x08000000, - 0x10000000, 0x20002048, 0x40000000, 0x80000000, -} - -// regionInclusion maps region identifiers to sets of regions in regionInclusionBits, -// where each set holds all groupings that are directly connected in a region -// containment graph. -// Size: 355 bytes, 355 elements -var regionInclusion = [355]uint8{ - // Entry 0 - 3F - 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, - 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, - 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x25, 0x22, 0x23, - 0x25, 0x26, 0x21, 0x27, 0x28, 0x29, 0x2a, 0x25, - 0x2b, 0x23, 0x22, 0x25, 0x24, 0x29, 0x2c, 0x2d, - 0x23, 0x2e, 0x2c, 0x25, 0x2f, 0x30, 0x27, 0x25, - // Entry 40 - 7F - 0x27, 0x25, 0x24, 0x30, 0x21, 0x31, 0x32, 0x33, - 0x2f, 0x21, 0x26, 0x26, 0x26, 0x34, 0x2c, 0x28, - 0x27, 0x26, 0x35, 0x27, 0x21, 0x33, 0x22, 0x20, - 0x25, 0x2c, 0x25, 0x21, 0x36, 0x2d, 0x34, 0x29, - 0x21, 0x2e, 0x37, 0x25, 0x25, 0x20, 0x38, 0x38, - 0x27, 0x37, 0x38, 0x38, 0x2e, 0x39, 0x2e, 0x1f, - 0x37, 0x3a, 0x27, 0x3b, 0x2b, 0x20, 0x29, 0x34, - 0x26, 0x37, 0x25, 0x23, 0x27, 0x2b, 0x2c, 0x22, - // Entry 80 - BF - 0x2f, 0x2c, 0x2c, 0x25, 0x26, 0x39, 0x21, 0x33, - 0x3b, 0x2c, 0x27, 0x35, 0x21, 0x33, 0x39, 0x25, - 0x2d, 0x20, 0x38, 0x30, 0x37, 0x23, 0x2b, 0x24, - 0x21, 0x23, 0x24, 0x2b, 0x39, 0x2b, 0x25, 0x23, - 0x35, 0x20, 0x2e, 0x3c, 0x30, 0x3b, 0x2e, 0x25, - 0x35, 0x35, 0x23, 0x25, 0x3c, 0x30, 0x23, 0x25, - 0x34, 0x24, 0x2c, 0x31, 0x37, 0x29, 0x37, 0x38, - 0x38, 0x34, 0x32, 0x22, 0x25, 0x2e, 0x3b, 0x20, - // Entry C0 - FF - 0x22, 0x2c, 0x30, 0x35, 0x35, 0x3b, 0x25, 0x2c, - 0x25, 0x39, 0x2e, 0x24, 0x2e, 0x33, 0x30, 0x2e, - 0x31, 0x3a, 0x2c, 0x2a, 0x2c, 0x20, 0x33, 0x29, - 0x2b, 0x24, 0x20, 0x3b, 0x23, 0x28, 0x2a, 0x23, - 0x33, 0x20, 0x27, 0x28, 0x3a, 0x30, 0x24, 0x2d, - 0x2f, 0x28, 0x25, 0x23, 0x39, 0x20, 0x3b, 0x27, - 0x20, 0x23, 0x20, 0x20, 0x1e, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - // Entry 100 - 13F - 0x2e, 0x20, 0x2d, 0x22, 0x32, 0x2e, 0x23, 0x3a, - 0x2e, 0x38, 0x37, 0x30, 0x2c, 0x39, 0x2b, 0x2d, - 0x2c, 0x22, 0x2c, 0x2e, 0x27, 0x2e, 0x26, 0x32, - 0x33, 0x25, 0x23, 0x31, 0x21, 0x25, 0x26, 0x21, - 0x2c, 0x30, 0x3c, 0x28, 0x30, 0x3c, 0x38, 0x28, - 0x30, 0x23, 0x25, 0x28, 0x35, 0x2e, 0x32, 0x2e, - 0x20, 0x21, 0x2f, 0x27, 0x3c, 0x22, 0x25, 0x20, - 0x27, 0x25, 0x25, 0x30, 0x3a, 0x28, 0x20, 0x28, - // Entry 140 - 17F - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x23, 0x23, 0x2e, 0x22, 0x31, 0x2e, - 0x26, 0x2e, 0x20, -} - -// regionInclusionBits is an array of bit vectors where every vector represents -// a set of region groupings. These sets are used to compute the distance -// between two regions for the purpose of language matching. -// Size: 288 bytes, 72 elements -var regionInclusionBits = [72]uint32{ - // Entry 0 - 1F - 0x82400813, 0x000007a3, 0x00003844, 0x20000808, - 0x403c0011, 0x00000022, 0x20000844, 0x00000082, - 0x00000102, 0x00000202, 0x00000402, 0x2000384d, - 0x00001804, 0x20002804, 0x00404000, 0x00408000, - 0x00410000, 0x02020000, 0x00040010, 0x00080010, - 0x00100010, 0x00200010, 0x01c1c001, 0x00c00000, - 0x01400000, 0x1e020001, 0x06000000, 0x0a000000, - 0x12000000, 0x20002848, 0x40000010, 0x80000001, - // Entry 20 - 3F - 0x00000001, 0x40000000, 0x00020000, 0x01000000, - 0x00008000, 0x00002000, 0x00000200, 0x00000008, - 0x00200000, 0x90000000, 0x00040000, 0x08000000, - 0x00000020, 0x84000000, 0x00000080, 0x00001000, - 0x00010000, 0x00000400, 0x04000000, 0x00000040, - 0x10000000, 0x00004000, 0x81000000, 0x88000000, - 0x00000100, 0x80020000, 0x00080000, 0x00100000, - 0x00800000, 0xffffffff, 0x82400fb3, 0xc27c0813, - // Entry 40 - 5F - 0xa240385f, 0x83c1c813, 0x9e420813, 0x92000001, - 0x86000001, 0x81400001, 0x8a000001, 0x82020001, -} - -// regionInclusionNext marks, for each entry in regionInclusionBits, the set of -// all groups that are reachable from the groups set in the respective entry. -// Size: 72 bytes, 72 elements -var regionInclusionNext = [72]uint8{ - // Entry 0 - 3F - 0x3d, 0x3e, 0x0b, 0x0b, 0x3f, 0x01, 0x0b, 0x01, - 0x01, 0x01, 0x01, 0x40, 0x0b, 0x0b, 0x16, 0x16, - 0x16, 0x19, 0x04, 0x04, 0x04, 0x04, 0x41, 0x16, - 0x16, 0x42, 0x19, 0x19, 0x19, 0x0b, 0x04, 0x00, - 0x00, 0x1e, 0x11, 0x18, 0x0f, 0x0d, 0x09, 0x03, - 0x15, 0x43, 0x12, 0x1b, 0x05, 0x44, 0x07, 0x0c, - 0x10, 0x0a, 0x1a, 0x06, 0x1c, 0x0e, 0x45, 0x46, - 0x08, 0x47, 0x13, 0x14, 0x17, 0x3d, 0x3d, 0x3d, - // Entry 40 - 7F - 0x3d, 0x3d, 0x3d, 0x42, 0x42, 0x41, 0x42, 0x42, -} - -type parentRel struct { - lang uint16 - script uint8 - maxScript uint8 - toRegion uint16 - fromRegion []uint16 -} - -// Size: 412 bytes, 5 elements -var parents = [5]parentRel{ - 0: {lang: 0x9b, script: 0x0, maxScript: 0x52, toRegion: 0x1, fromRegion: []uint16{0x1a, 0x24, 0x25, 0x2e, 0x33, 0x35, 0x3c, 0x41, 0x45, 0x47, 0x48, 0x49, 0x4f, 0x51, 0x5b, 0x5c, 0x60, 0x63, 0x6c, 0x71, 0x72, 0x73, 0x79, 0x7a, 0x7d, 0x7e, 0x7f, 0x81, 0x8a, 0x8b, 0x94, 0x95, 0x96, 0x97, 0x98, 0x9d, 0x9e, 0xa2, 0xa5, 0xa7, 0xab, 0xaf, 0xb2, 0xb3, 0xbd, 0xc4, 0xc8, 0xc9, 0xca, 0xcc, 0xce, 0xd0, 0xd3, 0xd4, 0xdb, 0xdd, 0xde, 0xe4, 0xe5, 0xe6, 0xe9, 0xee, 0x105, 0x107, 0x108, 0x109, 0x10b, 0x10c, 0x110, 0x115, 0x119, 0x11b, 0x11d, 0x123, 0x127, 0x12a, 0x12b, 0x12d, 0x12f, 0x136, 0x139, 0x13c, 0x13f, 0x15e, 0x15f, 0x161}}, - 1: {lang: 0x9b, script: 0x0, maxScript: 0x52, toRegion: 0x1a, fromRegion: []uint16{0x2d, 0x4d, 0x5f, 0x62, 0x70, 0xd7, 0x10a, 0x10d}}, - 2: {lang: 0x9d, script: 0x0, maxScript: 0x52, toRegion: 0x1e, fromRegion: []uint16{0x2b, 0x3e, 0x40, 0x50, 0x53, 0x55, 0x58, 0x64, 0x68, 0x87, 0x8d, 0xcd, 0xd6, 0xe0, 0xe2, 0xea, 0xef, 0x118, 0x132, 0x133, 0x138}}, - 3: {lang: 0x1ef, script: 0x0, maxScript: 0x52, toRegion: 0xec, fromRegion: []uint16{0x29, 0x4d, 0x59, 0x84, 0x89, 0xb5, 0xc4, 0xcf, 0x116, 0x124}}, - 4: {lang: 0x2c4, script: 0x35, maxScript: 0x35, toRegion: 0x8b, fromRegion: []uint16{0xc4}}, -} - -// Total table size 20315 bytes (19KiB); checksum: C16EF251 diff --git a/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/.travis.yml b/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/.travis.yml deleted file mode 100644 index 76f38a482b..0000000000 --- a/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: go -sudo: false - -go: -- 1.1.2 -- 1.2.2 -- 1.3.3 -- 1.4 -- 1.5.4 -- 1.6.2 -- tip - -matrix: - allow_failures: - - go: tip - -before_script: -- go get github.com/meatballhat/gfmxr/... - -script: -- go vet ./... -- go test -v ./... -- gfmxr -c $(grep -c 'package main' README.md) -s README.md diff --git a/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/LICENSE b/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/LICENSE deleted file mode 100644 index 5515ccfb71..0000000000 --- a/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (C) 2013 Jeremy Saenz -All Rights Reserved. - -MIT LICENSE - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/README.md b/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/README.md deleted file mode 100644 index c1709cef82..0000000000 --- a/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/README.md +++ /dev/null @@ -1,579 +0,0 @@ -[![Coverage](http://gocover.io/_badge/github.com/codegangsta/cli?0)](http://gocover.io/github.com/codegangsta/cli) -[![Build Status](https://travis-ci.org/codegangsta/cli.svg?branch=master)](https://travis-ci.org/codegangsta/cli) -[![GoDoc](https://godoc.org/github.com/codegangsta/cli?status.svg)](https://godoc.org/github.com/codegangsta/cli) -[![codebeat](https://codebeat.co/badges/0a8f30aa-f975-404b-b878-5fab3ae1cc5f)](https://codebeat.co/projects/github-com-codegangsta-cli) -[![Go Report Card](https://goreportcard.com/badge/codegangsta/cli)](https://goreportcard.com/report/codegangsta/cli) - -# cli - -cli is a simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable command line applications in an expressive way. - -## Overview - -Command line apps are usually so tiny that there is absolutely no reason why your code should *not* be self-documenting. Things like generating help text and parsing command flags/options should not hinder productivity when writing a command line app. - -**This is where cli comes into play.** cli makes command line programming fun, organized, and expressive! - -## Installation - -Make sure you have a working Go environment (go 1.1+ is *required*). [See the install instructions](http://golang.org/doc/install.html). - -To install cli, simply run: -``` -$ go get github.com/codegangsta/cli -``` - -Make sure your `PATH` includes to the `$GOPATH/bin` directory so your commands can be easily used: -``` -export PATH=$PATH:$GOPATH/bin -``` - -## Getting Started - -One of the philosophies behind cli is that an API should be playful and full of discovery. So a cli app can be as little as one line of code in `main()`. - -``` go -package main - -import ( - "os" - "github.com/codegangsta/cli" -) - -func main() { - cli.NewApp().Run(os.Args) -} -``` - -This app will run and show help text, but is not very useful. Let's give an action to execute and some help documentation: - - -``` go -package main - -import ( - "fmt" - "os" - - "github.com/codegangsta/cli" -) - -func main() { - app := cli.NewApp() - app.Name = "boom" - app.Usage = "make an explosive entrance" - app.Action = func(c *cli.Context) error { - fmt.Println("boom! I say!") - return nil - } - - app.Run(os.Args) -} -``` - -Running this already gives you a ton of functionality, plus support for things like subcommands and flags, which are covered below. - -## Example - -Being a programmer can be a lonely job. Thankfully by the power of automation that is not the case! Let's create a greeter app to fend off our demons of loneliness! - -Start by creating a directory named `greet`, and within it, add a file, `greet.go` with the following code in it: - - -``` go -package main - -import ( - "fmt" - "os" - - "github.com/codegangsta/cli" -) - -func main() { - app := cli.NewApp() - app.Name = "greet" - app.Usage = "fight the loneliness!" - app.Action = func(c *cli.Context) error { - fmt.Println("Hello friend!") - return nil - } - - app.Run(os.Args) -} -``` - -Install our command to the `$GOPATH/bin` directory: - -``` -$ go install -``` - -Finally run our new command: - -``` -$ greet -Hello friend! -``` - -cli also generates neat help text: - -``` -$ greet help -NAME: - greet - fight the loneliness! - -USAGE: - greet [global options] command [command options] [arguments...] - -VERSION: - 0.0.0 - -COMMANDS: - help, h Shows a list of commands or help for one command - -GLOBAL OPTIONS - --version Shows version information -``` - -### Arguments - -You can lookup arguments by calling the `Args` function on `cli.Context`. - -``` go -... -app.Action = func(c *cli.Context) error { - fmt.Println("Hello", c.Args()[0]) - return nil -} -... -``` - -### Flags - -Setting and querying flags is simple. - -``` go -... -app.Flags = []cli.Flag { - cli.StringFlag{ - Name: "lang", - Value: "english", - Usage: "language for the greeting", - }, -} -app.Action = func(c *cli.Context) error { - name := "someone" - if c.NArg() > 0 { - name = c.Args()[0] - } - if c.String("lang") == "spanish" { - fmt.Println("Hola", name) - } else { - fmt.Println("Hello", name) - } - return nil -} -... -``` - -You can also set a destination variable for a flag, to which the content will be scanned. - -``` go -... -var language string -app.Flags = []cli.Flag { - cli.StringFlag{ - Name: "lang", - Value: "english", - Usage: "language for the greeting", - Destination: &language, - }, -} -app.Action = func(c *cli.Context) error { - name := "someone" - if c.NArg() > 0 { - name = c.Args()[0] - } - if language == "spanish" { - fmt.Println("Hola", name) - } else { - fmt.Println("Hello", name) - } - return nil -} -... -``` - -See full list of flags at http://godoc.org/github.com/codegangsta/cli - -#### Placeholder Values - -Sometimes it's useful to specify a flag's value within the usage string itself. Such placeholders are -indicated with back quotes. - -For example this: - -```go -cli.StringFlag{ - Name: "config, c", - Usage: "Load configuration from `FILE`", -} -``` - -Will result in help output like: - -``` ---config FILE, -c FILE Load configuration from FILE -``` - -Note that only the first placeholder is used. Subsequent back-quoted words will be left as-is. - -#### Alternate Names - -You can set alternate (or short) names for flags by providing a comma-delimited list for the `Name`. e.g. - -``` go -app.Flags = []cli.Flag { - cli.StringFlag{ - Name: "lang, l", - Value: "english", - Usage: "language for the greeting", - }, -} -``` - -That flag can then be set with `--lang spanish` or `-l spanish`. Note that giving two different forms of the same flag in the same command invocation is an error. - -#### Values from the Environment - -You can also have the default value set from the environment via `EnvVar`. e.g. - -``` go -app.Flags = []cli.Flag { - cli.StringFlag{ - Name: "lang, l", - Value: "english", - Usage: "language for the greeting", - EnvVar: "APP_LANG", - }, -} -``` - -The `EnvVar` may also be given as a comma-delimited "cascade", where the first environment variable that resolves is used as the default. - -``` go -app.Flags = []cli.Flag { - cli.StringFlag{ - Name: "lang, l", - Value: "english", - Usage: "language for the greeting", - EnvVar: "LEGACY_COMPAT_LANG,APP_LANG,LANG", - }, -} -``` - -#### Values from alternate input sources (YAML and others) - -There is a separate package altsrc that adds support for getting flag values from other input sources like YAML. - -In order to get values for a flag from an alternate input source the following code would be added to wrap an existing cli.Flag like below: - -``` go - altsrc.NewIntFlag(cli.IntFlag{Name: "test"}) -``` - -Initialization must also occur for these flags. Below is an example initializing getting data from a yaml file below. - -``` go - command.Before = altsrc.InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load")) -``` - -The code above will use the "load" string as a flag name to get the file name of a yaml file from the cli.Context. -It will then use that file name to initialize the yaml input source for any flags that are defined on that command. -As a note the "load" flag used would also have to be defined on the command flags in order for this code snipped to work. - -Currently only YAML files are supported but developers can add support for other input sources by implementing the -altsrc.InputSourceContext for their given sources. - -Here is a more complete sample of a command using YAML support: - -``` go - command := &cli.Command{ - Name: "test-cmd", - Aliases: []string{"tc"}, - Usage: "this is for testing", - Description: "testing", - Action: func(c *cli.Context) error { - // Action to run - return nil - }, - Flags: []cli.Flag{ - NewIntFlag(cli.IntFlag{Name: "test"}), - cli.StringFlag{Name: "load"}}, - } - command.Before = InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load")) - err := command.Run(c) -``` - -### Subcommands - -Subcommands can be defined for a more git-like command line app. - -```go -... -app.Commands = []cli.Command{ - { - Name: "add", - Aliases: []string{"a"}, - Usage: "add a task to the list", - Action: func(c *cli.Context) error { - fmt.Println("added task: ", c.Args().First()) - return nil - }, - }, - { - Name: "complete", - Aliases: []string{"c"}, - Usage: "complete a task on the list", - Action: func(c *cli.Context) error { - fmt.Println("completed task: ", c.Args().First()) - return nil - }, - }, - { - Name: "template", - Aliases: []string{"r"}, - Usage: "options for task templates", - Subcommands: []cli.Command{ - { - Name: "add", - Usage: "add a new template", - Action: func(c *cli.Context) error { - fmt.Println("new task template: ", c.Args().First()) - return nil - }, - }, - { - Name: "remove", - Usage: "remove an existing template", - Action: func(c *cli.Context) error { - fmt.Println("removed task template: ", c.Args().First()) - return nil - }, - }, - }, - }, -} -... -``` - -### Subcommands categories - -For additional organization in apps that have many subcommands, you can -associate a category for each command to group them together in the help -output. - -E.g. - -```go -... - app.Commands = []cli.Command{ - { - Name: "noop", - }, - { - Name: "add", - Category: "template", - }, - { - Name: "remove", - Category: "template", - }, - } -... -``` - -Will include: - -``` -... -COMMANDS: - noop - - Template actions: - add - remove -... -``` - -### Exit code - -Calling `App.Run` will not automatically call `os.Exit`, which means that by -default the exit code will "fall through" to being `0`. An explicit exit code -may be set by returning a non-nil error that fulfills `cli.ExitCoder`, *or* a -`cli.MultiError` that includes an error that fulfills `cli.ExitCoder`, e.g.: - -``` go -package main - -import ( - "os" - - "github.com/codegangsta/cli" -) - -func main() { - app := cli.NewApp() - app.Flags = []cli.Flag{ - cli.BoolTFlag{ - Name: "ginger-crouton", - Usage: "is it in the soup?", - }, - } - app.Action = func(ctx *cli.Context) error { - if !ctx.Bool("ginger-crouton") { - return cli.NewExitError("it is not in the soup", 86) - } - return nil - } - - app.Run(os.Args) -} -``` - -### Bash Completion - -You can enable completion commands by setting the `EnableBashCompletion` -flag on the `App` object. By default, this setting will only auto-complete to -show an app's subcommands, but you can write your own completion methods for -the App or its subcommands. - -```go -... -var tasks = []string{"cook", "clean", "laundry", "eat", "sleep", "code"} -app := cli.NewApp() -app.EnableBashCompletion = true -app.Commands = []cli.Command{ - { - Name: "complete", - Aliases: []string{"c"}, - Usage: "complete a task on the list", - Action: func(c *cli.Context) error { - fmt.Println("completed task: ", c.Args().First()) - return nil - }, - BashComplete: func(c *cli.Context) { - // This will complete if no args are passed - if c.NArg() > 0 { - return - } - for _, t := range tasks { - fmt.Println(t) - } - }, - } -} -... -``` - -#### To Enable - -Source the `autocomplete/bash_autocomplete` file in your `.bashrc` file while -setting the `PROG` variable to the name of your program: - -`PROG=myprogram source /.../cli/autocomplete/bash_autocomplete` - -#### To Distribute - -Copy `autocomplete/bash_autocomplete` into `/etc/bash_completion.d/` and rename -it to the name of the program you wish to add autocomplete support for (or -automatically install it there if you are distributing a package). Don't forget -to source the file to make it active in the current shell. - -``` -sudo cp src/bash_autocomplete /etc/bash_completion.d/ -source /etc/bash_completion.d/ -``` - -Alternatively, you can just document that users should source the generic -`autocomplete/bash_autocomplete` in their bash configuration with `$PROG` set -to the name of their program (as above). - -### Generated Help Text Customization - -All of the help text generation may be customized, and at multiple levels. The -templates are exposed as variables `AppHelpTemplate`, `CommandHelpTemplate`, and -`SubcommandHelpTemplate` which may be reassigned or augmented, and full override -is possible by assigning a compatible func to the `cli.HelpPrinter` variable, -e.g.: - - -``` go -package main - -import ( - "fmt" - "io" - "os" - - "github.com/codegangsta/cli" -) - -func main() { - // EXAMPLE: Append to an existing template - cli.AppHelpTemplate = fmt.Sprintf(`%s - -WEBSITE: http://awesometown.example.com - -SUPPORT: support@awesometown.example.com - -`, cli.AppHelpTemplate) - - // EXAMPLE: Override a template - cli.AppHelpTemplate = `NAME: - {{.Name}} - {{.Usage}} -USAGE: - {{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command -[command options]{{end}} {{if -.ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}} - {{if len .Authors}} -AUTHOR(S): - {{range .Authors}}{{ . }}{{end}} - {{end}}{{if .Commands}} -COMMANDS: -{{range .Commands}}{{if not .HideHelp}} {{join .Names ", "}}{{ "\t" -}}{{.Usage}}{{ "\n" }}{{end}}{{end}}{{end}}{{if .VisibleFlags}} -GLOBAL OPTIONS: - {{range .VisibleFlags}}{{.}} - {{end}}{{end}}{{if .Copyright }} -COPYRIGHT: - {{.Copyright}} - {{end}}{{if .Version}} -VERSION: - {{.Version}} - {{end}} -` - - // EXAMPLE: Replace the `HelpPrinter` func - cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) { - fmt.Println("Ha HA. I pwnd the help!!1") - } - - cli.NewApp().Run(os.Args) -} -``` - -## Contribution Guidelines - -Feel free to put up a pull request to fix a bug or maybe add a feature. I will give it a code review and make sure that it does not break backwards compatibility. If I or any other collaborators agree that it is in line with the vision of the project, we will work with you to get the code into a mergeable state and merge it into the master branch. - -If you have contributed something significant to the project, I will most likely add you as a collaborator. As a collaborator you are given the ability to merge others pull requests. It is very important that new code does not break existing code, so be careful about what code you do choose to merge. If you have any questions feel free to link @codegangsta to the issue in question and we can review it together. - -If you feel like you have contributed to the project but have not yet been added as a collaborator, I probably forgot to add you. Hit @codegangsta up over email and we will get it figured out. diff --git a/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/appveyor.yml b/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/appveyor.yml deleted file mode 100644 index 3ca7afabd3..0000000000 --- a/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/appveyor.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "{build}" - -os: Windows Server 2012 R2 - -install: - - go version - - go env - -build_script: - - cd %APPVEYOR_BUILD_FOLDER% - - go vet ./... - - go test -v ./... - -test: off - -deploy: off diff --git a/Godeps/_workspace/src/golang.org/x/crypto/LICENSE b/build/_vendor/src/golang.org/x/net/LICENSE similarity index 100% rename from Godeps/_workspace/src/golang.org/x/crypto/LICENSE rename to build/_vendor/src/golang.org/x/net/LICENSE diff --git a/Godeps/_workspace/src/golang.org/x/net/context/context.go b/build/_vendor/src/golang.org/x/net/context/context.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/net/context/context.go rename to build/_vendor/src/golang.org/x/net/context/context.go index ea1a7cd53a..134654cf7e 100644 --- a/Godeps/_workspace/src/golang.org/x/net/context/context.go +++ b/build/_vendor/src/golang.org/x/net/context/context.go @@ -34,7 +34,7 @@ // // See http://blog.golang.org/context for example code for a server that uses // Contexts. -package context +package context // import "golang.org/x/net/context" import "time" diff --git a/Godeps/_workspace/src/golang.org/x/net/context/go17.go b/build/_vendor/src/golang.org/x/net/context/go17.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/context/go17.go rename to build/_vendor/src/golang.org/x/net/context/go17.go diff --git a/Godeps/_workspace/src/golang.org/x/net/context/pre_go17.go b/build/_vendor/src/golang.org/x/net/context/pre_go17.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/context/pre_go17.go rename to build/_vendor/src/golang.org/x/net/context/pre_go17.go diff --git a/build/ci-notes.md b/build/ci-notes.md index 39375ff4c3..3fc2690b2c 100644 --- a/build/ci-notes.md +++ b/build/ci-notes.md @@ -1,3 +1,18 @@ +# Vendored Dependencies + +Dependencies are almost all vendored in at the standard Go `/vendor` path. This allows +people to build go-ethereum using the standard toolchain without any particular package +manager. It also plays nicely with `go get`, not requiring external code to be relied on. + +The one single dependent package missing from `vendor` is `golang.org/x/net/context`. As +this is a package exposed via public library APIs, it must not be vendored as dependent +code woulnd't be able to instantiate. + +To allow reproducible builds of go-ethereum nonetheless that don't need network access +during build time to fetch `golang.org/x/net/context`, a version was copied into our repo +at the very specific `/build/_vendor` path, which is added automatically by all CI build +scripts and the makefile too. + # Debian Packaging Tagged releases and develop branch commits are available as installable Debian packages diff --git a/build/ci.go b/build/ci.go index cf43969f6c..3dca47fadf 100644 --- a/build/ci.go +++ b/build/ci.go @@ -141,7 +141,6 @@ func doInstall(cmdline []string) { log.Println("be compiled with an earlier version. Please upgrade your Go installation.") os.Exit(1) } - // Compile packages given as arguments, or everything if there are no arguments. packages := []string{"./..."} if flag.NArg() > 0 { @@ -178,6 +177,7 @@ func goTool(subcmd string, args ...string) *exec.Cmd { cmd := exec.Command(gocmd, subcmd) cmd.Args = append(cmd.Args, args...) cmd.Env = []string{ + "GO15VENDOREXPERIMENT=1", "GOPATH=" + build.GOPATH(), "GOBIN=" + GOBIN, } @@ -200,11 +200,24 @@ func doTest(cmdline []string) { coverage = flag.Bool("coverage", false, "Whether to record code coverage") ) flag.CommandLine.Parse(cmdline) + packages := []string{"./..."} if len(flag.CommandLine.Args()) > 0 { packages = flag.CommandLine.Args() } - + if len(packages) == 1 && packages[0] == "./..." { + // Resolve ./... manually since go vet will fail on vendored stuff + out, err := goTool("list", "./...").CombinedOutput() + if err != nil { + log.Fatalf("package listing failed: %v\n%s", err, string(out)) + } + packages = []string{} + for _, line := range strings.Split(string(out), "\n") { + if !strings.Contains(line, "vendor") { + packages = append(packages, strings.TrimSpace(line)) + } + } + } // Run analysis tools before the tests. if *vet { build.MustRun(goTool("vet", packages...)) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index ccc42d3cf1..5517052084 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -82,22 +82,6 @@ The makedag command generates an ethash DAG in /tmp/dag. This command exists to support the system testing project. Regular users do not need to execute it. -`, - }, - { - Action: gpuinfo, - Name: "gpuinfo", - Usage: "gpuinfo", - Description: ` -Prints OpenCL device info for all found GPUs. -`, - }, - { - Action: gpubench, - Name: "gpubench", - Usage: "benchmark GPU", - Description: ` -Runs quick benchmark on first GPU found. `, }, { @@ -147,7 +131,6 @@ participating. utils.OpposeDAOFork, utils.MinerThreadsFlag, utils.MiningEnabledFlag, - utils.MiningGPUFlag, utils.AutoDAGFlag, utils.TargetGasLimitFlag, utils.NATFlag, @@ -312,7 +295,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { if err := stack.Service(ðereum); err != nil { utils.Fatalf("ethereum service not running: %v", err) } - if err := ethereum.StartMining(ctx.GlobalInt(utils.MinerThreadsFlag.Name), ctx.GlobalString(utils.MiningGPUFlag.Name)); err != nil { + if err := ethereum.StartMining(ctx.GlobalInt(utils.MinerThreadsFlag.Name)); err != nil { utils.Fatalf("Failed to start mining: %v", err) } } @@ -348,31 +331,6 @@ func makedag(ctx *cli.Context) error { return nil } -func gpuinfo(ctx *cli.Context) error { - eth.PrintOpenCLDevices() - return nil -} - -func gpubench(ctx *cli.Context) error { - args := ctx.Args() - wrongArgs := func() { - utils.Fatalf(`Usage: geth gpubench `) - } - switch { - case len(args) == 1: - n, err := strconv.ParseUint(args[0], 0, 64) - if err != nil { - wrongArgs() - } - eth.GPUBench(n) - case len(args) == 0: - eth.GPUBench(0) - default: - wrongArgs() - } - return nil -} - func version(c *cli.Context) error { fmt.Println(strings.Title(clientIdentifier)) fmt.Println("Version:", utils.Version) diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 2cb6e77e86..4c4e27630b 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -128,7 +128,6 @@ var AppHelpFlagGroups = []flagGroup{ Flags: []cli.Flag{ utils.MiningEnabledFlag, utils.MinerThreadsFlag, - utils.MiningGPUFlag, utils.AutoDAGFlag, utils.EtherbaseFlag, utils.TargetGasLimitFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 1859f735d6..5e2dcf8c90 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -170,7 +170,6 @@ var ( Usage: "Updates the chain rules to oppose the DAO hard-fork", } // Miner settings - // TODO: refactor CPU vs GPU mining flags MiningEnabledFlag = cli.BoolFlag{ Name: "mine", Usage: "Enable mining", @@ -180,10 +179,6 @@ var ( Usage: "Number of CPU threads to use for mining", Value: runtime.NumCPU(), } - MiningGPUFlag = cli.StringFlag{ - Name: "minergpus", - Usage: "List of GPUs to use for mining (e.g. '0,1' will use the first two GPUs found)", - } TargetGasLimitFlag = cli.StringFlag{ Name: "targetgaslimit", Usage: "Target gas limit sets the artificial target gas floor for the blocks to mine", diff --git a/common/natspec/natspec.go b/common/natspec/natspec.go deleted file mode 100644 index 4521ff7a1b..0000000000 --- a/common/natspec/natspec.go +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build ignore - -package natspec - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/httpclient" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/xeth" - "github.com/robertkrimen/otto" -) - -type abi2method map[[8]byte]*method - -type NatSpec struct { - jsvm *otto.Otto - abiDocJson []byte - userDoc userDoc - tx, data string -} - -// main entry point for to get natspec notice for a transaction -// the implementation is frontend friendly in that it always gives back -// a notice that is safe to display -// :FIXME: the second return value is an error, which can be used to fine-tune bahaviour -func GetNotice(xeth *xeth.XEth, tx string, http *httpclient.HTTPClient) (notice string) { - ns, err := New(xeth, tx, http) - if err != nil { - if ns == nil { - return getFallbackNotice(fmt.Sprintf("no NatSpec info found for contract: %v", err), tx) - } else { - return getFallbackNotice(fmt.Sprintf("invalid NatSpec info: %v", err), tx) - } - } - - notice, err = ns.Notice() - if err != nil { - return getFallbackNotice(fmt.Sprintf("NatSpec notice error: %v", err), tx) - } - - return -} - -func getFallbackNotice(comment, tx string) string { - return fmt.Sprintf("About to submit transaction (%s): %s", comment, tx) -} - -type transaction struct { - To string `json:"to"` - Data string `json:"data"` -} - -type jsonTx struct { - Params []transaction `json:"params"` -} - -type contractInfo struct { - Source string `json:"source"` - Language string `json:"language"` - Version string `json:"compilerVersion"` - AbiDefinition json.RawMessage `json:"abiDefinition"` - UserDoc userDoc `json:"userDoc"` - DeveloperDoc json.RawMessage `json:"developerDoc"` -} - -func New(xeth *xeth.XEth, jsontx string, http *httpclient.HTTPClient) (self *NatSpec, err error) { - - // extract contract address from tx - var tx jsonTx - err = json.Unmarshal([]byte(jsontx), &tx) - if err != nil { - return - } - t := tx.Params[0] - contractAddress := t.To - - content, err := FetchDocsForContract(contractAddress, xeth, http) - if err != nil { - return - } - - self, err = NewWithDocs(content, jsontx, t.Data) - return -} - -// also called by admin.contractInfo.get -func FetchDocsForContract(contractAddress string, xeth *xeth.XEth, client *httpclient.HTTPClient) (content []byte, err error) { - // retrieve contract hash from state - codehex := xeth.CodeAt(contractAddress) - codeb := xeth.CodeAtBytes(contractAddress) - - if codehex == "0x" { - err = fmt.Errorf("contract (%v) not found", contractAddress) - return - } - codehash := common.BytesToHash(crypto.Keccak256(codeb)) - // set up nameresolver with natspecreg + urlhint contract addresses - reg := registrar.New(xeth) - - // resolve host via HashReg/UrlHint Resolver - hash, err := reg.HashToHash(codehash) - if err != nil { - return - } - if client.HasScheme("bzz") { - content, err = client.Get("bzz://"+hash.Hex()[2:], "") - if err == nil { // non-fatal - return - } - err = nil - //falling back to urlhint - } - - uri, err := reg.HashToUrl(hash) - if err != nil { - return - } - - // get content via http client and authenticate content using hash - content, err = client.GetAuthContent(uri, hash) - if err != nil { - return - } - return -} - -func NewWithDocs(infoDoc []byte, tx string, data string) (self *NatSpec, err error) { - - var contract contractInfo - err = json.Unmarshal(infoDoc, &contract) - if err != nil { - return - } - - self = &NatSpec{ - jsvm: otto.New(), - abiDocJson: []byte(contract.AbiDefinition), - userDoc: contract.UserDoc, - tx: tx, - data: data, - } - - // load and require natspec js (but it is meant to be protected environment) - _, err = self.jsvm.Run(natspecJS) - if err != nil { - return - } - _, err = self.jsvm.Run("var natspec = require('natspec');") - return -} - -// type abiDoc []method - -// type method struct { -// Name string `json:name` -// Inputs []input `json:inputs` -// abiKey [8]byte -// } - -// type input struct { -// Name string `json:name` -// Type string `json:type` -// } - -// json skeleton for abi doc (contract method definitions) -type method struct { - Notice string `json:notice` - name string -} - -type userDoc struct { - Methods map[string]*method `json:methods` -} - -func (self *NatSpec) makeAbi2method(abiKey [8]byte) (meth *method) { - for signature, m := range self.userDoc.Methods { - name := strings.Split(signature, "(")[0] - hash := []byte(common.Bytes2Hex(crypto.Keccak256([]byte(signature)))) - var key [8]byte - copy(key[:], hash[:8]) - if bytes.Equal(key[:], abiKey[:]) { - meth = m - meth.name = name - return - } - } - return -} - -func (self *NatSpec) Notice() (notice string, err error) { - var abiKey [8]byte - if len(self.data) < 10 { - err = fmt.Errorf("Invalid transaction data") - return - } - copy(abiKey[:], self.data[2:10]) - meth := self.makeAbi2method(abiKey) - - if meth == nil { - err = fmt.Errorf("abi key does not match any method") - return - } - notice, err = self.noticeForMethod(self.tx, meth.name, meth.Notice) - return -} - -func (self *NatSpec) noticeForMethod(tx string, name, expression string) (notice string, err error) { - - if _, err = self.jsvm.Run("var transaction = " + tx + ";"); err != nil { - return "", fmt.Errorf("natspec.js error setting transaction: %v", err) - } - - if _, err = self.jsvm.Run("var abi = " + string(self.abiDocJson) + ";"); err != nil { - return "", fmt.Errorf("natspec.js error setting abi: %v", err) - } - - if _, err = self.jsvm.Run("var method = '" + name + "';"); err != nil { - return "", fmt.Errorf("natspec.js error setting method: %v", err) - } - - if _, err = self.jsvm.Run("var expression = \"" + expression + "\";"); err != nil { - return "", fmt.Errorf("natspec.js error setting expression: %v", err) - } - - self.jsvm.Run("var call = {method: method,abi: abi,transaction: transaction};") - value, err := self.jsvm.Run("natspec.evaluateExpression(expression, call);") - if err != nil { - return "", fmt.Errorf("natspec.js error evaluating expression: %v", err) - } - evalError := "Natspec evaluation failed, wrong input params" - if value.String() == evalError { - return "", fmt.Errorf("natspec.js error evaluating expression: wrong input params in expression '%s'", expression) - } - if len(value.String()) == 0 { - return "", fmt.Errorf("natspec.js error evaluating expression") - } - - return value.String(), nil - -} diff --git a/common/natspec/natspec_e2e_test.go b/common/natspec/natspec_e2e_test.go deleted file mode 100644 index 2552605769..0000000000 --- a/common/natspec/natspec_e2e_test.go +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build ignore - -package natspec - -import ( - "fmt" - "io/ioutil" - "math/big" - "os" - "path/filepath" - "runtime" - "testing" - "time" - - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/httpclient" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/node" - xe "github.com/ethereum/go-ethereum/xeth" -) - -const ( - testAddress = "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" - testBalance = "10000000000000000000" - testKey = "e6fab74a43941f82d89cb7faa408e227cdad3153c4720e540e855c19b15e6674" - - testFileName = "long_file_name_for_testing_registration_of_URLs_longer_than_32_bytes.content" - - testNotice = "Register key `utils.toHex(_key)` <- content `utils.toHex(_content)`" - - testExpNotice = "Register key 0xadd1a7d961cff0242089674ec2ef6fca671ab15e1fe80e38859fc815b98d88ab <- content 0xb3a2dea218de5d8bbe6c4645aadbf67b5ab00ecb1a9ec95dbdad6a0eed3e41a7" - - testExpNotice2 = `About to submit transaction (NatSpec notice error: abi key does not match any method): {"params":[{"to":"%s","data": "0x31e12c20"}]}` - - testExpNotice3 = `About to submit transaction (no NatSpec info found for contract: HashToHash: content hash not found for '0x1392c62d05b2d149e22a339c531157ae06b44d39a674cce500064b12b9aeb019'): {"params":[{"to":"%s","data": "0x300a3bbfb3a2dea218de5d8bbe6c4645aadbf67b5ab00ecb1a9ec95dbdad6a0eed3e41a7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000066696c653a2f2f2f746573742e636f6e74656e74"}]}` -) - -const ( - testUserDoc = ` -{ - "methods": { - "register(uint256,uint256)": { - "notice": "` + testNotice + `" - } - }, - "invariants": [ - { "notice": "" } - ], - "construction": [ - { "notice": "" } - ] -} -` - testAbiDefinition = ` -[{ - "name": "register", - "constant": false, - "type": "function", - "inputs": [{ - "name": "_key", - "type": "uint256" - }, { - "name": "_content", - "type": "uint256" - }], - "outputs": [] -}] -` - - testContractInfo = ` -{ - "userDoc": ` + testUserDoc + `, - "abiDefinition": ` + testAbiDefinition + ` -} -` -) - -type testFrontend struct { - t *testing.T - ethereum *eth.Ethereum - xeth *xe.XEth - wait chan *big.Int - lastConfirm string - wantNatSpec bool -} - -func (self *testFrontend) AskPassword() (string, bool) { - return "", true -} - -func (self *testFrontend) UnlockAccount(acc []byte) bool { - self.ethereum.AccountManager().Unlock(common.BytesToAddress(acc), "password") - return true -} - -func (self *testFrontend) ConfirmTransaction(tx string) bool { - if self.wantNatSpec { - client := httpclient.New("/tmp/") - self.lastConfirm = GetNotice(self.xeth, tx, client) - } - return true -} - -func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { - - tmp, err := ioutil.TempDir("", "natspec-test") - if err != nil { - t.Fatal(err) - } - db, _ := ethdb.NewMemDatabase() - addr := common.HexToAddress(testAddress) - core.WriteGenesisBlockForTesting(db, core.GenesisAccount{addr, common.String2Big(testBalance)}) - ks := crypto.NewKeyStorePassphrase(filepath.Join(tmp, "keystore"), crypto.LightScryptN, crypto.LightScryptP) - am := accounts.NewManager(ks) - keyb, err := crypto.HexToECDSA(testKey) - if err != nil { - t.Fatal(err) - } - key := crypto.NewKeyFromECDSA(keyb) - err = ks.StoreKey(key, "") - if err != nil { - t.Fatal(err) - } - - err = am.Unlock(key.Address, "") - if err != nil { - t.Fatal(err) - } - - // only use minimalistic stack with no networking - return eth.New(&node.ServiceContext{EventMux: new(event.TypeMux)}, ð.Config{ - AccountManager: am, - Etherbase: common.HexToAddress(testAddress), - PowTest: true, - TestGenesisState: db, - GpoMinGasPrice: common.Big1, - GpobaseCorrectionFactor: 1, - GpoMaxGasPrice: common.Big1, - }) -} - -func testInit(t *testing.T) (self *testFrontend) { - // initialise and start minimal ethereum stack - ethereum, err := testEth(t) - if err != nil { - t.Errorf("error creating ethereum: %v", err) - return - } - err = ethereum.Start(nil) - if err != nil { - t.Errorf("error starting ethereum: %v", err) - return - } - - // mock frontend - self = &testFrontend{t: t, ethereum: ethereum} - self.xeth = xe.New(nil, self) - self.wait = self.xeth.UpdateState() - addr, _ := self.ethereum.Etherbase() - - // initialise the registry contracts - reg := registrar.New(self.xeth) - registrar.GlobalRegistrarAddr = "0x0" - - var txG, txH, txU string - txG, err = reg.SetGlobalRegistrar("", addr) - if err != nil { - t.Fatalf("error creating GlobalRegistrar: %v", err) - } - if !processTxs(self, t, 1) { - t.Fatalf("error mining txs") - } - recG := self.xeth.GetTxReceipt(common.HexToHash(txG)) - if recG == nil { - t.Fatalf("blockchain error creating GlobalRegistrar") - } - registrar.GlobalRegistrarAddr = recG.ContractAddress.Hex() - - txH, err = reg.SetHashReg("", addr) - if err != nil { - t.Errorf("error creating HashReg: %v", err) - } - if !processTxs(self, t, 1) { - t.Errorf("error mining txs") - } - recH := self.xeth.GetTxReceipt(common.HexToHash(txH)) - if recH == nil { - t.Fatalf("blockchain error creating HashReg") - } - registrar.HashRegAddr = recH.ContractAddress.Hex() - - txU, err = reg.SetUrlHint("", addr) - if err != nil { - t.Errorf("error creating UrlHint: %v", err) - } - if !processTxs(self, t, 1) { - t.Errorf("error mining txs") - } - recU := self.xeth.GetTxReceipt(common.HexToHash(txU)) - if recU == nil { - t.Fatalf("blockchain error creating UrlHint") - } - registrar.UrlHintAddr = recU.ContractAddress.Hex() - - return -} - -// end to end test -func TestNatspecE2E(t *testing.T) { - t.Skip() - - tf := testInit(t) - defer tf.ethereum.Stop() - addr, _ := tf.ethereum.Etherbase() - - // create a contractInfo file (mock cloud-deployed contract metadocs) - // incidentally this is the info for the HashReg contract itself - ioutil.WriteFile("/tmp/"+testFileName, []byte(testContractInfo), os.ModePerm) - dochash := crypto.Keccak256Hash([]byte(testContractInfo)) - - // take the codehash for the contract we wanna test - codeb := tf.xeth.CodeAtBytes(registrar.HashRegAddr) - codehash := crypto.Keccak256Hash(codeb) - - reg := registrar.New(tf.xeth) - _, err := reg.SetHashToHash(addr, codehash, dochash) - if err != nil { - t.Errorf("error registering: %v", err) - } - _, err = reg.SetUrlToHash(addr, dochash, "file:///"+testFileName) - if err != nil { - t.Errorf("error registering: %v", err) - } - if !processTxs(tf, t, 5) { - return - } - - // NatSpec info for register method of HashReg contract installed - // now using the same transactions to check confirm messages - - tf.wantNatSpec = true // this is set so now the backend uses natspec confirmation - _, err = reg.SetHashToHash(addr, codehash, dochash) - if err != nil { - t.Errorf("error calling contract registry: %v", err) - } - - fmt.Printf("GlobalRegistrar: %v, HashReg: %v, UrlHint: %v\n", registrar.GlobalRegistrarAddr, registrar.HashRegAddr, registrar.UrlHintAddr) - if tf.lastConfirm != testExpNotice { - t.Errorf("Wrong confirm message. expected\n'%v', got\n'%v'", testExpNotice, tf.lastConfirm) - } - - // test unknown method - exp := fmt.Sprintf(testExpNotice2, registrar.HashRegAddr) - _, err = reg.SetOwner(addr) - if err != nil { - t.Errorf("error setting owner: %v", err) - } - - if tf.lastConfirm != exp { - t.Errorf("Wrong confirm message, expected\n'%v', got\n'%v'", exp, tf.lastConfirm) - } - - // test unknown contract - exp = fmt.Sprintf(testExpNotice3, registrar.UrlHintAddr) - - _, err = reg.SetUrlToHash(addr, dochash, "file:///test.content") - if err != nil { - t.Errorf("error registering: %v", err) - } - - if tf.lastConfirm != exp { - t.Errorf("Wrong confirm message, expected '%v', got '%v'", exp, tf.lastConfirm) - } - -} - -func pendingTransactions(repl *testFrontend, t *testing.T) (txc int64, err error) { - txs := repl.ethereum.TxPool().GetTransactions() - return int64(len(txs)), nil -} - -func processTxs(repl *testFrontend, t *testing.T, expTxc int) bool { - var txc int64 - var err error - for i := 0; i < 50; i++ { - txc, err = pendingTransactions(repl, t) - if err != nil { - t.Errorf("unexpected error checking pending transactions: %v", err) - return false - } - if expTxc < int(txc) { - t.Errorf("too many pending transactions: expected %v, got %v", expTxc, txc) - return false - } else if expTxc == int(txc) { - break - } - time.Sleep(100 * time.Millisecond) - } - if int(txc) != expTxc { - t.Errorf("incorrect number of pending transactions, expected %v, got %v", expTxc, txc) - return false - } - - err = repl.ethereum.StartMining(runtime.NumCPU(), "") - if err != nil { - t.Errorf("unexpected error mining: %v", err) - return false - } - defer repl.ethereum.StopMining() - - timer := time.NewTimer(100 * time.Second) - height := new(big.Int).Add(repl.xeth.CurrentBlock().Number(), big.NewInt(1)) - repl.wait <- height - select { - case <-timer.C: - // if times out make sure the xeth loop does not block - go func() { - select { - case repl.wait <- nil: - case <-repl.wait: - } - }() - case <-repl.wait: - } - txc, err = pendingTransactions(repl, t) - if err != nil { - t.Errorf("unexpected error checking pending transactions: %v", err) - return false - } - if txc != 0 { - t.Errorf("%d trasactions were not mined", txc) - return false - } - return true -} diff --git a/common/natspec/natspec_js.go b/common/natspec/natspec_js.go deleted file mode 100644 index 0375bb4d5c..0000000000 --- a/common/natspec/natspec_js.go +++ /dev/null @@ -1,4060 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package natspec - -const natspecJS = //`require=function t(e,n,r){function i(f,u){if(!n[f]){if(!e[f]){var s="function"==typeof require&&require;if(!u&&s)return s(f,!0);if(o)return o(f,!0);var c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c}var a=n[f]={exports:{}};e[f][0].call(a.exports,function(t){var n=e[f][1][t];return i(n?n:t)},a,a.exports,t,e,n,r)}return n[f].exports}for(var o="function"==typeof require&&require,f=0;fv;v++)d.push(g(e.slice(0,s))),e=e.slice(s);n.push(d)}else r.prefixedType("string")(t[c].type)?(a=a.slice(s),n.push(g(e.slice(0,s))),e=e.slice(s)):(n.push(g(e.slice(0,s))),e=e.slice(s))}),n},g=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(){var e=Array.prototype.slice.call(arguments);return a(t.inputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},m=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(e){return h(t.outputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e};e.exports={inputParser:g,outputParser:m,formatInput:a,formatOutput:h}},{"./const":4,"./formatters":5,"./types":6,"./utils":7}],4:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3}}).call(this,t("_process"))},{_process:2,"bignumber.js":8}],5:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=t("./utils"),o=t("./const"),f=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},u=function(t){var e=2*o.ETH_PADDING;return t instanceof r||"number"==typeof t?("number"==typeof t&&(t=new r(t)),r.config(o.ETH_BIGNUMBER_ROUNDING_MODE),t=t.round(),t.lessThan(0)&&(t=new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?u(new r(t)):(+t).toString(16),f(t,e)},s=function(t){return i.fromAscii(t,o.ETH_PADDING).substr(2)},c=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},a=function(t){return u(new r(t).times(new r(2).pow(128)))},l=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},p=function(t){return t=t||"0",l(t)?new r(t,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(t,16)},h=function(t){return t=t||"0",new r(t,16)},g=function(t){return p(t).dividedBy(new r(2).pow(128))},m=function(t){return h(t).dividedBy(new r(2).pow(128))},d=function(t){return"0x"+t},v=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},w=function(t){return i.toAscii(t)},y=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:u,formatInputString:s,formatInputBool:c,formatInputReal:a,formatOutputInt:p,formatOutputUInt:h,formatOutputReal:g,formatOutputUReal:m,formatOutputHash:d,formatOutputBool:v,formatOutputString:w,formatOutputAddress:y}}).call(this,t("_process"))},{"./const":4,"./utils":7,_process:2,"bignumber.js":8}],6:[function(t,e){var n=t("./formatters"),r=function(t){return function(e){return 0===e.indexOf(t)}},i=function(t){return function(e){return t===e}},o=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("hash"),format:n.formatInputInt},{type:r("string"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:i("address"),format:n.formatInputInt},{type:i("bool"),format:n.formatInputBool}]},f=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("hash"),format:n.formatOutputHash},{type:r("string"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:i("address"),format:n.formatOutputAddress},{type:i("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:i,inputTypes:o,outputTypes:f}},{"./formatters":5}],7:[function(t,e){var n=t("./const"),r=function(t,e){for(var n=!1,r=0;rn;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},o=function(t){for(var e="",n=0;n3e3&&rr?"i":"").test(c))return m(a,c,u,r);u?(a.s=0>1/t?(c=c.slice(1),-1):1,$&&c.replace(/^0\.0*|\./,"").length>15&&U(L,O,t),u=!1):a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,a.s)}else{if(t instanceof e)return a.s=t.s,a.e=t.e,a.c=(t=t.c)?t.slice():t,void(L=0);if((u="number"==typeof t)&&0*t==0){if(a.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,f=t;f>=10;f/=10,o++);return a.e=o,a.c=[t],void(L=0)}c=t+""}else{if(!d.test(c=t+""))return m(a,c,u);a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(f=c.search(/e/i))>0?(0>o&&(o=f),o+=+c.slice(f+1),c=c.substring(0,f)):0>o&&(o=c.length),f=0;48===c.charCodeAt(f);f++);for(s=c.length;48===c.charCodeAt(--s););if(c=c.slice(f,s+1))if(s=c.length,u&&$&&s>15&&U(L,O,a.s*t),o=o-f-1,o>q)a.c=a.e=null;else if(k>o)a.c=[a.e=0];else{if(a.e=o,a.c=[],f=(o+1)%I,0>o&&(f+=I),s>f){for(f&&a.c.push(+c.slice(0,f)),s-=I;s>f;)a.c.push(+c.slice(f,f+=I));c=c.slice(f),f=I-c.length}else f-=s;for(;f--;c+="0");a.c.push(+c)}else a.c=[a.e=0];L=0}function n(t,n,r,i){var f,u,s,a,p,h,g,m=t.indexOf("."),d=B,v=H;for(37>r&&(t=t.toLowerCase()),m>=0&&(s=Y,Y=0,t=t.replace(".",""),g=new e(r),p=g.pow(t.length-m),Y=s,g.c=c(l(o(p.c),p.e),10,n),g.e=g.c.length),h=c(t,r,n),u=s=h.length;0==h[--s];h.pop());if(!h[0])return"0";if(0>m?--u:(p.c=h,p.e=u,p.s=i,p=G(p,g,d,v,n),h=p.c,a=p.r,u=p.e),f=u+d+1,m=h[f],s=n/2,a=a||0>f||null!=h[f+1],a=4>v?(null!=m||a)&&(0==v||v==(p.s<0?3:2)):m>s||m==s&&(4==v||a||6==v&&1&h[f-1]||v==(p.s<0?8:7)),1>f||!h[0])t=a?l("1",-d):"0";else{if(h.length=f,a)for(--n;++h[--f]>n;)h[f]=0,f||(++u,h.unshift(1));for(s=h.length;!h[--s];);for(m=0,t="";s>=m;t+=N.charAt(h[m++]));t=l(t,u)}return t}function h(t,n,r,i){var f,u,s,c,p;if(r=null!=r&&z(r,0,8,i,b)?0|r:H,!t.c)return t.toString();if(f=t.c[0],s=t.e,null==n)p=o(t.c),p=19==i||24==i&&C>=s?a(p,s):l(p,s);else if(t=F(new e(t),n,r),u=t.e,p=o(t.c),c=p.length,19==i||24==i&&(u>=n||C>=u)){for(;n>c;p+="0",c++);p=a(p,u)}else if(n-=s,p=l(p,u),u+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=u-c,n>0)for(u+1==c&&(p+=".");n--;p+="0");return t.s<0&&f?"-"+p:p}function S(t,n){var r,i,o=0;for(s(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&U(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function R(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>q?t.c=t.e=null:k>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function U(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",L=0,r}function F(t,e,n,r){var i,o,f,u,s,c,a,l=t.c,p=_;if(l){t:{for(i=1,u=l[0];u>=10;u/=10,i++);if(o=e-i,0>o)o+=I,f=e,s=l[c=0],a=s/p[i-f-1]%10|0;else if(c=v((o+1)/I),c>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));s=a=0,i=1,o%=I,f=o-I+1}else{for(s=u=l[c],i=1;u>=10;u/=10,i++);o%=I,f=o-I+i,a=0>f?0:s/p[i-f-1]%10|0}if(r=r||0>e||null!=l[c+1]||(0>f?s:s%p[i-f-1]),r=4>n?(a||r)&&(0==n||n==(t.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?f>0?s/p[i-f]:0:l[c-1])%10&1||n==(t.s<0?8:7)),1>e||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=p[e%I],t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=c,u=1,c--):(l.length=c+1,u=p[I-o],l[c]=f>0?w(s/p[i-f]%p[f])*u:0),r)for(;;){if(0==c){for(o=1,f=l[0];f>=10;f/=10,o++);for(f=l[0]+=u,u=1;f>=10;f/=10,u++);o!=u&&(t.e++,l[0]==E&&(l[0]=1));break}if(l[c]+=u,l[c]!=E)break;l[c--]=0,u=1}for(o=l.length;0===l[--o];l.pop());}t.e>q?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return f(e="DECIMAL_PLACES")&&z(t,0,D,2,e)&&(B=0|t),r[e]=B,f(e="ROUNDING_MODE")&&z(t,0,8,2,e)&&(H=0|t),r[e]=H,f(e="EXPONENTIAL_AT")&&(s(t)?z(t[0],-D,0,2,e)&&z(t[1],0,D,2,e)&&(C=0|t[0],j=0|t[1]):z(t,-D,D,2,e)&&(C=-(j=0|(0>t?-t:t)))),r[e]=[C,j],f(e="RANGE")&&(s(t)?z(t[0],-D,-1,2,e)&&z(t[1],1,D,2,e)&&(k=0|t[0],q=0|t[1]):z(t,-D,D,2,e)&&(0|t?k=-(q=0|(0>t?-t:t)):$&&U(2,e+" cannot be zero",t))),r[e]=[k,q],f(e="ERRORS")&&(t===!!t||1===t||0===t?(L=0,z=($=!!t)?A:u):$&&U(2,e+y,t)),r[e]=$,f(e="CRYPTO")&&(t===!!t||1===t||0===t?(V=!(!t||!g||"object"!=typeof g),t&&!V&&$&&U(2,"crypto unavailable",g)):$&&U(2,e+y,t)),r[e]=V,f(e="MODULO_MODE")&&z(t,0,9,2,e)&&(W=0|t),r[e]=W,f(e="POW_PRECISION")&&z(t,0,D,2,e)&&(Y=0|t),r[e]=Y,f(e="FORMAT")&&("object"==typeof t?Z=t:$&&U(2,e+" not an object",t)),r[e]=Z,r},e.max=function(){return S(arguments,M.lt)},e.min=function(){return S(arguments,M.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return w(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,f,u,s=0,c=[],a=new e(P);if(t=null!=t&&z(t,0,D,14)?0|t:B,f=v(t/I),V)if(g&&g.getRandomValues){for(r=g.getRandomValues(new Uint32Array(f*=2));f>s;)u=131072*r[s]+(r[s+1]>>>11),u>=9e15?(i=g.getRandomValues(new Uint32Array(2)),r[s]=i[0],r[s+1]=i[1]):(c.push(u%1e14),s+=2);s=f/2}else if(g&&g.randomBytes){for(r=g.randomBytes(f*=7);f>s;)u=281474976710656*(31&r[s])+1099511627776*r[s+1]+4294967296*r[s+2]+16777216*r[s+3]+(r[s+4]<<16)+(r[s+5]<<8)+r[s+6],u>=9e15?g.randomBytes(7).copy(r,s):(c.push(u%1e14),s+=7);s=f/7}else $&&U(14,"crypto unavailable",g);if(!s)for(;f>s;)u=n(),9e15>u&&(c[s++]=u%1e14);for(f=c[--s],t%=I,f&&t&&(u=_[I-t],c[s]=w(f/u)*u);0===c[s];c.pop(),s--);if(0>s)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(s=1,u=c[0];u>=10;u/=10,s++);I>s&&(o-=I-s)}return a.e=o,a.c=c,a}}(),G=function(){function t(t,e,n){var r,i,o,f,u=0,s=t.length,c=e%T,a=e/T|0;for(t=t.slice();s--;)o=t[s]%T,f=t[s]/T|0,r=a*o+f*c,i=c*o+r%T*T+u,u=(i/n|0)+(r/T|0)+a*f,t[s]=i%n;return u&&t.unshift(u),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,f,u,s,c){var a,l,p,h,g,m,d,v,y,b,O,N,x,_,T,D,S,A=o.s==f.s?1:-1,R=o.c,U=f.c;if(!(R&&R[0]&&U&&U[0]))return new e(o.s&&f.s&&(R?!U||R[0]!=U[0]:U)?R&&0==R[0]||!U?0*A:A/0:0/0);for(v=new e(A),y=v.c=[],l=o.e-f.e,A=u+l+1,c||(c=E,l=i(o.e/I)-i(f.e/I),A=A/I|0),p=0;U[p]==(R[p]||0);p++);if(U[p]>(R[p]||0)&&l--,0>A)y.push(1),h=!0;else{for(_=R.length,D=U.length,p=0,A+=2,g=w(c/(U[0]+1)),g>1&&(U=t(U,g,c),R=t(R,g,c),D=U.length,_=R.length),x=D,b=R.slice(0,D),O=b.length;D>O;b[O++]=0);S=U.slice(),S.unshift(0),T=U[0],U[1]>=c/2&&T++;do g=0,a=n(U,b,D,O),0>a?(N=b[0],D!=O&&(N=N*c+(b[1]||0)),g=w(N/T),g>1?(g>=c&&(g=c-1),m=t(U,g,c),d=m.length,O=b.length,a=n(m,b,d,O),1==a&&(g--,r(m,d>D?S:U,d,c))):(0==g&&(a=g=1),m=U.slice()),d=m.length,O>d&&m.unshift(0),r(b,m,O,c),-1==a&&(O=b.length,a=n(U,b,D,O),1>a&&(g++,r(b,O>D?S:U,O,c))),O=b.length):0===a&&(g++,b=[0]),y[p++]=g,a&&b[0]?b[O++]=R[x]||0:(b=[R[x]],O=1);while((x++<_||null!=b[0])&&A--);h=null!=b[0],y[0]||y.shift()}if(c==E){for(p=1,A=y[0];A>=10;A/=10,p++);F(v,u+(v.e=p+l*I-1)+1,s,h)}else v.e=l,v.r=+h;return v}}(),m==function(){var t=/^(-?)0([xbo])(\w[\w.]*$)/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+([\w.])|^\s+|\s+$/g;return function(f,u,s,c){var a,l=s?u:u.replace(o,"$1");if(i.test(l))f.s=isNaN(l)?null:0>l?-1:1;else{if(!s&&(l=l.replace(t,function(t,e,n){return a="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=a?t:e}),c&&(a=c,l=l.replace(n,"$1").replace(r,"0.$1")),u!=l))return new e(l,a);$&&U(L,"not a"+(c?" base "+c:"")+" number",u),f.s=null}f.c=f.e=null,L=0}}(),M.absoluteValue=M.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},M.ceil=function(){return F(new e(this),this.e+1,2)},M.comparedTo=M.cmp=function(t,n){return L=1,f(this,new e(t,n))},M.decimalPlaces=M.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},M.dividedBy=M.div=function(t,n){return L=3,G(this,new e(t,n),B,H)},M.dividedToIntegerBy=M.divToInt=function(t,n){return L=4,G(this,new e(t,n),0,1)},M.equals=M.eq=function(t,n){return L=5,0===f(this,new e(t,n))},M.floor=function(){return F(new e(this),this.e+1,3)},M.greaterThan=M.gt=function(t,n){return L=6,f(this,new e(t,n))>0},M.greaterThanOrEqualTo=M.gte=function(t,n){return L=7,1===(n=f(this,new e(t,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(t,n){return L=8,f(this,new e(t,n))<0},M.lessThanOrEqualTo=M.lte=function(t,n){return L=9,-1===(n=f(this,new e(t,n)))||0===n},M.minus=M.sub=function(t,n){var r,o,f,u,s=this,c=s.s;if(L=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,s.plus(t);var a=s.e/I,l=t.e/I,p=s.c,h=t.c;if(!a||!l){if(!p||!h)return p?(t.s=-n,t):new e(h?s:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?s:3==H?-0:0)}if(a=i(a),l=i(l),p=p.slice(),c=a-l){for((u=0>c)?(c=-c,f=p):(l=a,f=h),f.reverse(),n=c;n--;f.push(0));f.reverse()}else for(o=(u=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){u=p[n]0)for(;n--;p[r++]=0);for(n=E-1;o>c;){if(p[--o]0?(s=u,r=a):(f=-f,r=c),r.reverse();f--;r.push(0));r.reverse()}for(f=c.length,n=a.length,0>f-n&&(r=a,a=c,c=r,n=f),f=0;n;)f=(c[--n]=c[n]+a[n]+f)/E|0,c[n]%=E;return f&&(c.unshift(f),++s),R(t,c,s)},M.precision=M.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&($&&U(13,"argument"+y,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},M.round=function(t,n){var r=new e(this);return(null==t||z(t,0,D,15))&&F(r,~~t+this.e+1,null!=n&&z(n,0,8,15,b)?0|n:H),r},M.shift=function(t){var n=this;return z(t,-x,x,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-x>t||t>x)?n.s*(0>t?0:1/0):n)},M.squareRoot=M.sqrt=function(){var t,n,r,f,u,s=this,c=s.c,a=s.s,l=s.e,p=B+4,h=new e("0.5");if(1!==a||!c||!c[0])return new e(!a||0>a&&(!c||c[0])?0/0:c?s:1/0);if(a=Math.sqrt(+s),0==a||a==1/0?(n=o(c),(n.length+l)%2==0&&(n+="0"),a=Math.sqrt(n),l=i((l+1)/2)-(0>l||l%2),a==1/0?n="1e"+l:(n=a.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new e(n)):r=new e(a+""),r.c[0])for(l=r.e,a=l+p,3>a&&(a=0);;)if(u=r,r=h.times(u.plus(G(s,u,p,1))),o(u.c).slice(0,a)===(n=o(r.c)).slice(0,a)){if(r.ea&&(d=b,b=O,O=d,f=a,a=h,h=f),f=a+h,d=[];f--;d.push(0));for(v=E,w=T,f=h;--f>=0;){for(r=0,g=O[f]%w,m=O[f]/w|0,s=a,u=f+s;u>f;)l=b[--s]%w,p=b[s]/w|0,c=m*l+p*g,l=g*l+c%w*w+d[u]+r,r=(l/v|0)+(c/w|0)+m*p,d[u--]=l%v;d[u]=r}return r?++o:d.shift(),R(t,d,o)},M.toDigits=function(t,n){var r=new e(this);return t=null!=t&&z(t,1,D,18,"precision")?0|t:null,n=null!=n&&z(n,0,8,18,b)?0|n:H,t?F(r,t,n):r},M.toExponential=function(t,e){return h(this,null!=t&&z(t,0,D,19)?~~t+1:null,e,19)},M.toFixed=function(t,e){return h(this,null!=t&&z(t,0,D,20)?~~t+this.e+1:null,e,20)},M.toFormat=function(t,e){var n=h(this,null!=t&&z(t,0,D,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+Z.groupSize,f=+Z.secondaryGroupSize,u=Z.groupSeparator,s=i[0],c=i[1],a=this.s<0,l=a?s.slice(1):s,p=l.length;if(f&&(r=o,o=f,f=r,p-=r),o>0&&p>0){for(r=p%o||o,s=l.substr(0,r);p>r;r+=o)s+=u+l.substr(r,o);f>0&&(s+=u+l.slice(r)),a&&(s="-"+s)}n=c?s+Z.decimalSeparator+((f=+Z.fractionGroupSize)?c.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+Z.fractionGroupSeparator):c):s}return n},M.toFraction=function(t){var n,r,i,f,u,s,c,a,l,p=$,h=this,g=h.c,m=new e(P),d=r=new e(P),v=c=new e(P);if(null!=t&&($=!1,s=new e(t),$=p,(!(p=s.isInt())||s.lt(P))&&($&&U(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&s.c&&F(s,s.e+1,1).gte(P)?s:null)),!g)return h.toString();for(l=o(g),f=m.e=l.length-h.e-1,m.c[0]=_[(u=f%I)<0?I+u:u],t=!t||s.cmp(m)>0?f>0?m:d:s,u=q,q=1/0,s=new e(l),c.c[0]=0;a=G(s,m,0,1),i=r.plus(a.times(v)),1!=i.cmp(t);)r=v,v=i,d=c.plus(a.times(i=d)),c=i,m=s.minus(a.times(i=m)),s=i;return i=G(t.minus(r),v,0,1),c=c.plus(i.times(d)),r=r.plus(i.times(v)),c.s=d.s=h.s,f*=2,n=G(d,v,f,H).minus(h).abs().cmp(G(c,r,f,H).minus(h).abs())<1?[d.toString(),v.toString()]:[c.toString(),r.toString()],q=u,n},M.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},M.toPower=M.pow=function(t){var n,r,i=w(0>t?-t:+t),o=this;if(!z(t,-x,x,23,"exponent")&&(!isFinite(t)||i>x&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=Y?v(Y/I+2):0,r=new e(P);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=w(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=P.div(r)),n?F(r,Y,H):r},M.toPrecision=function(t,e){return h(this,null!=t&&z(t,1,D,24,"precision")?0|t:null,e,24)},M.toString=function(t){var e,r=this,i=r.s,f=r.e;return null===f?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&z(t,2,64,25,"base")?n(l(e,f),0|t,10,i):C>=f||f>=j?a(e,f):l(e,f),0>i&&r.c[0]&&(e="-"+e)),e},M.truncated=M.trunc=function(){return F(new e(this),this.e+1,1)},M.valueOf=M.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function f(t,e){var n,r,i=t.c,o=e.c,f=t.s,u=e.s,s=t.e,c=e.e;if(!f||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:f;if(f!=u)return f;if(n=0>f,r=s==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return s>c^n?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,f=0;u>f;f++)if(i[f]!=o[f])return i[f]>o[f]^n?1:-1;return s==c?0:s>c^n?1:-1}function u(t,e,n){return(t=p(t))>=e&&n>=t}function s(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],f=0,u=t.length;u>f;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=N.indexOf(t.charAt(f++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function a(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function l(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?v(t):w(t)}var h,g,m,d=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=Math.ceil,w=Math.floor,y=" not a boolean or binary digit",b="rounding mode",O="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",E=1e14,I=14,x=9007199254740991,_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],T=1e7,D=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!g)try{g=t("crypto")}catch(S){}}else n.BigNumber=h}(this)},{crypto:1}],natspec:[function(t,e){var n=t("./node_modules/ethereum.js/lib/abi.js"),r=function(){var t=function(t,e){Object.keys(t).forEach(function(n){e[n]=t[n]})},e=function(t){return Object.keys(t).reduce(function(t,e){return t+"var "+e+" = context['"+e+"'];\n"},"")},r=function(t,e){return t.filter(function(t){return t.name===e})[0]},i=function(t,e){var r=n.formatOutput(t.inputs,"0x"+e.params[0].data.slice(10));return t.inputs.reduce(function(t,e,n){return t[e.name]=r[n],t},{})},o=function(t,e){var n,r="",i=/\` + "`" + `(?:\\.|[^` + "`" + `\\])*\` + "`" + `/gim,o=0;try{for(;null!==(n=i.exec(t));){var f=i.lastIndex-n[0].length,u=n[0].slice(1,n[0].length-1);r+=t.slice(o,f);var s=e(u);r+=s,o=i.lastIndex}r+=t.slice(o)}catch(c){throw new Error("Natspec evaluation failed, wrong input params")}return r},f=function(n,f){var u={};if(f)try{var s=r(f.abi,f.method),c=i(s,f.transaction);t(c,u)}catch(a){throw new Error("Natspec evaluation failed, method does not exist")}var l=e(u),p=o(n,function(t){var e=new Function("context",l+"return "+t+";");return e(u).toString()});return p},u=function(t,e){try{return f(t,e)}catch(n){return n.message}};return{evaluateExpression:f,evaluateExpressionSafe:u}}();e.exports=r},{"./node_modules/ethereum.js/lib/abi.js":3}]},{},[]); -` -require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o. -*/ -/** - * @file abi.js - * @author Marek Kotewicz - * @author Gav Wood - * @date 2014 - */ - -var utils = require('../utils/utils'); -var c = require('../utils/config'); -var types = require('./types'); -var f = require('./formatters'); -var solUtils = require('./utils'); - -/** - * throw incorrect type error - * - * @method throwTypeError - * @param {String} type - * @throws incorrect type error - */ -var throwTypeError = function (type) { - throw new Error('parser does not support type: ' + type); -}; - -/** This method should be called if we want to check if givent type is an array type - * - * @method isArrayType - * @param {String} type name - * @returns {Boolean} true if it is, otherwise false - */ -var isArrayType = function (type) { - return type.slice(-2) === '[]'; -}; - -/** - * This method should be called to return dynamic type length in hex - * - * @method dynamicTypeBytes - * @param {String} type - * @param {String|Array} dynamic type - * @return {String} length of dynamic type in hex or empty string if type is not dynamic - */ -var dynamicTypeBytes = function (type, value) { - // TODO: decide what to do with array of strings - if (isArrayType(type) || type === 'bytes') - return f.formatInputInt(value.length); - return ""; -}; - -var inputTypes = types.inputTypes(); - -/** - * Formats input params to bytes - * - * @method formatInput - * @param {Array} abi inputs of method - * @param {Array} params that will be formatted to bytes - * @returns bytes representation of input params - */ -var formatInput = function (inputs, params) { - var bytes = ""; - var toAppendConstant = ""; - var toAppendArrayContent = ""; - - /// first we iterate in search for dynamic - inputs.forEach(function (input, index) { - bytes += dynamicTypeBytes(input.type, params[index]); - }); - - inputs.forEach(function (input, i) { - /*jshint maxcomplexity:5 */ - var typeMatch = false; - for (var j = 0; j < inputTypes.length && !typeMatch; j++) { - typeMatch = inputTypes[j].type(inputs[i].type, params[i]); - } - if (!typeMatch) { - throwTypeError(inputs[i].type); - } - - var formatter = inputTypes[j - 1].format; - - if (isArrayType(inputs[i].type)) - toAppendArrayContent += params[i].reduce(function (acc, curr) { - return acc + formatter(curr); - }, ""); - else if (inputs[i].type === 'bytes') - toAppendArrayContent += formatter(params[i]); - else - toAppendConstant += formatter(params[i]); - }); - - bytes += toAppendConstant + toAppendArrayContent; - - return bytes; -}; - -/** - * This method should be called to predict the length of dynamic type - * - * @method dynamicBytesLength - * @param {String} type - * @returns {Number} length of dynamic type, 0 or multiplication of ETH_PADDING (32) - */ -var dynamicBytesLength = function (type) { - if (isArrayType(type) || type === 'bytes') - return c.ETH_PADDING * 2; - return 0; -}; - -var outputTypes = types.outputTypes(); - -/** - * Formats output bytes back to param list - * - * @method formatOutput - * @param {Array} abi outputs of method - * @param {String} bytes represention of output - * @returns {Array} output params - */ -var formatOutput = function (outs, output) { - - output = output.slice(2); - var result = []; - var padding = c.ETH_PADDING * 2; - - var dynamicPartLength = outs.reduce(function (acc, curr) { - return acc + dynamicBytesLength(curr.type); - }, 0); - - var dynamicPart = output.slice(0, dynamicPartLength); - output = output.slice(dynamicPartLength); - - outs.forEach(function (out, i) { - /*jshint maxcomplexity:6 */ - var typeMatch = false; - for (var j = 0; j < outputTypes.length && !typeMatch; j++) { - typeMatch = outputTypes[j].type(outs[i].type); - } - - if (!typeMatch) { - throwTypeError(outs[i].type); - } - - var formatter = outputTypes[j - 1].format; - if (isArrayType(outs[i].type)) { - var size = f.formatOutputUInt(dynamicPart.slice(0, padding)); - dynamicPart = dynamicPart.slice(padding); - var array = []; - for (var k = 0; k < size; k++) { - array.push(formatter(output.slice(0, padding))); - output = output.slice(padding); - } - result.push(array); - } - else if (types.prefixedType('bytes')(outs[i].type)) { - dynamicPart = dynamicPart.slice(padding); - result.push(formatter(output.slice(0, padding))); - output = output.slice(padding); - } else { - result.push(formatter(output.slice(0, padding))); - output = output.slice(padding); - } - }); - - return result; -}; - -/** - * Should be called to create input parser for contract with given abi - * - * @method inputParser - * @param {Array} contract abi - * @returns {Object} input parser object for given json abi - * TODO: refactor creating the parser, do not double logic from contract - */ -var inputParser = function (json) { - var parser = {}; - json.forEach(function (method) { - var displayName = utils.extractDisplayName(method.name); - var typeName = utils.extractTypeName(method.name); - - var impl = function () { - var params = Array.prototype.slice.call(arguments); - return formatInput(method.inputs, params); - }; - - if (parser[displayName] === undefined) { - parser[displayName] = impl; - } - - parser[displayName][typeName] = impl; - }); - - return parser; -}; - -/** - * Should be called to create output parser for contract with given abi - * - * @method outputParser - * @param {Array} contract abi - * @returns {Object} output parser for given json abi - */ -var outputParser = function (json) { - var parser = {}; - json.forEach(function (method) { - - var displayName = utils.extractDisplayName(method.name); - var typeName = utils.extractTypeName(method.name); - - var impl = function (output) { - return formatOutput(method.outputs, output); - }; - - if (parser[displayName] === undefined) { - parser[displayName] = impl; - } - - parser[displayName][typeName] = impl; - }); - - return parser; -}; - -var formatConstructorParams = function (abi, params) { - var constructor = solUtils.getConstructor(abi, params.length); - if (!constructor) { - if (params.length > 0) { - console.warn("didn't found matching constructor, using default one"); - } - return ''; - } - return formatInput(constructor.inputs, params); -}; - -module.exports = { - inputParser: inputParser, - outputParser: outputParser, - formatInput: formatInput, - formatOutput: formatOutput, - formatConstructorParams: formatConstructorParams -}; - -},{"../utils/config":6,"../utils/utils":7,"./formatters":3,"./types":4,"./utils":5}],3:[function(require,module,exports){ -/* - This file is part of ethereum.js. - - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** @file formatters.js - * @authors: - * Marek Kotewicz - * @date 2015 - */ - -var BigNumber = require('bignumber.js'); -var utils = require('../utils/utils'); -var c = require('../utils/config'); - -/** - * Formats input value to byte representation of int - * If value is negative, return it's two's complement - * If the value is floating point, round it down - * - * @method formatInputInt - * @param {String|Number|BigNumber} value that needs to be formatted - * @returns {String} right-aligned byte representation of int - */ -var formatInputInt = function (value) { - var padding = c.ETH_PADDING * 2; - BigNumber.config(c.ETH_BIGNUMBER_ROUNDING_MODE); - return utils.padLeft(utils.toTwosComplement(value).round().toString(16), padding); -}; - -/** - * Formats input value to byte representation of string - * - * @method formatInputString - * @param {String} - * @returns {String} left-algined byte representation of string - */ -var formatInputString = function (value) { - return utils.fromAscii(value, c.ETH_PADDING).substr(2); -}; - -/** - * Formats input value to byte representation of bool - * - * @method formatInputBool - * @param {Boolean} - * @returns {String} right-aligned byte representation bool - */ -var formatInputBool = function (value) { - return '000000000000000000000000000000000000000000000000000000000000000' + (value ? '1' : '0'); -}; - -/** - * Formats input value to byte representation of real - * Values are multiplied by 2^m and encoded as integers - * - * @method formatInputReal - * @param {String|Number|BigNumber} - * @returns {String} byte representation of real - */ -var formatInputReal = function (value) { - return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128))); -}; - -/** - * Check if input value is negative - * - * @method signedIsNegative - * @param {String} value is hex format - * @returns {Boolean} true if it is negative, otherwise false - */ -var signedIsNegative = function (value) { - return (new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1)) === '1'; -}; - -/** - * Formats right-aligned output bytes to int - * - * @method formatOutputInt - * @param {String} bytes - * @returns {BigNumber} right-aligned output bytes formatted to big number - */ -var formatOutputInt = function (value) { - - value = value || "0"; - - // check if it's negative number - // it it is, return two's complement - if (signedIsNegative(value)) { - return new BigNumber(value, 16).minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)).minus(1); - } - return new BigNumber(value, 16); -}; - -/** - * Formats right-aligned output bytes to uint - * - * @method formatOutputUInt - * @param {String} bytes - * @returns {BigNumeber} right-aligned output bytes formatted to uint - */ -var formatOutputUInt = function (value) { - value = value || "0"; - return new BigNumber(value, 16); -}; - -/** - * Formats right-aligned output bytes to real - * - * @method formatOutputReal - * @param {String} - * @returns {BigNumber} input bytes formatted to real - */ -var formatOutputReal = function (value) { - return formatOutputInt(value).dividedBy(new BigNumber(2).pow(128)); -}; - -/** - * Formats right-aligned output bytes to ureal - * - * @method formatOutputUReal - * @param {String} - * @returns {BigNumber} input bytes formatted to ureal - */ -var formatOutputUReal = function (value) { - return formatOutputUInt(value).dividedBy(new BigNumber(2).pow(128)); -}; - -/** - * Should be used to format output hash - * - * @method formatOutputHash - * @param {String} - * @returns {String} right-aligned output bytes formatted to hex - */ -var formatOutputHash = function (value) { - return "0x" + value; -}; - -/** - * Should be used to format output bool - * - * @method formatOutputBool - * @param {String} - * @returns {Boolean} right-aligned input bytes formatted to bool - */ -var formatOutputBool = function (value) { - return value === '0000000000000000000000000000000000000000000000000000000000000001' ? true : false; -}; - -/** - * Should be used to format output string - * - * @method formatOutputString - * @param {Sttring} left-aligned hex representation of string - * @returns {String} ascii string - */ -var formatOutputString = function (value) { - return utils.toAscii(value); -}; - -/** - * Should be used to format output address - * - * @method formatOutputAddress - * @param {String} right-aligned input bytes - * @returns {String} address - */ -var formatOutputAddress = function (value) { - return "0x" + value.slice(value.length - 40, value.length); -}; - -module.exports = { - formatInputInt: formatInputInt, - formatInputString: formatInputString, - formatInputBool: formatInputBool, - formatInputReal: formatInputReal, - formatOutputInt: formatOutputInt, - formatOutputUInt: formatOutputUInt, - formatOutputReal: formatOutputReal, - formatOutputUReal: formatOutputUReal, - formatOutputHash: formatOutputHash, - formatOutputBool: formatOutputBool, - formatOutputString: formatOutputString, - formatOutputAddress: formatOutputAddress -}; - - -},{"../utils/config":6,"../utils/utils":7,"bignumber.js":8}],4:[function(require,module,exports){ -/* - This file is part of ethereum.js. - - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** @file types.js - * @authors: - * Marek Kotewicz - * @date 2015 - */ - -var f = require('./formatters'); - -/// @param expected type prefix (string) -/// @returns function which checks if type has matching prefix. if yes, returns true, otherwise false -var prefixedType = function (prefix) { - return function (type) { - return type.indexOf(prefix) === 0; - }; -}; - -/// @param expected type name (string) -/// @returns function which checks if type is matching expected one. if yes, returns true, otherwise false -var namedType = function (name) { - return function (type) { - return name === type; - }; -}; - -/// Setups input formatters for solidity types -/// @returns an array of input formatters -var inputTypes = function () { - - return [ - { type: prefixedType('uint'), format: f.formatInputInt }, - { type: prefixedType('int'), format: f.formatInputInt }, - { type: prefixedType('bytes'), format: f.formatInputString }, - { type: prefixedType('real'), format: f.formatInputReal }, - { type: prefixedType('ureal'), format: f.formatInputReal }, - { type: namedType('address'), format: f.formatInputInt }, - { type: namedType('bool'), format: f.formatInputBool } - ]; -}; - -/// Setups output formaters for solidity types -/// @returns an array of output formatters -var outputTypes = function () { - - return [ - { type: prefixedType('uint'), format: f.formatOutputUInt }, - { type: prefixedType('int'), format: f.formatOutputInt }, - { type: prefixedType('bytes'), format: f.formatOutputString }, - { type: prefixedType('real'), format: f.formatOutputReal }, - { type: prefixedType('ureal'), format: f.formatOutputUReal }, - { type: namedType('address'), format: f.formatOutputAddress }, - { type: namedType('bool'), format: f.formatOutputBool } - ]; -}; - -module.exports = { - prefixedType: prefixedType, - namedType: namedType, - inputTypes: inputTypes, - outputTypes: outputTypes -}; - - -},{"./formatters":3}],5:[function(require,module,exports){ -/* - This file is part of ethereum.js. - - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** - * @file utils.js - * @author Marek Kotewicz - * @date 2015 - */ - -/** - * Returns the contstructor with matching number of arguments - * - * @method getConstructor - * @param {Array} abi - * @param {Number} numberOfArgs - * @returns {Object} constructor function abi - */ -var getConstructor = function (abi, numberOfArgs) { - return abi.filter(function (f) { - return f.type === 'constructor' && f.inputs.length === numberOfArgs; - })[0]; -}; - -/** - * Filters all functions from input abi - * - * @method filterFunctions - * @param {Array} abi - * @returns {Array} abi array with filtered objects of type 'function' - */ -var filterFunctions = function (json) { - return json.filter(function (current) { - return current.type === 'function'; - }); -}; - -/** - * Filters all events from input abi - * - * @method filterEvents - * @param {Array} abi - * @returns {Array} abi array with filtered objects of type 'event' - */ -var filterEvents = function (json) { - return json.filter(function (current) { - return current.type === 'event'; - }); -}; - -module.exports = { - getConstructor: getConstructor, - filterFunctions: filterFunctions, - filterEvents: filterEvents -}; - - -},{}],6:[function(require,module,exports){ -/* - This file is part of ethereum.js. - - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** @file config.js - * @authors: - * Marek Kotewicz - * @date 2015 - */ - -/** - * Utils - * - * @module utils - */ - -/** - * Utility functions - * - * @class [utils] config - * @constructor - */ - -/// required to define ETH_BIGNUMBER_ROUNDING_MODE -var BigNumber = require('bignumber.js'); - -var ETH_UNITS = [ - 'wei', - 'Kwei', - 'Mwei', - 'Gwei', - 'szabo', - 'finney', - 'ether', - 'grand', - 'Mether', - 'Gether', - 'Tether', - 'Pether', - 'Eether', - 'Zether', - 'Yether', - 'Nether', - 'Dether', - 'Vether', - 'Uether' -]; - -module.exports = { - ETH_PADDING: 32, - ETH_SIGNATURE_LENGTH: 4, - ETH_UNITS: ETH_UNITS, - ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }, - ETH_POLLING_TIMEOUT: 1000, - ETH_DEFAULTBLOCK: 'latest' -}; - - -},{"bignumber.js":8}],7:[function(require,module,exports){ -/* - This file is part of ethereum.js. - - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** @file utils.js - * @authors: - * Marek Kotewicz - * @date 2015 - */ - -/** - * Utils - * - * @module utils - */ - -/** - * Utility functions - * - * @class [utils] utils - * @constructor - */ - -var BigNumber = require('bignumber.js'); - -var unitMap = { - 'wei': '1', - 'kwei': '1000', - 'ada': '1000', - 'mwei': '1000000', - 'babbage': '1000000', - 'gwei': '1000000000', - 'shannon': '1000000000', - 'szabo': '1000000000000', - 'finney': '1000000000000000', - 'ether': '1000000000000000000', - 'kether': '1000000000000000000000', - 'grand': '1000000000000000000000', - 'einstein': '1000000000000000000000', - 'mether': '1000000000000000000000000', - 'gether': '1000000000000000000000000000', - 'tether': '1000000000000000000000000000000' -}; - -/** - * Should be called to pad string to expected length - * - * @method padLeft - * @param {String} string to be padded - * @param {Number} characters that result string should have - * @param {String} sign, by default 0 - * @returns {String} right aligned string - */ -var padLeft = function (string, chars, sign) { - return new Array(chars - string.length + 1).join(sign ? sign : "0") + string; -}; - -/** Finds first index of array element matching pattern - * - * @method findIndex - * @param {Array} - * @param {Function} pattern - * @returns {Number} index of element - */ -var findIndex = function (array, callback) { - var end = false; - var i = 0; - for (; i < array.length && !end; i++) { - end = callback(array[i]); - } - return end ? i - 1 : -1; -}; - -/** - * Should be called to get sting from its hex representation - * - * @method toAscii - * @param {String} string in hex - * @returns {String} ascii string representation of hex value - */ -var toAscii = function(hex) { -// Find termination - var str = ""; - var i = 0, l = hex.length; - if (hex.substring(0, 2) === '0x') { - i = 2; - } - for (; i < l; i+=2) { - var code = parseInt(hex.substr(i, 2), 16); - if (code === 0) { - break; - } - - str += String.fromCharCode(code); - } - - return str; -}; - -/** - * Shold be called to get hex representation (prefixed by 0x) of ascii string - * - * @method fromAscii - * @param {String} string - * @returns {String} hex representation of input string - */ -var toHexNative = function(str) { - var hex = ""; - for(var i = 0; i < str.length; i++) { - var n = str.charCodeAt(i).toString(16); - hex += n.length < 2 ? '0' + n : n; - } - - return hex; -}; - -/** - * Shold be called to get hex representation (prefixed by 0x) of ascii string - * - * @method fromAscii - * @param {String} string - * @param {Number} optional padding - * @returns {String} hex representation of input string - */ -var fromAscii = function(str, pad) { - pad = pad === undefined ? 0 : pad; - var hex = toHexNative(str); - while (hex.length < pad*2) - hex += "00"; - return "0x" + hex; -}; - -/** - * Should be called to get display name of contract function - * - * @method extractDisplayName - * @param {String} name of function/event - * @returns {String} display name for function/event eg. multiply(uint256) -> multiply - */ -var extractDisplayName = function (name) { - var length = name.indexOf('('); - return length !== -1 ? name.substr(0, length) : name; -}; - -/// @returns overloaded part of function/event name -var extractTypeName = function (name) { - /// TODO: make it invulnerable - var length = name.indexOf('('); - return length !== -1 ? name.substr(length + 1, name.length - 1 - (length + 1)).replace(' ', '') : ""; -}; - -/** - * Converts value to its decimal representation in string - * - * @method toDecimal - * @param {String|Number|BigNumber} - * @return {String} - */ -var toDecimal = function (value) { - return toBigNumber(value).toNumber(); -}; - -/** - * Converts value to its hex representation - * - * @method fromDecimal - * @param {String|Number|BigNumber} - * @return {String} - */ -var fromDecimal = function (value) { - var number = toBigNumber(value); - var result = number.toString(16); - - return number.lessThan(0) ? '-0x' + result.substr(1) : '0x' + result; -}; - -/** - * Auto converts any given value into its hex representation. - * - * And even stringifys objects before. - * - * @method toHex - * @param {String|Number|BigNumber|Object} - * @return {String} - */ -var toHex = function (val) { - /*jshint maxcomplexity:7 */ - - if (isBoolean(val)) - return fromDecimal(+val); - - if (isBigNumber(val)) - return fromDecimal(val); - - if (isObject(val)) - return fromAscii(JSON.stringify(val)); - - // if its a negative number, pass it through fromDecimal - if (isString(val)) { - if (val.indexOf('-0x') === 0) - return fromDecimal(val); - else if (!isFinite(val)) - return fromAscii(val); - } - - return fromDecimal(val); -}; - -/** - * Returns value of unit in Wei - * - * @method getValueOfUnit - * @param {String} unit the unit to convert to, default ether - * @returns {BigNumber} value of the unit (in Wei) - * @throws error if the unit is not correct:w - */ -var getValueOfUnit = function (unit) { - unit = unit ? unit.toLowerCase() : 'ether'; - var unitValue = unitMap[unit]; - if (unitValue === undefined) { - throw new Error('This unit doesn\'t exists, please use the one of the following units' + JSON.stringify(unitMap, null, 2)); - } - return new BigNumber(unitValue, 10); -}; - -/** - * Takes a number of wei and converts it to any other ether unit. - * - * Possible units are: - * - kwei/ada - * - mwei/babbage - * - gwei/shannon - * - szabo - * - finney - * - ether - * - kether/grand/einstein - * - mether - * - gether - * - tether - * - * @method fromWei - * @param {Number|String} number can be a number, number string or a HEX of a decimal - * @param {String} unit the unit to convert to, default ether - * @return {String|Object} When given a BigNumber object it returns one as well, otherwise a number -*/ -var fromWei = function(number, unit) { - var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit)); - - return isBigNumber(number) ? returnValue : returnValue.toString(10); -}; - -/** - * Takes a number of a unit and converts it to wei. - * - * Possible units are: - * - kwei/ada - * - mwei/babbage - * - gwei/shannon - * - szabo - * - finney - * - ether - * - kether/grand/einstein - * - mether - * - gether - * - tether - * - * @method toWei - * @param {Number|String|BigNumber} number can be a number, number string or a HEX of a decimal - * @param {String} unit the unit to convert from, default ether - * @return {String|Object} When given a BigNumber object it returns one as well, otherwise a number -*/ -var toWei = function(number, unit) { - var returnValue = toBigNumber(number).times(getValueOfUnit(unit)); - - return isBigNumber(number) ? returnValue : returnValue.toString(10); -}; - -/** - * Takes an input and transforms it into an bignumber - * - * @method toBigNumber - * @param {Number|String|BigNumber} a number, string, HEX string or BigNumber - * @return {BigNumber} BigNumber -*/ -var toBigNumber = function(number) { - /*jshint maxcomplexity:5 */ - number = number || 0; - if (isBigNumber(number)) - return number; - - if (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) { - return new BigNumber(number.replace('0x',''), 16); - } - - return new BigNumber(number.toString(10), 10); -}; - -/** - * Takes and input transforms it into bignumber and if it is negative value, into two's complement - * - * @method toTwosComplement - * @param {Number|String|BigNumber} - * @return {BigNumber} - */ -var toTwosComplement = function (number) { - var bigNumber = toBigNumber(number); - if (bigNumber.lessThan(0)) { - return new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).plus(bigNumber).plus(1); - } - return bigNumber; -}; - -/** - * Checks if the given string is strictly an address - * - * @method isStrictAddress - * @param {String} address the given HEX adress - * @return {Boolean} -*/ -var isStrictAddress = function (address) { - return /^0x[0-9a-f]{40}$/.test(address); -}; - -/** - * Checks if the given string is an address - * - * @method isAddress - * @param {String} address the given HEX adress - * @return {Boolean} -*/ -var isAddress = function (address) { - return /^(0x)?[0-9a-f]{40}$/.test(address); -}; - -/** - * Transforms given string to valid 20 bytes-length addres with 0x prefix - * - * @method toAddress - * @param {String} address - * @return {String} formatted address - */ -var toAddress = function (address) { - if (isStrictAddress(address)) { - return address; - } - - if (/^[0-9a-f]{40}$/.test(address)) { - return '0x' + address; - } - - return '0x' + padLeft(toHex(address).substr(2), 40); -}; - -/** - * Returns true if object is BigNumber, otherwise false - * - * @method isBigNumber - * @param {Object} - * @return {Boolean} - */ -var isBigNumber = function (object) { - return object instanceof BigNumber || - (object && object.constructor && object.constructor.name === 'BigNumber'); -}; - -/** - * Returns true if object is string, otherwise false - * - * @method isString - * @param {Object} - * @return {Boolean} - */ -var isString = function (object) { - return typeof object === 'string' || - (object && object.constructor && object.constructor.name === 'String'); -}; - -/** - * Returns true if object is function, otherwise false - * - * @method isFunction - * @param {Object} - * @return {Boolean} - */ -var isFunction = function (object) { - return typeof object === 'function'; -}; - -/** - * Returns true if object is Objet, otherwise false - * - * @method isObject - * @param {Object} - * @return {Boolean} - */ -var isObject = function (object) { - return typeof object === 'object'; -}; - -/** - * Returns true if object is boolean, otherwise false - * - * @method isBoolean - * @param {Object} - * @return {Boolean} - */ -var isBoolean = function (object) { - return typeof object === 'boolean'; -}; - -/** - * Returns true if object is array, otherwise false - * - * @method isArray - * @param {Object} - * @return {Boolean} - */ -var isArray = function (object) { - return object instanceof Array; -}; - -/** - * Returns true if given string is valid json object - * - * @method isJson - * @param {String} - * @return {Boolean} - */ -var isJson = function (str) { - try { - return !!JSON.parse(str); - } catch (e) { - return false; - } -}; - -module.exports = { - padLeft: padLeft, - findIndex: findIndex, - toHex: toHex, - toDecimal: toDecimal, - fromDecimal: fromDecimal, - toAscii: toAscii, - fromAscii: fromAscii, - extractDisplayName: extractDisplayName, - extractTypeName: extractTypeName, - toWei: toWei, - fromWei: fromWei, - toBigNumber: toBigNumber, - toTwosComplement: toTwosComplement, - toAddress: toAddress, - isBigNumber: isBigNumber, - isStrictAddress: isStrictAddress, - isAddress: isAddress, - isFunction: isFunction, - isString: isString, - isObject: isObject, - isBoolean: isBoolean, - isArray: isArray, - isJson: isJson -}; - - -},{"bignumber.js":8}],8:[function(require,module,exports){ -/*! bignumber.js v2.0.7 https://github.com/MikeMcl/bignumber.js/LICENCE */ - -;(function (global) { - 'use strict'; - - /* - bignumber.js v2.0.7 - A JavaScript library for arbitrary-precision arithmetic. - https://github.com/MikeMcl/bignumber.js - Copyright (c) 2015 Michael Mclaughlin - MIT Expat Licence - */ - - - var BigNumber, crypto, parseNumeric, - isNumeric = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, - mathceil = Math.ceil, - mathfloor = Math.floor, - notBool = ' not a boolean or binary digit', - roundingMode = 'rounding mode', - tooManyDigits = 'number type has more than 15 significant digits', - ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_', - BASE = 1e14, - LOG_BASE = 14, - MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 - // MAX_INT32 = 0x7fffffff, // 2^31 - 1 - POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], - SQRT_BASE = 1e7, - - /* - * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and - * the arguments to toExponential, toFixed, toFormat, and toPrecision, beyond which an - * exception is thrown (if ERRORS is true). - */ - MAX = 1E9; // 0 to MAX_INT32 - - - /* - * Create and return a BigNumber constructor. - */ - function another(configObj) { - var div, - - // id tracks the caller function, so its name can be included in error messages. - id = 0, - P = BigNumber.prototype, - ONE = new BigNumber(1), - - - /********************************* EDITABLE DEFAULTS **********************************/ - - - /* - * The default values below must be integers within the inclusive ranges stated. - * The values can also be changed at run-time using BigNumber.config. - */ - - // The maximum number of decimal places for operations involving division. - DECIMAL_PLACES = 20, // 0 to MAX - - /* - * The rounding mode used when rounding to the above decimal places, and when using - * toExponential, toFixed, toFormat and toPrecision, and round (default value). - * UP 0 Away from zero. - * DOWN 1 Towards zero. - * CEIL 2 Towards +Infinity. - * FLOOR 3 Towards -Infinity. - * HALF_UP 4 Towards nearest neighbour. If equidistant, up. - * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. - * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. - * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. - * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. - */ - ROUNDING_MODE = 4, // 0 to 8 - - // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] - - // The exponent value at and beneath which toString returns exponential notation. - // Number type: -7 - TO_EXP_NEG = -7, // 0 to -MAX - - // The exponent value at and above which toString returns exponential notation. - // Number type: 21 - TO_EXP_POS = 21, // 0 to MAX - - // RANGE : [MIN_EXP, MAX_EXP] - - // The minimum exponent value, beneath which underflow to zero occurs. - // Number type: -324 (5e-324) - MIN_EXP = -1e7, // -1 to -MAX - - // The maximum exponent value, above which overflow to Infinity occurs. - // Number type: 308 (1.7976931348623157e+308) - // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. - MAX_EXP = 1e7, // 1 to MAX - - // Whether BigNumber Errors are ever thrown. - ERRORS = true, // true or false - - // Change to intValidatorNoErrors if ERRORS is false. - isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors - - // Whether to use cryptographically-secure random number generation, if available. - CRYPTO = false, // true or false - - /* - * The modulo mode used when calculating the modulus: a mod n. - * The quotient (q = a / n) is calculated according to the corresponding rounding mode. - * The remainder (r) is calculated as: r = a - n * q. - * - * UP 0 The remainder is positive if the dividend is negative, else is negative. - * DOWN 1 The remainder has the same sign as the dividend. - * This modulo mode is commonly known as 'truncated division' and is - * equivalent to (a % n) in JavaScript. - * FLOOR 3 The remainder has the same sign as the divisor (Python %). - * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. - * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). - * The remainder is always positive. - * - * The truncated division, floored division, Euclidian division and IEEE 754 remainder - * modes are commonly used for the modulus operation. - * Although the other rounding modes can also be used, they may not give useful results. - */ - MODULO_MODE = 1, // 0 to 9 - - // The maximum number of significant digits of the result of the toPower operation. - // If POW_PRECISION is 0, there will be unlimited significant digits. - POW_PRECISION = 100, // 0 to MAX - - // The format specification used by the BigNumber.prototype.toFormat method. - FORMAT = { - decimalSeparator: '.', - groupSeparator: ',', - groupSize: 3, - secondaryGroupSize: 0, - fractionGroupSeparator: '\xA0', // non-breaking space - fractionGroupSize: 0 - }; - - - /******************************************************************************************/ - - - // CONSTRUCTOR - - - /* - * The BigNumber constructor and exported function. - * Create and return a new instance of a BigNumber object. - * - * n {number|string|BigNumber} A numeric value. - * [b] {number} The base of n. Integer, 2 to 64 inclusive. - */ - function BigNumber( n, b ) { - var c, e, i, num, len, str, - x = this; - - // Enable constructor usage without new. - if ( !( x instanceof BigNumber ) ) { - - // 'BigNumber() constructor call without new: {n}' - if (ERRORS) raise( 26, 'constructor call without new', n ); - return new BigNumber( n, b ); - } - - // 'new BigNumber() base not an integer: {b}' - // 'new BigNumber() base out of range: {b}' - if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) { - - // Duplicate. - if ( n instanceof BigNumber ) { - x.s = n.s; - x.e = n.e; - x.c = ( n = n.c ) ? n.slice() : n; - id = 0; - return; - } - - if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) { - x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1; - - // Fast path for integers. - if ( n === ~~n ) { - for ( e = 0, i = n; i >= 10; i /= 10, e++ ); - x.e = e; - x.c = [n]; - id = 0; - return; - } - - str = n + ''; - } else { - if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num ); - x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1; - } - } else { - b = b | 0; - str = n + ''; - - // Ensure return value is rounded to DECIMAL_PLACES as with other bases. - // Allow exponential notation to be used with base 10 argument. - if ( b == 10 ) { - x = new BigNumber( n instanceof BigNumber ? n : str ); - return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE ); - } - - // Avoid potential interpretation of Infinity and NaN as base 44+ values. - // Any number in exponential form will fail due to the [Ee][+-]. - if ( ( num = typeof n == 'number' ) && n * 0 != 0 || - !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) + - '(?:\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) { - return parseNumeric( x, str, num, b ); - } - - if (num) { - x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1; - - if ( ERRORS && str.replace( /^0\.0*|\./, '' ).length > 15 ) { - - // 'new BigNumber() number type has more than 15 significant digits: {n}' - raise( id, tooManyDigits, n ); - } - - // Prevent later check for length on converted number. - num = false; - } else { - x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1; - } - - str = convertBase( str, 10, b, x.s ); - } - - // Decimal point? - if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' ); - - // Exponential form? - if ( ( i = str.search( /e/i ) ) > 0 ) { - - // Determine exponent. - if ( e < 0 ) e = i; - e += +str.slice( i + 1 ); - str = str.substring( 0, i ); - } else if ( e < 0 ) { - - // Integer. - e = str.length; - } - - // Determine leading zeros. - for ( i = 0; str.charCodeAt(i) === 48; i++ ); - - // Determine trailing zeros. - for ( len = str.length; str.charCodeAt(--len) === 48; ); - str = str.slice( i, len + 1 ); - - if (str) { - len = str.length; - - // Disallow numbers with over 15 significant digits if number type. - // 'new BigNumber() number type has more than 15 significant digits: {n}' - if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n ); - - e = e - i - 1; - - // Overflow? - if ( e > MAX_EXP ) { - - // Infinity. - x.c = x.e = null; - - // Underflow? - } else if ( e < MIN_EXP ) { - - // Zero. - x.c = [ x.e = 0 ]; - } else { - x.e = e; - x.c = []; - - // Transform base - - // e is the base 10 exponent. - // i is where to slice str to get the first element of the coefficient array. - i = ( e + 1 ) % LOG_BASE; - if ( e < 0 ) i += LOG_BASE; - - if ( i < len ) { - if (i) x.c.push( +str.slice( 0, i ) ); - - for ( len -= LOG_BASE; i < len; ) { - x.c.push( +str.slice( i, i += LOG_BASE ) ); - } - - str = str.slice(i); - i = LOG_BASE - str.length; - } else { - i -= len; - } - - for ( ; i--; str += '0' ); - x.c.push( +str ); - } - } else { - - // Zero. - x.c = [ x.e = 0 ]; - } - - id = 0; - } - - - // CONSTRUCTOR PROPERTIES - - - BigNumber.another = another; - - BigNumber.ROUND_UP = 0; - BigNumber.ROUND_DOWN = 1; - BigNumber.ROUND_CEIL = 2; - BigNumber.ROUND_FLOOR = 3; - BigNumber.ROUND_HALF_UP = 4; - BigNumber.ROUND_HALF_DOWN = 5; - BigNumber.ROUND_HALF_EVEN = 6; - BigNumber.ROUND_HALF_CEIL = 7; - BigNumber.ROUND_HALF_FLOOR = 8; - BigNumber.EUCLID = 9; - - - /* - * Configure infrequently-changing library-wide settings. - * - * Accept an object or an argument list, with one or many of the following properties or - * parameters respectively: - * - * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive - * ROUNDING_MODE {number} Integer, 0 to 8 inclusive - * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or - * [integer -MAX to 0 incl., 0 to MAX incl.] - * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or - * [integer -MAX to -1 incl., integer 1 to MAX incl.] - * ERRORS {boolean|number} true, false, 1 or 0 - * CRYPTO {boolean|number} true, false, 1 or 0 - * MODULO_MODE {number} 0 to 9 inclusive - * POW_PRECISION {number} 0 to MAX inclusive - * FORMAT {object} See BigNumber.prototype.toFormat - * decimalSeparator {string} - * groupSeparator {string} - * groupSize {number} - * secondaryGroupSize {number} - * fractionGroupSeparator {string} - * fractionGroupSize {number} - * - * (The values assigned to the above FORMAT object properties are not checked for validity.) - * - * E.g. - * BigNumber.config(20, 4) is equivalent to - * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) - * - * Ignore properties/parameters set to null or undefined. - * Return an object with the properties current values. - */ - BigNumber.config = function () { - var v, p, - i = 0, - r = {}, - a = arguments, - o = a[0], - has = o && typeof o == 'object' - ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; } - : function () { if ( a.length > i ) return ( v = a[i++] ) != null; }; - - // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. - // 'config() DECIMAL_PLACES not an integer: {v}' - // 'config() DECIMAL_PLACES out of range: {v}' - if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) { - DECIMAL_PLACES = v | 0; - } - r[p] = DECIMAL_PLACES; - - // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. - // 'config() ROUNDING_MODE not an integer: {v}' - // 'config() ROUNDING_MODE out of range: {v}' - if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) { - ROUNDING_MODE = v | 0; - } - r[p] = ROUNDING_MODE; - - // EXPONENTIAL_AT {number|number[]} - // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive]. - // 'config() EXPONENTIAL_AT not an integer: {v}' - // 'config() EXPONENTIAL_AT out of range: {v}' - if ( has( p = 'EXPONENTIAL_AT' ) ) { - - if ( isArray(v) ) { - if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) { - TO_EXP_NEG = v[0] | 0; - TO_EXP_POS = v[1] | 0; - } - } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) { - TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 ); - } - } - r[p] = [ TO_EXP_NEG, TO_EXP_POS ]; - - // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or - // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. - // 'config() RANGE not an integer: {v}' - // 'config() RANGE cannot be zero: {v}' - // 'config() RANGE out of range: {v}' - if ( has( p = 'RANGE' ) ) { - - if ( isArray(v) ) { - if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) { - MIN_EXP = v[0] | 0; - MAX_EXP = v[1] | 0; - } - } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) { - if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 ); - else if (ERRORS) raise( 2, p + ' cannot be zero', v ); - } - } - r[p] = [ MIN_EXP, MAX_EXP ]; - - // ERRORS {boolean|number} true, false, 1 or 0. - // 'config() ERRORS not a boolean or binary digit: {v}' - if ( has( p = 'ERRORS' ) ) { - - if ( v === !!v || v === 1 || v === 0 ) { - id = 0; - isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors; - } else if (ERRORS) { - raise( 2, p + notBool, v ); - } - } - r[p] = ERRORS; - - // CRYPTO {boolean|number} true, false, 1 or 0. - // 'config() CRYPTO not a boolean or binary digit: {v}' - // 'config() crypto unavailable: {crypto}' - if ( has( p = 'CRYPTO' ) ) { - - if ( v === !!v || v === 1 || v === 0 ) { - CRYPTO = !!( v && crypto && typeof crypto == 'object' ); - if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto ); - } else if (ERRORS) { - raise( 2, p + notBool, v ); - } - } - r[p] = CRYPTO; - - // MODULO_MODE {number} Integer, 0 to 9 inclusive. - // 'config() MODULO_MODE not an integer: {v}' - // 'config() MODULO_MODE out of range: {v}' - if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) { - MODULO_MODE = v | 0; - } - r[p] = MODULO_MODE; - - // POW_PRECISION {number} Integer, 0 to MAX inclusive. - // 'config() POW_PRECISION not an integer: {v}' - // 'config() POW_PRECISION out of range: {v}' - if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) { - POW_PRECISION = v | 0; - } - r[p] = POW_PRECISION; - - // FORMAT {object} - // 'config() FORMAT not an object: {v}' - if ( has( p = 'FORMAT' ) ) { - - if ( typeof v == 'object' ) { - FORMAT = v; - } else if (ERRORS) { - raise( 2, p + ' not an object', v ); - } - } - r[p] = FORMAT; - - return r; - }; - - - /* - * Return a new BigNumber whose value is the maximum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.max = function () { return maxOrMin( arguments, P.lt ); }; - - - /* - * Return a new BigNumber whose value is the minimum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.min = function () { return maxOrMin( arguments, P.gt ); }; - - - /* - * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, - * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing - * zeros are produced). - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * - * 'random() decimal places not an integer: {dp}' - * 'random() decimal places out of range: {dp}' - * 'random() crypto unavailable: {crypto}' - */ - BigNumber.random = (function () { - var pow2_53 = 0x20000000000000; - - // Return a 53 bit integer n, where 0 <= n < 9007199254740992. - // Check if Math.random() produces more than 32 bits of randomness. - // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. - // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. - var random53bitInt = (Math.random() * pow2_53) & 0x1fffff - ? function () { return mathfloor( Math.random() * pow2_53 ); } - : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + - (Math.random() * 0x800000 | 0); }; - - return function (dp) { - var a, b, e, k, v, - i = 0, - c = [], - rand = new BigNumber(ONE); - - dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0; - k = mathceil( dp / LOG_BASE ); - - if (CRYPTO) { - - // Browsers supporting crypto.getRandomValues. - if ( crypto && crypto.getRandomValues ) { - - a = crypto.getRandomValues( new Uint32Array( k *= 2 ) ); - - for ( ; i < k; ) { - - // 53 bits: - // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) - // 11111 11111111 11111111 11111111 11100000 00000000 00000000 - // ((Math.pow(2, 32) - 1) >>> 11).toString(2) - // 11111 11111111 11111111 - // 0x20000 is 2^21. - v = a[i] * 0x20000 + (a[i + 1] >>> 11); - - // Rejection sampling: - // 0 <= v < 9007199254740992 - // Probability that v >= 9e15, is - // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 - if ( v >= 9e15 ) { - b = crypto.getRandomValues( new Uint32Array(2) ); - a[i] = b[0]; - a[i + 1] = b[1]; - } else { - - // 0 <= v <= 8999999999999999 - // 0 <= (v % 1e14) <= 99999999999999 - c.push( v % 1e14 ); - i += 2; - } - } - i = k / 2; - - // Node.js supporting crypto.randomBytes. - } else if ( crypto && crypto.randomBytes ) { - - // buffer - a = crypto.randomBytes( k *= 7 ); - - for ( ; i < k; ) { - - // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 - // 0x100000000 is 2^32, 0x1000000 is 2^24 - // 11111 11111111 11111111 11111111 11111111 11111111 11111111 - // 0 <= v < 9007199254740992 - v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) + - ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) + - ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6]; - - if ( v >= 9e15 ) { - crypto.randomBytes(7).copy( a, i ); - } else { - - // 0 <= (v % 1e14) <= 99999999999999 - c.push( v % 1e14 ); - i += 7; - } - } - i = k / 7; - } else if (ERRORS) { - raise( 14, 'crypto unavailable', crypto ); - } - } - - // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false. - if (!i) { - - for ( ; i < k; ) { - v = random53bitInt(); - if ( v < 9e15 ) c[i++] = v % 1e14; - } - } - - k = c[--i]; - dp %= LOG_BASE; - - // Convert trailing digits to zeros according to dp. - if ( k && dp ) { - v = POWS_TEN[LOG_BASE - dp]; - c[i] = mathfloor( k / v ) * v; - } - - // Remove trailing elements which are zero. - for ( ; c[i] === 0; c.pop(), i-- ); - - // Zero? - if ( i < 0 ) { - c = [ e = 0 ]; - } else { - - // Remove leading elements which are zero and adjust exponent accordingly. - for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE); - - // Count the digits of the first element of c to determine leading zeros, and... - for ( i = 1, v = c[0]; v >= 10; v /= 10, i++); - - // adjust the exponent accordingly. - if ( i < LOG_BASE ) e -= LOG_BASE - i; - } - - rand.e = e; - rand.c = c; - return rand; - }; - })(); - - - // PRIVATE FUNCTIONS - - - // Convert a numeric string of baseIn to a numeric string of baseOut. - function convertBase( str, baseOut, baseIn, sign ) { - var d, e, k, r, x, xc, y, - i = str.indexOf( '.' ), - dp = DECIMAL_PLACES, - rm = ROUNDING_MODE; - - if ( baseIn < 37 ) str = str.toLowerCase(); - - // Non-integer. - if ( i >= 0 ) { - k = POW_PRECISION; - - // Unlimited precision. - POW_PRECISION = 0; - str = str.replace( '.', '' ); - y = new BigNumber(baseIn); - x = y.pow( str.length - i ); - POW_PRECISION = k; - - // Convert str as if an integer, then restore the fraction part by dividing the - // result by its base raised to a power. - y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut ); - y.e = y.c.length; - } - - // Convert the number as integer. - xc = toBaseOut( str, baseIn, baseOut ); - e = k = xc.length; - - // Remove trailing zeros. - for ( ; xc[--k] == 0; xc.pop() ); - if ( !xc[0] ) return '0'; - - if ( i < 0 ) { - --e; - } else { - x.c = xc; - x.e = e; - - // sign is needed for correct rounding. - x.s = sign; - x = div( x, y, dp, rm, baseOut ); - xc = x.c; - r = x.r; - e = x.e; - } - - d = e + dp + 1; - - // The rounding digit, i.e. the digit to the right of the digit that may be rounded up. - i = xc[d]; - k = baseOut / 2; - r = r || d < 0 || xc[d + 1] != null; - - r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) ) - : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 || - rm == ( x.s < 0 ? 8 : 7 ) ); - - if ( d < 1 || !xc[0] ) { - - // 1^-dp or 0. - str = r ? toFixedPoint( '1', -dp ) : '0'; - } else { - xc.length = d; - - if (r) { - - // Rounding up may mean the previous digit has to be rounded up and so on. - for ( --baseOut; ++xc[--d] > baseOut; ) { - xc[d] = 0; - - if ( !d ) { - ++e; - xc.unshift(1); - } - } - } - - // Determine trailing zeros. - for ( k = xc.length; !xc[--k]; ); - - // E.g. [4, 11, 15] becomes 4bf. - for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) ); - str = toFixedPoint( str, e ); - } - - // The caller will add the sign. - return str; - } - - - // Perform division in the specified base. Called by div and convertBase. - div = (function () { - - // Assume non-zero x and k. - function multiply( x, k, base ) { - var m, temp, xlo, xhi, - carry = 0, - i = x.length, - klo = k % SQRT_BASE, - khi = k / SQRT_BASE | 0; - - for ( x = x.slice(); i--; ) { - xlo = x[i] % SQRT_BASE; - xhi = x[i] / SQRT_BASE | 0; - m = khi * xlo + xhi * klo; - temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry; - carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi; - x[i] = temp % base; - } - - if (carry) x.unshift(carry); - - return x; - } - - function compare( a, b, aL, bL ) { - var i, cmp; - - if ( aL != bL ) { - cmp = aL > bL ? 1 : -1; - } else { - - for ( i = cmp = 0; i < aL; i++ ) { - - if ( a[i] != b[i] ) { - cmp = a[i] > b[i] ? 1 : -1; - break; - } - } - } - return cmp; - } - - function subtract( a, b, aL, base ) { - var i = 0; - - // Subtract b from a. - for ( ; aL--; ) { - a[aL] -= i; - i = a[aL] < b[aL] ? 1 : 0; - a[aL] = i * base + a[aL] - b[aL]; - } - - // Remove leading zeros. - for ( ; !a[0] && a.length > 1; a.shift() ); - } - - // x: dividend, y: divisor. - return function ( x, y, dp, rm, base ) { - var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, - yL, yz, - s = x.s == y.s ? 1 : -1, - xc = x.c, - yc = y.c; - - // Either NaN, Infinity or 0? - if ( !xc || !xc[0] || !yc || !yc[0] ) { - - return new BigNumber( - - // Return NaN if either NaN, or both Infinity or 0. - !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN : - - // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. - xc && xc[0] == 0 || !yc ? s * 0 : s / 0 - ); - } - - q = new BigNumber(s); - qc = q.c = []; - e = x.e - y.e; - s = dp + e + 1; - - if ( !base ) { - base = BASE; - e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE ); - s = s / LOG_BASE | 0; - } - - // Result exponent may be one less then the current value of e. - // The coefficients of the BigNumbers from convertBase may have trailing zeros. - for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ ); - if ( yc[i] > ( xc[i] || 0 ) ) e--; - - if ( s < 0 ) { - qc.push(1); - more = true; - } else { - xL = xc.length; - yL = yc.length; - i = 0; - s += 2; - - // Normalise xc and yc so highest order digit of yc is >= base / 2. - - n = mathfloor( base / ( yc[0] + 1 ) ); - - // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1. - // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) { - if ( n > 1 ) { - yc = multiply( yc, n, base ); - xc = multiply( xc, n, base ); - yL = yc.length; - xL = xc.length; - } - - xi = yL; - rem = xc.slice( 0, yL ); - remL = rem.length; - - // Add zeros to make remainder as long as divisor. - for ( ; remL < yL; rem[remL++] = 0 ); - yz = yc.slice(); - yz.unshift(0); - yc0 = yc[0]; - if ( yc[1] >= base / 2 ) yc0++; - // Not necessary, but to prevent trial digit n > base, when using base 3. - // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15; - - do { - n = 0; - - // Compare divisor and remainder. - cmp = compare( yc, rem, yL, remL ); - - // If divisor < remainder. - if ( cmp < 0 ) { - - // Calculate trial digit, n. - - rem0 = rem[0]; - if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 ); - - // n is how many times the divisor goes into the current remainder. - n = mathfloor( rem0 / yc0 ); - - // Algorithm: - // 1. product = divisor * trial digit (n) - // 2. if product > remainder: product -= divisor, n-- - // 3. remainder -= product - // 4. if product was < remainder at 2: - // 5. compare new remainder and divisor - // 6. If remainder > divisor: remainder -= divisor, n++ - - if ( n > 1 ) { - - // n may be > base only when base is 3. - if (n >= base) n = base - 1; - - // product = divisor * trial digit. - prod = multiply( yc, n, base ); - prodL = prod.length; - remL = rem.length; - - // Compare product and remainder. - // If product > remainder. - // Trial digit n too high. - // n is 1 too high about 5% of the time, and is not known to have - // ever been more than 1 too high. - while ( compare( prod, rem, prodL, remL ) == 1 ) { - n--; - - // Subtract divisor from product. - subtract( prod, yL < prodL ? yz : yc, prodL, base ); - prodL = prod.length; - cmp = 1; - } - } else { - - // n is 0 or 1, cmp is -1. - // If n is 0, there is no need to compare yc and rem again below, - // so change cmp to 1 to avoid it. - // If n is 1, leave cmp as -1, so yc and rem are compared again. - if ( n == 0 ) { - - // divisor < remainder, so n must be at least 1. - cmp = n = 1; - } - - // product = divisor - prod = yc.slice(); - prodL = prod.length; - } - - if ( prodL < remL ) prod.unshift(0); - - // Subtract product from remainder. - subtract( rem, prod, remL, base ); - remL = rem.length; - - // If product was < remainder. - if ( cmp == -1 ) { - - // Compare divisor and new remainder. - // If divisor < new remainder, subtract divisor from remainder. - // Trial digit n too low. - // n is 1 too low about 5% of the time, and very rarely 2 too low. - while ( compare( yc, rem, yL, remL ) < 1 ) { - n++; - - // Subtract divisor from remainder. - subtract( rem, yL < remL ? yz : yc, remL, base ); - remL = rem.length; - } - } - } else if ( cmp === 0 ) { - n++; - rem = [0]; - } // else cmp === 1 and n will be 0 - - // Add the next digit, n, to the result array. - qc[i++] = n; - - // Update the remainder. - if ( rem[0] ) { - rem[remL++] = xc[xi] || 0; - } else { - rem = [ xc[xi] ]; - remL = 1; - } - } while ( ( xi++ < xL || rem[0] != null ) && s-- ); - - more = rem[0] != null; - - // Leading zero? - if ( !qc[0] ) qc.shift(); - } - - if ( base == BASE ) { - - // To calculate q.e, first get the number of digits of qc[0]. - for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ ); - round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more ); - - // Caller is convertBase. - } else { - q.e = e; - q.r = +more; - } - - return q; - }; - })(); - - - /* - * Return a string representing the value of BigNumber n in fixed-point or exponential - * notation rounded to the specified decimal places or significant digits. - * - * n is a BigNumber. - * i is the index of the last digit required (i.e. the digit that may be rounded up). - * rm is the rounding mode. - * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24. - */ - function format( n, i, rm, caller ) { - var c0, e, ne, len, str; - - rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode ) - ? rm | 0 : ROUNDING_MODE; - - if ( !n.c ) return n.toString(); - c0 = n.c[0]; - ne = n.e; - - if ( i == null ) { - str = coeffToString( n.c ); - str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG - ? toExponential( str, ne ) - : toFixedPoint( str, ne ); - } else { - n = round( new BigNumber(n), i, rm ); - - // n.e may have changed if the value was rounded up. - e = n.e; - - str = coeffToString( n.c ); - len = str.length; - - // toPrecision returns exponential notation if the number of significant digits - // specified is less than the number of digits necessary to represent the integer - // part of the value in fixed-point notation. - - // Exponential notation. - if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) { - - // Append zeros? - for ( ; len < i; str += '0', len++ ); - str = toExponential( str, e ); - - // Fixed-point notation. - } else { - i -= ne; - str = toFixedPoint( str, e ); - - // Append zeros? - if ( e + 1 > len ) { - if ( --i > 0 ) for ( str += '.'; i--; str += '0' ); - } else { - i += e - len; - if ( i > 0 ) { - if ( e + 1 == len ) str += '.'; - for ( ; i--; str += '0' ); - } - } - } - } - - return n.s < 0 && c0 ? '-' + str : str; - } - - - // Handle BigNumber.max and BigNumber.min. - function maxOrMin( args, method ) { - var m, n, - i = 0; - - if ( isArray( args[0] ) ) args = args[0]; - m = new BigNumber( args[0] ); - - for ( ; ++i < args.length; ) { - n = new BigNumber( args[i] ); - - // If any number is NaN, return NaN. - if ( !n.s ) { - m = n; - break; - } else if ( method.call( m, n ) ) { - m = n; - } - } - - return m; - } - - - /* - * Return true if n is an integer in range, otherwise throw. - * Use for argument validation when ERRORS is true. - */ - function intValidatorWithErrors( n, min, max, caller, name ) { - if ( n < min || n > max || n != truncate(n) ) { - raise( caller, ( name || 'decimal places' ) + - ( n < min || n > max ? ' out of range' : ' not an integer' ), n ); - } - - return true; - } - - - /* - * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. - * Called by minus, plus and times. - */ - function normalise( n, c, e ) { - var i = 1, - j = c.length; - - // Remove trailing zeros. - for ( ; !c[--j]; c.pop() ); - - // Calculate the base 10 exponent. First get the number of digits of c[0]. - for ( j = c[0]; j >= 10; j /= 10, i++ ); - - // Overflow? - if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) { - - // Infinity. - n.c = n.e = null; - - // Underflow? - } else if ( e < MIN_EXP ) { - - // Zero. - n.c = [ n.e = 0 ]; - } else { - n.e = e; - n.c = c; - } - - return n; - } - - - // Handle values that fail the validity test in BigNumber. - parseNumeric = (function () { - var basePrefix=/^(-?)0([xbo])/i, - dotAfter=/^([^.]+)\.$/, - dotBefore=/^\.([^.]+)$/, - isInfinityOrNaN=/^-?(Infinity|NaN)$/, - whitespaceOrPlus=/^\s*\+|^\s+|\s+$/g; - - return function ( x, str, num, b ) { - var base, - s = num ? str : str.replace( whitespaceOrPlus, '' ); - - // No exception on ±Infinity or NaN. - if ( isInfinityOrNaN.test(s) ) { - x.s = isNaN(s) ? null : s < 0 ? -1 : 1; - } else { - if ( !num ) { - - // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i - s = s.replace( basePrefix, function ( m, p1, p2 ) { - base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8; - return !b || b == base ? p1 : m; - }); - - if (b) { - base = b; - - // E.g. '1.' to '1', '.1' to '0.1' - s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' ); - } - - if ( str != s ) return new BigNumber( s, base ); - } - - // 'new BigNumber() not a number: {n}' - // 'new BigNumber() not a base {b} number: {n}' - if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str ); - x.s = null; - } - - x.c = x.e = null; - id = 0; - } - })(); - - - // Throw a BigNumber Error. - function raise( caller, msg, val ) { - var error = new Error( [ - 'new BigNumber', // 0 - 'cmp', // 1 - 'config', // 2 - 'div', // 3 - 'divToInt', // 4 - 'eq', // 5 - 'gt', // 6 - 'gte', // 7 - 'lt', // 8 - 'lte', // 9 - 'minus', // 10 - 'mod', // 11 - 'plus', // 12 - 'precision', // 13 - 'random', // 14 - 'round', // 15 - 'shift', // 16 - 'times', // 17 - 'toDigits', // 18 - 'toExponential', // 19 - 'toFixed', // 20 - 'toFormat', // 21 - 'toFraction', // 22 - 'pow', // 23 - 'toPrecision', // 24 - 'toString', // 25 - 'BigNumber' // 26 - ][caller] + '() ' + msg + ': ' + val ); - - error.name = 'BigNumber Error'; - id = 0; - throw error; - } - - - /* - * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. - * If r is truthy, it is known that there are more digits after the rounding digit. - */ - function round( x, sd, rm, r ) { - var d, i, j, k, n, ni, rd, - xc = x.c, - pows10 = POWS_TEN; - - // if x is not Infinity or NaN... - if (xc) { - - // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. - // n is a base 1e14 number, the value of the element of array x.c containing rd. - // ni is the index of n within x.c. - // d is the number of digits of n. - // i is the index of rd within n including leading zeros. - // j is the actual index of rd within n (if < 0, rd is a leading zero). - out: { - - // Get the number of digits of the first element of xc. - for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ ); - i = sd - d; - - // If the rounding digit is in the first element of xc... - if ( i < 0 ) { - i += LOG_BASE; - j = sd; - n = xc[ ni = 0 ]; - - // Get the rounding digit at index j of n. - rd = n / pows10[ d - j - 1 ] % 10 | 0; - } else { - ni = mathceil( ( i + 1 ) / LOG_BASE ); - - if ( ni >= xc.length ) { - - if (r) { - - // Needed by sqrt. - for ( ; xc.length <= ni; xc.push(0) ); - n = rd = 0; - d = 1; - i %= LOG_BASE; - j = i - LOG_BASE + 1; - } else { - break out; - } - } else { - n = k = xc[ni]; - - // Get the number of digits of n. - for ( d = 1; k >= 10; k /= 10, d++ ); - - // Get the index of rd within n. - i %= LOG_BASE; - - // Get the index of rd within n, adjusted for leading zeros. - // The number of leading zeros of n is given by LOG_BASE - d. - j = i - LOG_BASE + d; - - // Get the rounding digit at index j of n. - rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0; - } - } - - r = r || sd < 0 || - - // Are there any non-zero digits after the rounding digit? - // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right - // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. - xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] ); - - r = rm < 4 - ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) ) - : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 && - - // Check whether the digit to the left of the rounding digit is odd. - ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 || - rm == ( x.s < 0 ? 8 : 7 ) ); - - if ( sd < 1 || !xc[0] ) { - xc.length = 0; - - if (r) { - - // Convert sd to decimal places. - sd -= x.e + 1; - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - xc[0] = pows10[ sd % LOG_BASE ]; - x.e = -sd || 0; - } else { - - // Zero. - xc[0] = x.e = 0; - } - - return x; - } - - // Remove excess digits. - if ( i == 0 ) { - xc.length = ni; - k = 1; - ni--; - } else { - xc.length = ni + 1; - k = pows10[ LOG_BASE - i ]; - - // E.g. 56700 becomes 56000 if 7 is the rounding digit. - // j > 0 means i > number of leading zeros of n. - xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0; - } - - // Round up? - if (r) { - - for ( ; ; ) { - - // If the digit to be rounded up is in the first element of xc... - if ( ni == 0 ) { - - // i will be the length of xc[0] before k is added. - for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ ); - j = xc[0] += k; - for ( k = 1; j >= 10; j /= 10, k++ ); - - // if i != k the length has increased. - if ( i != k ) { - x.e++; - if ( xc[0] == BASE ) xc[0] = 1; - } - - break; - } else { - xc[ni] += k; - if ( xc[ni] != BASE ) break; - xc[ni--] = 0; - k = 1; - } - } - } - - // Remove trailing zeros. - for ( i = xc.length; xc[--i] === 0; xc.pop() ); - } - - // Overflow? Infinity. - if ( x.e > MAX_EXP ) { - x.c = x.e = null; - - // Underflow? Zero. - } else if ( x.e < MIN_EXP ) { - x.c = [ x.e = 0 ]; - } - } - - return x; - } - - - // PROTOTYPE/INSTANCE METHODS - - - /* - * Return a new BigNumber whose value is the absolute value of this BigNumber. - */ - P.absoluteValue = P.abs = function () { - var x = new BigNumber(this); - if ( x.s < 0 ) x.s = 1; - return x; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole - * number in the direction of Infinity. - */ - P.ceil = function () { - return round( new BigNumber(this), this.e + 1, 2 ); - }; - - - /* - * Return - * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), - * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), - * 0 if they have the same value, - * or null if the value of either is NaN. - */ - P.comparedTo = P.cmp = function ( y, b ) { - id = 1; - return compare( this, new BigNumber( y, b ) ); - }; - - - /* - * Return the number of decimal places of the value of this BigNumber, or null if the value - * of this BigNumber is ±Infinity or NaN. - */ - P.decimalPlaces = P.dp = function () { - var n, v, - c = this.c; - - if ( !c ) return null; - n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE; - - // Subtract the number of trailing zeros of the last number. - if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- ); - if ( n < 0 ) n = 0; - - return n; - }; - - - /* - * n / 0 = I - * n / N = N - * n / I = 0 - * 0 / n = 0 - * 0 / 0 = N - * 0 / N = N - * 0 / I = 0 - * N / n = N - * N / 0 = N - * N / N = N - * N / I = N - * I / n = I - * I / 0 = I - * I / N = N - * I / I = N - * - * Return a new BigNumber whose value is the value of this BigNumber divided by the value of - * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.dividedBy = P.div = function ( y, b ) { - id = 3; - return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE ); - }; - - - /* - * Return a new BigNumber whose value is the integer part of dividing the value of this - * BigNumber by the value of BigNumber(y, b). - */ - P.dividedToIntegerBy = P.divToInt = function ( y, b ) { - id = 4; - return div( this, new BigNumber( y, b ), 0, 1 ); - }; - - - /* - * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), - * otherwise returns false. - */ - P.equals = P.eq = function ( y, b ) { - id = 5; - return compare( this, new BigNumber( y, b ) ) === 0; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole - * number in the direction of -Infinity. - */ - P.floor = function () { - return round( new BigNumber(this), this.e + 1, 3 ); - }; - - - /* - * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), - * otherwise returns false. - */ - P.greaterThan = P.gt = function ( y, b ) { - id = 6; - return compare( this, new BigNumber( y, b ) ) > 0; - }; - - - /* - * Return true if the value of this BigNumber is greater than or equal to the value of - * BigNumber(y, b), otherwise returns false. - */ - P.greaterThanOrEqualTo = P.gte = function ( y, b ) { - id = 7; - return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0; - - }; - - - /* - * Return true if the value of this BigNumber is a finite number, otherwise returns false. - */ - P.isFinite = function () { - return !!this.c; - }; - - - /* - * Return true if the value of this BigNumber is an integer, otherwise return false. - */ - P.isInteger = P.isInt = function () { - return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2; - }; - - - /* - * Return true if the value of this BigNumber is NaN, otherwise returns false. - */ - P.isNaN = function () { - return !this.s; - }; - - - /* - * Return true if the value of this BigNumber is negative, otherwise returns false. - */ - P.isNegative = P.isNeg = function () { - return this.s < 0; - }; - - - /* - * Return true if the value of this BigNumber is 0 or -0, otherwise returns false. - */ - P.isZero = function () { - return !!this.c && this.c[0] == 0; - }; - - - /* - * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), - * otherwise returns false. - */ - P.lessThan = P.lt = function ( y, b ) { - id = 8; - return compare( this, new BigNumber( y, b ) ) < 0; - }; - - - /* - * Return true if the value of this BigNumber is less than or equal to the value of - * BigNumber(y, b), otherwise returns false. - */ - P.lessThanOrEqualTo = P.lte = function ( y, b ) { - id = 9; - return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0; - }; - - - /* - * n - 0 = n - * n - N = N - * n - I = -I - * 0 - n = -n - * 0 - 0 = 0 - * 0 - N = N - * 0 - I = -I - * N - n = N - * N - 0 = N - * N - N = N - * N - I = N - * I - n = I - * I - 0 = I - * I - N = N - * I - I = N - * - * Return a new BigNumber whose value is the value of this BigNumber minus the value of - * BigNumber(y, b). - */ - P.minus = P.sub = function ( y, b ) { - var i, j, t, xLTy, - x = this, - a = x.s; - - id = 10; - y = new BigNumber( y, b ); - b = y.s; - - // Either NaN? - if ( !a || !b ) return new BigNumber(NaN); - - // Signs differ? - if ( a != b ) { - y.s = -b; - return x.plus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if ( !xe || !ye ) { - - // Either Infinity? - if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN ); - - // Either zero? - if ( !xc[0] || !yc[0] ) { - - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x : - - // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity - ROUNDING_MODE == 3 ? -0 : 0 ); - } - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Determine which is the bigger number. - if ( a = xe - ye ) { - - if ( xLTy = a < 0 ) { - a = -a; - t = xc; - } else { - ye = xe; - t = yc; - } - - t.reverse(); - - // Prepend zeros to equalise exponents. - for ( b = a; b--; t.push(0) ); - t.reverse(); - } else { - - // Exponents equal. Check digit by digit. - j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b; - - for ( a = b = 0; b < j; b++ ) { - - if ( xc[b] != yc[b] ) { - xLTy = xc[b] < yc[b]; - break; - } - } - } - - // x < y? Point xc to the array of the bigger number. - if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s; - - b = ( j = yc.length ) - ( i = xc.length ); - - // Append zeros to xc if shorter. - // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. - if ( b > 0 ) for ( ; b--; xc[i++] = 0 ); - b = BASE - 1; - - // Subtract yc from xc. - for ( ; j > a; ) { - - if ( xc[--j] < yc[j] ) { - for ( i = j; i && !xc[--i]; xc[i] = b ); - --xc[i]; - xc[j] += BASE; - } - - xc[j] -= yc[j]; - } - - // Remove leading zeros and adjust exponent accordingly. - for ( ; xc[0] == 0; xc.shift(), --ye ); - - // Zero? - if ( !xc[0] ) { - - // Following IEEE 754 (2008) 6.3, - // n - n = +0 but n - n = -0 when rounding towards -Infinity. - y.s = ROUNDING_MODE == 3 ? -1 : 1; - y.c = [ y.e = 0 ]; - return y; - } - - // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity - // for finite x and y. - return normalise( y, xc, ye ); - }; - - - /* - * n % 0 = N - * n % N = N - * n % I = n - * 0 % n = 0 - * -0 % n = -0 - * 0 % 0 = N - * 0 % N = N - * 0 % I = 0 - * N % n = N - * N % 0 = N - * N % N = N - * N % I = N - * I % n = N - * I % 0 = N - * I % N = N - * I % I = N - * - * Return a new BigNumber whose value is the value of this BigNumber modulo the value of - * BigNumber(y, b). The result depends on the value of MODULO_MODE. - */ - P.modulo = P.mod = function ( y, b ) { - var q, s, - x = this; - - id = 11; - y = new BigNumber( y, b ); - - // Return NaN if x is Infinity or NaN, or y is NaN or zero. - if ( !x.c || !y.s || y.c && !y.c[0] ) { - return new BigNumber(NaN); - - // Return x if y is Infinity or x is zero. - } else if ( !y.c || x.c && !x.c[0] ) { - return new BigNumber(x); - } - - if ( MODULO_MODE == 9 ) { - - // Euclidian division: q = sign(y) * floor(x / abs(y)) - // r = x - qy where 0 <= r < abs(y) - s = y.s; - y.s = 1; - q = div( x, y, 0, 3 ); - y.s = s; - q.s *= s; - } else { - q = div( x, y, 0, MODULO_MODE ); - } - - return x.minus( q.times(y) ); - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber negated, - * i.e. multiplied by -1. - */ - P.negated = P.neg = function () { - var x = new BigNumber(this); - x.s = -x.s || null; - return x; - }; - - - /* - * n + 0 = n - * n + N = N - * n + I = I - * 0 + n = n - * 0 + 0 = 0 - * 0 + N = N - * 0 + I = I - * N + n = N - * N + 0 = N - * N + N = N - * N + I = N - * I + n = I - * I + 0 = I - * I + N = N - * I + I = I - * - * Return a new BigNumber whose value is the value of this BigNumber plus the value of - * BigNumber(y, b). - */ - P.plus = P.add = function ( y, b ) { - var t, - x = this, - a = x.s; - - id = 12; - y = new BigNumber( y, b ); - b = y.s; - - // Either NaN? - if ( !a || !b ) return new BigNumber(NaN); - - // Signs differ? - if ( a != b ) { - y.s = -b; - return x.minus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if ( !xe || !ye ) { - - // Return ±Infinity if either ±Infinity. - if ( !xc || !yc ) return new BigNumber( a / 0 ); - - // Either zero? - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 ); - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. - if ( a = xe - ye ) { - if ( a > 0 ) { - ye = xe; - t = yc; - } else { - a = -a; - t = xc; - } - - t.reverse(); - for ( ; a--; t.push(0) ); - t.reverse(); - } - - a = xc.length; - b = yc.length; - - // Point xc to the longer array, and b to the shorter length. - if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a; - - // Only start adding at yc.length - 1 as the further digits of xc can be ignored. - for ( a = 0; b; ) { - a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0; - xc[b] %= BASE; - } - - if (a) { - xc.unshift(a); - ++ye; - } - - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - // ye = MAX_EXP + 1 possible - return normalise( y, xc, ye ); - }; - - - /* - * Return the number of significant digits of the value of this BigNumber. - * - * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. - */ - P.precision = P.sd = function (z) { - var n, v, - x = this, - c = x.c; - - // 'precision() argument not a boolean or binary digit: {z}' - if ( z != null && z !== !!z && z !== 1 && z !== 0 ) { - if (ERRORS) raise( 13, 'argument' + notBool, z ); - if ( z != !!z ) z = null; - } - - if ( !c ) return null; - v = c.length - 1; - n = v * LOG_BASE + 1; - - if ( v = c[v] ) { - - // Subtract the number of trailing zeros of the last element. - for ( ; v % 10 == 0; v /= 10, n-- ); - - // Add the number of digits of the first element. - for ( v = c[0]; v >= 10; v /= 10, n++ ); - } - - if ( z && x.e + 1 > n ) n = x.e + 1; - - return n; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of - * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if - * omitted. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'round() decimal places out of range: {dp}' - * 'round() decimal places not an integer: {dp}' - * 'round() rounding mode not an integer: {rm}' - * 'round() rounding mode out of range: {rm}' - */ - P.round = function ( dp, rm ) { - var n = new BigNumber(this); - - if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) { - round( n, ~~dp + this.e + 1, rm == null || - !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 ); - } - - return n; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber shifted by k places - * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. - * - * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. - * - * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity - * otherwise. - * - * 'shift() argument not an integer: {k}' - * 'shift() argument out of range: {k}' - */ - P.shift = function (k) { - var n = this; - return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' ) - - // k < 1e+21, or truncate(k) will produce exponential notation. - ? n.times( '1e' + truncate(k) ) - : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER ) - ? n.s * ( k < 0 ? 0 : 1 / 0 ) - : n ); - }; - - - /* - * sqrt(-n) = N - * sqrt( N) = N - * sqrt(-I) = N - * sqrt( I) = I - * sqrt( 0) = 0 - * sqrt(-0) = -0 - * - * Return a new BigNumber whose value is the square root of the value of this BigNumber, - * rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.squareRoot = P.sqrt = function () { - var m, n, r, rep, t, - x = this, - c = x.c, - s = x.s, - e = x.e, - dp = DECIMAL_PLACES + 4, - half = new BigNumber('0.5'); - - // Negative/NaN/Infinity/zero? - if ( s !== 1 || !c || !c[0] ) { - return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 ); - } - - // Initial estimate. - s = Math.sqrt( +x ); - - // Math.sqrt underflow/overflow? - // Pass x to Math.sqrt as integer, then adjust the exponent of the result. - if ( s == 0 || s == 1 / 0 ) { - n = coeffToString(c); - if ( ( n.length + e ) % 2 == 0 ) n += '0'; - s = Math.sqrt(n); - e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 ); - - if ( s == 1 / 0 ) { - n = '1e' + e; - } else { - n = s.toExponential(); - n = n.slice( 0, n.indexOf('e') + 1 ) + e; - } - - r = new BigNumber(n); - } else { - r = new BigNumber( s + '' ); - } - - // Check for zero. - // r could be zero if MIN_EXP is changed after the this value was created. - // This would cause a division by zero (x/t) and hence Infinity below, which would cause - // coeffToString to throw. - if ( r.c[0] ) { - e = r.e; - s = e + dp; - if ( s < 3 ) s = 0; - - // Newton-Raphson iteration. - for ( ; ; ) { - t = r; - r = half.times( t.plus( div( x, t, dp, 1 ) ) ); - - if ( coeffToString( t.c ).slice( 0, s ) === ( n = - coeffToString( r.c ) ).slice( 0, s ) ) { - - // The exponent of r may here be one less than the final result exponent, - // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits - // are indexed correctly. - if ( r.e < e ) --s; - n = n.slice( s - 3, s + 1 ); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits - // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the - // iteration. - if ( n == '9999' || !rep && n == '4999' ) { - - // On the first iteration only, check to see if rounding up gives the - // exact result as the nines may infinitely repeat. - if ( !rep ) { - round( t, t.e + DECIMAL_PLACES + 2, 0 ); - - if ( t.times(t).eq(x) ) { - r = t; - break; - } - } - - dp += 4; - s += 4; - rep = 1; - } else { - - // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact - // result. If not, then there are further digits and m will be truthy. - if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) { - - // Truncate to the first rounding digit. - round( r, r.e + DECIMAL_PLACES + 2, 1 ); - m = !r.times(r).eq(x); - } - - break; - } - } - } - } - - return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m ); - }; - - - /* - * n * 0 = 0 - * n * N = N - * n * I = I - * 0 * n = 0 - * 0 * 0 = 0 - * 0 * N = N - * 0 * I = N - * N * n = N - * N * 0 = N - * N * N = N - * N * I = N - * I * n = I - * I * 0 = N - * I * N = N - * I * I = I - * - * Return a new BigNumber whose value is the value of this BigNumber times the value of - * BigNumber(y, b). - */ - P.times = P.mul = function ( y, b ) { - var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, - base, sqrtBase, - x = this, - xc = x.c, - yc = ( id = 17, y = new BigNumber( y, b ) ).c; - - // Either NaN, ±Infinity or ±0? - if ( !xc || !yc || !xc[0] || !yc[0] ) { - - // Return NaN if either is NaN, or one is 0 and the other is Infinity. - if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) { - y.c = y.e = y.s = null; - } else { - y.s *= x.s; - - // Return ±Infinity if either is ±Infinity. - if ( !xc || !yc ) { - y.c = y.e = null; - - // Return ±0 if either is ±0. - } else { - y.c = [0]; - y.e = 0; - } - } - - return y; - } - - e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE ); - y.s *= x.s; - xcL = xc.length; - ycL = yc.length; - - // Ensure xc points to longer array and xcL to its length. - if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; - - // Initialise the result array with zeros. - for ( i = xcL + ycL, zc = []; i--; zc.push(0) ); - - base = BASE; - sqrtBase = SQRT_BASE; - - for ( i = ycL; --i >= 0; ) { - c = 0; - ylo = yc[i] % sqrtBase; - yhi = yc[i] / sqrtBase | 0; - - for ( k = xcL, j = i + k; j > i; ) { - xlo = xc[--k] % sqrtBase; - xhi = xc[k] / sqrtBase | 0; - m = yhi * xlo + xhi * ylo; - xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c; - c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi; - zc[j--] = xlo % base; - } - - zc[j] = c; - } - - if (c) { - ++e; - } else { - zc.shift(); - } - - return normalise( y, zc, e ); - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of - * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toDigits() precision out of range: {sd}' - * 'toDigits() precision not an integer: {sd}' - * 'toDigits() rounding mode not an integer: {rm}' - * 'toDigits() rounding mode out of range: {rm}' - */ - P.toDigits = function ( sd, rm ) { - var n = new BigNumber(this); - sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0; - rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0; - return sd ? round( n, sd, rm ) : n; - }; - - - /* - * Return a string representing the value of this BigNumber in exponential notation and - * rounded using ROUNDING_MODE to dp fixed decimal places. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toExponential() decimal places not an integer: {dp}' - * 'toExponential() decimal places out of range: {dp}' - * 'toExponential() rounding mode not an integer: {rm}' - * 'toExponential() rounding mode out of range: {rm}' - */ - P.toExponential = function ( dp, rm ) { - return format( this, - dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 ); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounding - * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', - * but e.g. (-0.00001).toFixed(0) is '-0'. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toFixed() decimal places not an integer: {dp}' - * 'toFixed() decimal places out of range: {dp}' - * 'toFixed() rounding mode not an integer: {rm}' - * 'toFixed() rounding mode out of range: {rm}' - */ - P.toFixed = function ( dp, rm ) { - return format( this, dp != null && isValidInt( dp, 0, MAX, 20 ) - ? ~~dp + this.e + 1 : null, rm, 20 ); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounded - * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties - * of the FORMAT object (see BigNumber.config). - * - * FORMAT = { - * decimalSeparator : '.', - * groupSeparator : ',', - * groupSize : 3, - * secondaryGroupSize : 0, - * fractionGroupSeparator : '\xA0', // non-breaking space - * fractionGroupSize : 0 - * }; - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toFormat() decimal places not an integer: {dp}' - * 'toFormat() decimal places out of range: {dp}' - * 'toFormat() rounding mode not an integer: {rm}' - * 'toFormat() rounding mode out of range: {rm}' - */ - P.toFormat = function ( dp, rm ) { - var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 ) - ? ~~dp + this.e + 1 : null, rm, 21 ); - - if ( this.c ) { - var i, - arr = str.split('.'), - g1 = +FORMAT.groupSize, - g2 = +FORMAT.secondaryGroupSize, - groupSeparator = FORMAT.groupSeparator, - intPart = arr[0], - fractionPart = arr[1], - isNeg = this.s < 0, - intDigits = isNeg ? intPart.slice(1) : intPart, - len = intDigits.length; - - if (g2) i = g1, g1 = g2, g2 = i, len -= i; - - if ( g1 > 0 && len > 0 ) { - i = len % g1 || g1; - intPart = intDigits.substr( 0, i ); - - for ( ; i < len; i += g1 ) { - intPart += groupSeparator + intDigits.substr( i, g1 ); - } - - if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i); - if (isNeg) intPart = '-' + intPart; - } - - str = fractionPart - ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize ) - ? fractionPart.replace( new RegExp( '\\d{' + g2 + '}\\B', 'g' ), - '$&' + FORMAT.fractionGroupSeparator ) - : fractionPart ) - : intPart; - } - - return str; - }; - - - /* - * Return a string array representing the value of this BigNumber as a simple fraction with - * an integer numerator and an integer denominator. The denominator will be a positive - * non-zero value less than or equal to the specified maximum denominator. If a maximum - * denominator is not specified, the denominator will be the lowest value necessary to - * represent the number exactly. - * - * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator. - * - * 'toFraction() max denominator not an integer: {md}' - * 'toFraction() max denominator out of range: {md}' - */ - P.toFraction = function (md) { - var arr, d0, d2, e, exp, n, n0, q, s, - k = ERRORS, - x = this, - xc = x.c, - d = new BigNumber(ONE), - n1 = d0 = new BigNumber(ONE), - d1 = n0 = new BigNumber(ONE); - - if ( md != null ) { - ERRORS = false; - n = new BigNumber(md); - ERRORS = k; - - if ( !( k = n.isInt() ) || n.lt(ONE) ) { - - if (ERRORS) { - raise( 22, - 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md ); - } - - // ERRORS is false: - // If md is a finite non-integer >= 1, round it to an integer and use it. - md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null; - } - } - - if ( !xc ) return x.toString(); - s = coeffToString(xc); - - // Determine initial denominator. - // d is a power of 10 and the minimum max denominator that specifies the value exactly. - e = d.e = s.length - x.e - 1; - d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ]; - md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n; - - exp = MAX_EXP; - MAX_EXP = 1 / 0; - n = new BigNumber(s); - - // n0 = d1 = 0 - n0.c[0] = 0; - - for ( ; ; ) { - q = div( n, d, 0, 1 ); - d2 = d0.plus( q.times(d1) ); - if ( d2.cmp(md) == 1 ) break; - d0 = d1; - d1 = d2; - n1 = n0.plus( q.times( d2 = n1 ) ); - n0 = d2; - d = n.minus( q.times( d2 = d ) ); - n = d2; - } - - d2 = div( md.minus(d0), d1, 0, 1 ); - n0 = n0.plus( d2.times(n1) ); - d0 = d0.plus( d2.times(d1) ); - n0.s = n1.s = x.s; - e *= 2; - - // Determine which fraction is closer to x, n0/d0 or n1/d1 - arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp( - div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1 - ? [ n1.toString(), d1.toString() ] - : [ n0.toString(), d0.toString() ]; - - MAX_EXP = exp; - return arr; - }; - - - /* - * Return the value of this BigNumber converted to a number primitive. - */ - P.toNumber = function () { - var x = this; - - // Ensure zero has correct sign. - return +x || ( x.s ? x.s * 0 : NaN ); - }; - - - /* - * Return a BigNumber whose value is the value of this BigNumber raised to the power n. - * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. - * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE. - * - * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive. - * (Performs 54 loop iterations for n of 9007199254740992.) - * - * 'pow() exponent not an integer: {n}' - * 'pow() exponent out of range: {n}' - */ - P.toPower = P.pow = function (n) { - var k, y, - i = mathfloor( n < 0 ? -n : +n ), - x = this; - - // Pass ±Infinity to Math.pow if exponent is out of range. - if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) && - ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) || - parseFloat(n) != n && !( n = NaN ) ) ) { - return new BigNumber( Math.pow( +x, n ) ); - } - - // Truncating each coefficient array to a length of k after each multiplication equates - // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a - // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.) - k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0; - y = new BigNumber(ONE); - - for ( ; ; ) { - - if ( i % 2 ) { - y = y.times(x); - if ( !y.c ) break; - if ( k && y.c.length > k ) y.c.length = k; - } - - i = mathfloor( i / 2 ); - if ( !i ) break; - - x = x.times(x); - if ( k && x.c && x.c.length > k ) x.c.length = k; - } - - if ( n < 0 ) y = ONE.div(y); - return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y; - }; - - - /* - * Return a string representing the value of this BigNumber rounded to sd significant digits - * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits - * necessary to represent the integer part of the value in fixed-point notation, then use - * exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toPrecision() precision not an integer: {sd}' - * 'toPrecision() precision out of range: {sd}' - * 'toPrecision() rounding mode not an integer: {rm}' - * 'toPrecision() rounding mode out of range: {rm}' - */ - P.toPrecision = function ( sd, rm ) { - return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' ) - ? sd | 0 : null, rm, 24 ); - }; - - - /* - * Return a string representing the value of this BigNumber in base b, or base 10 if b is - * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and - * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent - * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than - * TO_EXP_NEG, return exponential notation. - * - * [b] {number} Integer, 2 to 64 inclusive. - * - * 'toString() base not an integer: {b}' - * 'toString() base out of range: {b}' - */ - P.toString = function (b) { - var str, - n = this, - s = n.s, - e = n.e; - - // Infinity or NaN? - if ( e === null ) { - - if (s) { - str = 'Infinity'; - if ( s < 0 ) str = '-' + str; - } else { - str = 'NaN'; - } - } else { - str = coeffToString( n.c ); - - if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) { - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential( str, e ) - : toFixedPoint( str, e ); - } else { - str = convertBase( toFixedPoint( str, e ), b | 0, 10, s ); - } - - if ( s < 0 && n.c[0] ) str = '-' + str; - } - - return str; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole - * number. - */ - P.truncated = P.trunc = function () { - return round( new BigNumber(this), this.e + 1, 1 ); - }; - - - - /* - * Return as toString, but do not accept a base argument. - */ - P.valueOf = P.toJSON = function () { - return this.toString(); - }; - - - // Aliases for BigDecimal methods. - //P.add = P.plus; // P.add included above - //P.subtract = P.minus; // P.sub included above - //P.multiply = P.times; // P.mul included above - //P.divide = P.div; - //P.remainder = P.mod; - //P.compareTo = P.cmp; - //P.negate = P.neg; - - - if ( configObj != null ) BigNumber.config(configObj); - - return BigNumber; - } - - - // PRIVATE HELPER FUNCTIONS - - - function bitFloor(n) { - var i = n | 0; - return n > 0 || n === i ? i : i - 1; - } - - - // Return a coefficient array as a string of base 10 digits. - function coeffToString(a) { - var s, z, - i = 1, - j = a.length, - r = a[0] + ''; - - for ( ; i < j; ) { - s = a[i++] + ''; - z = LOG_BASE - s.length; - for ( ; z--; s = '0' + s ); - r += s; - } - - // Determine trailing zeros. - for ( j = r.length; r.charCodeAt(--j) === 48; ); - return r.slice( 0, j + 1 || 1 ); - } - - - // Compare the value of BigNumbers x and y. - function compare( x, y ) { - var a, b, - xc = x.c, - yc = y.c, - i = x.s, - j = y.s, - k = x.e, - l = y.e; - - // Either NaN? - if ( !i || !j ) return null; - - a = xc && !xc[0]; - b = yc && !yc[0]; - - // Either zero? - if ( a || b ) return a ? b ? 0 : -j : i; - - // Signs differ? - if ( i != j ) return i; - - a = i < 0; - b = k == l; - - // Either Infinity? - if ( !xc || !yc ) return b ? 0 : !xc ^ a ? 1 : -1; - - // Compare exponents. - if ( !b ) return k > l ^ a ? 1 : -1; - - j = ( k = xc.length ) < ( l = yc.length ) ? k : l; - - // Compare digit by digit. - for ( i = 0; i < j; i++ ) if ( xc[i] != yc[i] ) return xc[i] > yc[i] ^ a ? 1 : -1; - - // Compare lengths. - return k == l ? 0 : k > l ^ a ? 1 : -1; - } - - - /* - * Return true if n is a valid number in range, otherwise false. - * Use for argument validation when ERRORS is false. - * Note: parseInt('1e+1') == 1 but parseFloat('1e+1') == 10. - */ - function intValidatorNoErrors( n, min, max ) { - return ( n = truncate(n) ) >= min && n <= max; - } - - - function isArray(obj) { - return Object.prototype.toString.call(obj) == '[object Array]'; - } - - - /* - * Convert string of baseIn to an array of numbers of baseOut. - * Eg. convertBase('255', 10, 16) returns [15, 15]. - * Eg. convertBase('ff', 16, 10) returns [2, 5, 5]. - */ - function toBaseOut( str, baseIn, baseOut ) { - var j, - arr = [0], - arrL, - i = 0, - len = str.length; - - for ( ; i < len; ) { - for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn ); - arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) ); - - for ( ; j < arr.length; j++ ) { - - if ( arr[j] > baseOut - 1 ) { - if ( arr[j + 1] == null ) arr[j + 1] = 0; - arr[j + 1] += arr[j] / baseOut | 0; - arr[j] %= baseOut; - } - } - } - - return arr.reverse(); - } - - - function toExponential( str, e ) { - return ( str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str ) + - ( e < 0 ? 'e' : 'e+' ) + e; - } - - - function toFixedPoint( str, e ) { - var len, z; - - // Negative exponent? - if ( e < 0 ) { - - // Prepend zeros. - for ( z = '0.'; ++e; z += '0' ); - str = z + str; - - // Positive exponent - } else { - len = str.length; - - // Append zeros. - if ( ++e > len ) { - for ( z = '0', e -= len; --e; z += '0' ); - str += z; - } else if ( e < len ) { - str = str.slice( 0, e ) + '.' + str.slice(e); - } - } - - return str; - } - - - function truncate(n) { - n = parseFloat(n); - return n < 0 ? mathceil(n) : mathfloor(n); - } - - - // EXPORT - - - BigNumber = another(); - - // AMD. - if ( typeof define == 'function' && define.amd ) { - define( function () { return BigNumber; } ); - - // Node and other environments that support module.exports. - } else if ( typeof module != 'undefined' && module.exports ) { - module.exports = BigNumber; - if ( !crypto ) try { crypto = require('crypto'); } catch (e) {} - - // Browser. - } else { - global.BigNumber = BigNumber; - } -})(this); - -},{"crypto":1}],"natspec":[function(require,module,exports){ -/* - This file is part of natspec.js. - - natspec.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - natspec.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with natspec.js. If not, see . -*/ -/** @file natspec.js - * @authors: - * Marek Kotewicz - * @date 2015 - */ - -var abi = require('./node_modules/web3/lib/solidity/abi.js'); - -/** - * This object should be used to evaluate natspec expression - * It has one method evaluateExpression which shoul be used - */ -var natspec = (function () { - /** - * Helper method - * Should be called to copy values from object to global context - * - * @method copyToContext - * @param {Object} object from which we want to copy properties - * @param {Object} object to which we copy - */ - var copyToContext = function (obj, context) { - Object.keys(obj).forEach(function (key) { - context[key] = obj[key]; - }); - } - - /** - * Should be used to generate codes, which will be evaluated - * - * @method generateCode - * @param {Object} object from which code will be generated - * @return {String} javascript code which is used to initalized variables - */ - var generateCode = function (obj) { - return Object.keys(obj).reduce(function (acc, key) { - return acc + "var " + key + " = context['" + key + "'];\n"; - }, ""); - }; - - /** - * Helper method - * Should be called to get method with given name from the abi - * - * @method getMethodWithName - * @param {Array} contract's abi - * @param {String} name of the method that we are looking for - * @return {Object} abi for method with name - */ - var getMethodWithName = function(abi, name) { - return abi.filter(function (method) { - return method.name === name; - })[0]; - }; - - /** - * Should be used to get all contract method input variables - * - * @method getMethodInputParams - * @param {Object} abi for certain method - * @param {Object} transaction object - * @return {Object} object with all contract's method input variables - */ - var getMethodInputParams = function (method, transaction) { - // do it with output formatter (cause we have to decode) - var params = abi.formatOutput(method.inputs, '0x' + transaction.params[0].data.slice(10)); - - return method.inputs.reduce(function (acc, current, index) { - acc[current.name] = params[index]; - return acc; - }, {}); - }; - - /** - * Should be called when we want to evaluate natspec expression - * Replaces all natspec 'subexpressions' with evaluated value - * - * @method mapExpressionToEvaluate - * @param {String} expression to evaluate - * @param {Function} callback which is called to evaluate te expression - * @return {String} evaluated expression - */ - var mapExpressionsToEvaluate = function (expression, cb) { - var evaluatedExpression = ""; - - // match everything in quotes - var pattern = /\` + "`" + `(?:\\.|[^` + "`" + `\\])*\` + "`" + `/gim - var match; - var lastIndex = 0; - try { - while ((match = pattern.exec(expression)) !== null) { - var startIndex = pattern.lastIndex - match[0].length; - var toEval = match[0].slice(1, match[0].length - 1); - evaluatedExpression += expression.slice(lastIndex, startIndex); - var evaluatedPart = cb(toEval); - evaluatedExpression += evaluatedPart; - lastIndex = pattern.lastIndex; - } - - evaluatedExpression += expression.slice(lastIndex); - } - catch (err) { - throw new Error("Natspec evaluation failed, wrong input params"); - } - - return evaluatedExpression; - }; - - /** - * Should be called to evaluate single expression - * Is internally using javascript's 'eval' method - * - * @method evaluateExpression - * @param {String} expression which should be evaluated - * @param {Object} [call] object containing contract abi, transaction, called method - * @return {String} evaluated expression - * @throws exception if method is not found or we are trying to evaluate input params that does not exists - */ - - var utils = require('../utils/utils'); - - var evaluateExpression = function (expression, call) { - //var self = this; - var context = {}; - - if (!!call) { - try { - var method = getMethodWithName(call.abi, call.method); - var params = getMethodInputParams(method, call.transaction); - copyToContext(params, context); - } - catch (err) { - throw new Error("Natspec evaluation failed, method does not exist"); - } - } - - var code = generateCode(context); - - var evaluatedExpression = mapExpressionsToEvaluate(expression, function (toEval) { - //var fn = new Function("context", "toHex", code + "return " + toEval + ";"); - //return fn(context, toHex).toString(); - var fn = new Function("context", "utils", code + "return " + toEval + ";"); - return fn(context, utils).toString(); - }); - - return evaluatedExpression; - }; - - /** - * Safe version of evaluateExpression - * Instead of throwing an exception it returns it as a string - * - * @method evaluateExpressionSafe - * @param {String} expression which should be evaluated - * @param {Object} [call] object containing contract abi, transaction, called method - * @return {String} evaluated expression - */ - var evaluateExpressionSafe = function (expression, call) { - try { - return evaluateExpression(expression, call); - } - catch (err) { - return err.message; - } - }; - - return { - evaluateExpression: evaluateExpression, - evaluateExpressionSafe: evaluateExpressionSafe - }; - -})(); - -module.exports = natspec; - - -},{"./node_modules/web3/lib/solidity/abi.js":2,"../utils/utils":7}]},{},[]); -` - -//# sourceMappingURL=natspec.js.map` diff --git a/common/natspec/natspec_test.go b/common/natspec/natspec_test.go deleted file mode 100644 index 50fd3f6651..0000000000 --- a/common/natspec/natspec_test.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build ignore - -package natspec - -import ( - "testing" -) - -func makeInfoDoc(desc string) []byte { - return []byte(` -{ - "source": "contract test { }", - "language": "Solidity", - "compilerVersion": "1", - "userDoc": { - "methods": { - "multiply(uint256)": { - "notice": "` + desc + `" - }, - "balance(address)": { - "notice": "` + "`(balanceInmGAV / 1000).fixed(0,3)`" + ` GAV is the total funds available to ` + "`who.address()`." + `" - } - }, - "invariants": [ - { "notice": "The sum total amount of GAV in the system is 1 million." } - ], - "construction": [ - { "notice": "Endows ` + "`message.caller.address()`" + ` with 1m GAV." } - ] - }, - "abiDefinition": [{ - "name": "multiply", - "constant": false, - "type": "function", - "inputs": [{ - "name": "a", - "type": "uint256" - }], - "outputs": [{ - "name": "d", - "type": "uint256" - }] - }] -}`) -} - -var data = "0xc6888fa1000000000000000000000000000000000000000000000000000000000000007a" - -var tx = ` -{ - "params": [{ - "to": "0x8521742d3f456bd237e312d6e30724960f72517a", - "data": "0xc6888fa1000000000000000000000000000000000000000000000000000000000000007a" - }], -} -` - -func TestNotice(t *testing.T) { - - desc := "Will multiply `a` by 7 and return `a * 7`." - expected := "Will multiply 122 by 7 and return 854." - - infodoc := makeInfoDoc(desc) - ns, err := NewWithDocs(infodoc, tx, data) - if err != nil { - t.Errorf("New: error: %v", err) - return - } - - notice, err := ns.Notice() - - if err != nil { - t.Errorf("expected no error, got %v", err) - } - - if notice != expected { - t.Errorf("incorrect notice. expected %v, got %v", expected, notice) - } -} - -// test missing method -func TestMissingMethod(t *testing.T) { - - desc := "Will multiply `a` by 7 and return `a * 7`." - expected := "natspec.js error evaluating expression: Natspec evaluation failed, method does not exist" - - infodoc := makeInfoDoc(desc) - ns, err := NewWithDocs(infodoc, tx, data) - if err != nil { - t.Errorf("New: error: %v", err) - } - - notice, err := ns.noticeForMethod(tx, "missing_method", "") - - if err == nil { - t.Errorf("expected error, got nothing (notice: '%v')", notice) - } else { - if err.Error() != expected { - t.Errorf("expected error '%s' got '%v' (notice: '%v')", expected, err, notice) - } - } -} - -// test invalid desc - -func TestInvalidDesc(t *testing.T) { - - desc := "Will multiply 122 by \"7\" and return 854." - expected := "invalid character '7' after object key:value pair" - - infodoc := makeInfoDoc(desc) - _, err := NewWithDocs(infodoc, tx, data) - if err == nil { - t.Errorf("expected error, got nothing", err) - } else { - if err.Error() != expected { - t.Errorf("expected error '%s' got '%v'", expected, err) - } - } -} - -// test wrong input params -func TestWrongInputParams(t *testing.T) { - - desc := "Will multiply `e` by 7 and return `a * 7`." - expected := "natspec.js error evaluating expression: Natspec evaluation failed, wrong input params" - - infodoc := makeInfoDoc(desc) - ns, err := NewWithDocs(infodoc, tx, data) - if err != nil { - t.Errorf("New: error: %v", err) - } - - notice, err := ns.Notice() - - if err == nil { - t.Errorf("expected error, got nothing (notice: '%v')", notice) - } else { - if err.Error() != expected { - t.Errorf("expected error '%s' got '%v' (notice: '%v')", expected, err, notice) - } - } - -} diff --git a/eth/api.go b/eth/api.go index c2fdbe99c2..48f512b1b4 100644 --- a/eth/api.go +++ b/eth/api.go @@ -102,7 +102,7 @@ func (s *PublicMinerAPI) SubmitWork(nonce rpc.HexNumber, solution, digest common // result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty func (s *PublicMinerAPI) GetWork() (work [3]string, err error) { if !s.e.IsMining() { - if err := s.e.StartMining(0, ""); err != nil { + if err := s.e.StartMining(0); err != nil { return work, err } } @@ -141,7 +141,7 @@ func (s *PrivateMinerAPI) Start(threads *rpc.HexNumber) (bool, error) { threads = rpc.NewHexNumber(runtime.NumCPU()) } - err := s.e.StartMining(threads.Int(), "") + err := s.e.StartMining(threads.Int()) if err == nil { return true, nil } diff --git a/eth/backend.go b/eth/backend.go index c4a883c9e9..24419d6d8f 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -362,6 +362,17 @@ func (self *Ethereum) SetEtherbase(etherbase common.Address) { self.miner.SetEtherbase(etherbase) } +func (s *Ethereum) StartMining(threads int) error { + eb, err := s.Etherbase() + if err != nil { + err = fmt.Errorf("Cannot start mining without etherbase address: %v", err) + glog.V(logger.Error).Infoln(err) + return err + } + go s.miner.Start(eb, threads) + return nil +} + func (s *Ethereum) StopMining() { s.miner.Stop() } func (s *Ethereum) IsMining() bool { return s.miner.Mining() } func (s *Ethereum) Miner() *miner.Miner { return s.miner } diff --git a/eth/cpu_mining.go b/eth/cpu_mining.go deleted file mode 100644 index 3469d394e9..0000000000 --- a/eth/cpu_mining.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build !opencl - -package eth - -import ( - "errors" - "fmt" - - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" -) - -const disabledInfo = "Set GO_OPENCL and re-build to enable." - -func (s *Ethereum) StartMining(threads int, gpus string) error { - eb, err := s.Etherbase() - if err != nil { - err = fmt.Errorf("Cannot start mining without etherbase address: %v", err) - glog.V(logger.Error).Infoln(err) - return err - } - - if gpus != "" { - return errors.New("GPU mining disabled. " + disabledInfo) - } - - // CPU mining - go s.miner.Start(eb, threads) - return nil -} - -func GPUBench(gpuid uint64) { - fmt.Println("GPU mining disabled. " + disabledInfo) -} - -func PrintOpenCLDevices() { - fmt.Println("OpenCL disabled. " + disabledInfo) -} diff --git a/eth/gpu_mining.go b/eth/gpu_mining.go deleted file mode 100644 index 12fa746018..0000000000 --- a/eth/gpu_mining.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build opencl - -package eth - -import ( - "fmt" - "math/big" - "strconv" - "strings" - "time" - - "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/miner" -) - -func (s *Ethereum) StartMining(threads int, gpus string) error { - eb, err := s.Etherbase() - if err != nil { - err = fmt.Errorf("Cannot start mining without etherbase address: %v", err) - glog.V(logger.Error).Infoln(err) - return err - } - - // GPU mining - if gpus != "" { - var ids []int - for _, s := range strings.Split(gpus, ",") { - i, err := strconv.Atoi(s) - if err != nil { - return fmt.Errorf("Invalid GPU id(s): %v", err) - } - if i < 0 { - return fmt.Errorf("Invalid GPU id: %v", i) - } - ids = append(ids, i) - } - - // TODO: re-creating miner is a bit ugly - s.miner = miner.New(s, s.chainConfig, s.EventMux(), ethash.NewCL(ids)) - go s.miner.Start(eb, len(ids)) - return nil - } - - // CPU mining - go s.miner.Start(eb, threads) - return nil -} - -func GPUBench(gpuid uint64) { - e := ethash.NewCL([]int{int(gpuid)}) - - var h common.Hash - bogoHeader := &types.Header{ - ParentHash: h, - Number: big.NewInt(int64(42)), - Difficulty: big.NewInt(int64(999999999999999)), - } - bogoBlock := types.NewBlock(bogoHeader, nil, nil, nil) - - err := ethash.InitCL(bogoBlock.NumberU64(), e) - if err != nil { - fmt.Println("OpenCL init error: ", err) - return - } - - stopChan := make(chan struct{}) - reportHashRate := func() { - for { - time.Sleep(3 * time.Second) - fmt.Printf("hashes/s : %v\n", e.GetHashrate()) - } - } - fmt.Printf("Starting benchmark (%v seconds)\n", 60) - go reportHashRate() - go e.Search(bogoBlock, stopChan, 0) - time.Sleep(60 * time.Second) - fmt.Println("OK.") -} - -func PrintOpenCLDevices() { - ethash.PrintDevices() -} diff --git a/internal/build/util.go b/internal/build/util.go index be41efed75..a821cd7f23 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -55,15 +55,14 @@ func GOPATH() string { if len(path) == 0 { log.Fatal("GOPATH is not set") } - // Ensure Godeps workspace is present in the path. - godeps, _ := filepath.Abs(filepath.Join("Godeps", "_workspace")) + // Ensure that our internal vendor folder in on GOPATH + vendor, _ := filepath.Abs(filepath.Join("build", "_vendor")) for _, dir := range path { - if dir == godeps { + if dir == vendor { return strings.Join(path, string(filepath.ListSeparator)) } } - newpath := append(path[:1], godeps) - newpath = append(newpath, path[1:]...) + newpath := append(path[:1], append([]string{vendor}, path[1:]...)...) return strings.Join(newpath, string(filepath.ListSeparator)) } diff --git a/vendor.conf b/vendor.conf new file mode 100644 index 0000000000..58837ee383 --- /dev/null +++ b/vendor.conf @@ -0,0 +1,40 @@ +# package +github.com/ethereum/go-ethereum + +# import +github.com/cespare/cp 165db2f +github.com/davecgh/go-spew v1.0.0-3-g6d21280 +github.com/ethereum/ethash v23.1-249-g214d4c0 +github.com/fatih/color v1.1.0-4-gbf82308 +github.com/gizak/termui d29684e +github.com/golang/snappy d9eb7a3 +github.com/hashicorp/golang-lru 0a025b7 +github.com/huin/goupnp 97f671e +github.com/jackpal/go-nat-pmp v1.0.1-4-g1fa385a +github.com/mattn/go-colorable v0.0.6-6-g6c903ff +github.com/mattn/go-isatty 66b8e73 +github.com/mattn/go-runewidth v0.0.1-10-g737072b +github.com/mitchellh/go-wordwrap ad45545 +github.com/nsf/termbox-go b6acae5 +github.com/pborman/uuid v1.0-17-g3d4f2ba +github.com/peterh/liner 8975875 +github.com/rcrowley/go-metrics ab2277b +github.com/rjeczalik/notify 7e20c15 +github.com/robertkrimen/otto bf1c379 +github.com/rs/cors v1.0 +github.com/rs/xhandler v1.0-1-ged27b6f +github.com/syndtr/goleveldb 6b4daa5 +golang.org/x/crypto ca7e7f1 +golang.org/x/net b336a97 +golang.org/x/sys c200b10 +golang.org/x/text a8b3843 +golang.org/x/tools 0db92ca +gopkg.in/check.v1 4f90aea +gopkg.in/fatih/set.v0 v0.1.0-3-g27c4092 +gopkg.in/karalabe/cookiejar.v2 8dcd6a7 +gopkg.in/natefinch/npipe.v2 c1b8fa8 +gopkg.in/sourcemap.v1 v1.0.3 +gopkg.in/urfave/cli.v1 v1.18.1 + +# exclude +-golang.org/x/net/context diff --git a/Godeps/_workspace/src/github.com/cespare/cp/LICENSE.txt b/vendor/github.com/cespare/cp/LICENSE.txt similarity index 100% rename from Godeps/_workspace/src/github.com/cespare/cp/LICENSE.txt rename to vendor/github.com/cespare/cp/LICENSE.txt diff --git a/Godeps/_workspace/src/github.com/cespare/cp/README.md b/vendor/github.com/cespare/cp/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/cespare/cp/README.md rename to vendor/github.com/cespare/cp/README.md diff --git a/Godeps/_workspace/src/github.com/cespare/cp/cp.go b/vendor/github.com/cespare/cp/cp.go similarity index 100% rename from Godeps/_workspace/src/github.com/cespare/cp/cp.go rename to vendor/github.com/cespare/cp/cp.go diff --git a/Godeps/_workspace/src/gopkg.in/natefinch/npipe.v2/.gitignore b/vendor/github.com/davecgh/go-spew/.gitignore similarity index 100% rename from Godeps/_workspace/src/gopkg.in/natefinch/npipe.v2/.gitignore rename to vendor/github.com/davecgh/go-spew/.gitignore diff --git a/vendor/github.com/davecgh/go-spew/.travis.yml b/vendor/github.com/davecgh/go-spew/.travis.yml new file mode 100644 index 0000000000..984e0736e7 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/.travis.yml @@ -0,0 +1,14 @@ +language: go +go: + - 1.5.4 + - 1.6.3 + - 1.7 +install: + - go get -v golang.org/x/tools/cmd/cover +script: + - go test -v -tags=safe ./spew + - go test -v -tags=testcgo ./spew -covermode=count -coverprofile=profile.cov +after_success: + - go get -v github.com/mattn/goveralls + - export PATH=$PATH:$HOME/gopath/bin + - goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE similarity index 98% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/LICENSE rename to vendor/github.com/davecgh/go-spew/LICENSE index 2a7cfd2bf6..bb67332310 100644 --- a/Godeps/_workspace/src/github.com/davecgh/go-spew/LICENSE +++ b/vendor/github.com/davecgh/go-spew/LICENSE @@ -1,3 +1,5 @@ +ISC License + Copyright (c) 2012-2013 Dave Collins Permission to use, copy, modify, and distribute this software for any diff --git a/vendor/github.com/davecgh/go-spew/README.md b/vendor/github.com/davecgh/go-spew/README.md new file mode 100644 index 0000000000..556170ae63 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/README.md @@ -0,0 +1,194 @@ +go-spew +======= + +[![Build Status](https://travis-ci.org/davecgh/go-spew.png?branch=master)] +(https://travis-ci.org/davecgh/go-spew) [![Coverage Status] +(https://coveralls.io/repos/davecgh/go-spew/badge.png?branch=master)] +(https://coveralls.io/r/davecgh/go-spew?branch=master) + +Go-spew implements a deep pretty printer for Go data structures to aid in +debugging. A comprehensive suite of tests with 100% test coverage is provided +to ensure proper functionality. See `test_coverage.txt` for the gocov coverage +report. Go-spew is licensed under the liberal ISC license, so it may be used in +open source or commercial projects. + +If you're interested in reading about how this package came to life and some +of the challenges involved in providing a deep pretty printer, there is a blog +post about it +[here](https://web.archive.org/web/20160304013555/https://blog.cyphertite.com/go-spew-a-journey-into-dumping-go-data-structures/). + +## Documentation + +[![GoDoc](https://godoc.org/github.com/davecgh/go-spew/spew?status.png)] +(http://godoc.org/github.com/davecgh/go-spew/spew) + +Full `go doc` style documentation for the project can be viewed online without +installing this package by using the excellent GoDoc site here: +http://godoc.org/github.com/davecgh/go-spew/spew + +You can also view the documentation locally once the package is installed with +the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to +http://localhost:6060/pkg/github.com/davecgh/go-spew/spew + +## Installation + +```bash +$ go get -u github.com/davecgh/go-spew/spew +``` + +## Quick Start + +Add this import line to the file you're working in: + +```Go +import "github.com/davecgh/go-spew/spew" +``` + +To dump a variable with full newlines, indentation, type, and pointer +information use Dump, Fdump, or Sdump: + +```Go +spew.Dump(myVar1, myVar2, ...) +spew.Fdump(someWriter, myVar1, myVar2, ...) +str := spew.Sdump(myVar1, myVar2, ...) +``` + +Alternatively, if you would prefer to use format strings with a compacted inline +printing style, use the convenience wrappers Printf, Fprintf, etc with %v (most +compact), %+v (adds pointer addresses), %#v (adds types), or %#+v (adds types +and pointer addresses): + +```Go +spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) +spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) +spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) +spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) +``` + +## Debugging a Web Application Example + +Here is an example of how you can use `spew.Sdump()` to help debug a web application. Please be sure to wrap your output using the `html.EscapeString()` function for safety reasons. You should also only use this debugging technique in a development environment, never in production. + +```Go +package main + +import ( + "fmt" + "html" + "net/http" + + "github.com/davecgh/go-spew/spew" +) + +func handler(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/html") + fmt.Fprintf(w, "Hi there, %s!", r.URL.Path[1:]) + fmt.Fprintf(w, "") +} + +func main() { + http.HandleFunc("/", handler) + http.ListenAndServe(":8080", nil) +} +``` + +## Sample Dump Output + +``` +(main.Foo) { + unexportedField: (*main.Bar)(0xf84002e210)({ + flag: (main.Flag) flagTwo, + data: (uintptr) + }), + ExportedField: (map[interface {}]interface {}) { + (string) "one": (bool) true + } +} +([]uint8) { + 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | + 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| + 00000020 31 32 |12| +} +``` + +## Sample Formatter Output + +Double pointer to a uint8: +``` + %v: <**>5 + %+v: <**>(0xf8400420d0->0xf8400420c8)5 + %#v: (**uint8)5 + %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 +``` + +Pointer to circular struct with a uint8 field and a pointer to itself: +``` + %v: <*>{1 <*>} + %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} + %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} + %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} +``` + +## Configuration Options + +Configuration of spew is handled by fields in the ConfigState type. For +convenience, all of the top-level functions use a global state available via the +spew.Config global. + +It is also possible to create a ConfigState instance that provides methods +equivalent to the top-level functions. This allows concurrent configuration +options. See the ConfigState documentation for more details. + +``` +* Indent + String to use for each indentation level for Dump functions. + It is a single space by default. A popular alternative is "\t". + +* MaxDepth + Maximum number of levels to descend into nested data structures. + There is no limit by default. + +* DisableMethods + Disables invocation of error and Stringer interface methods. + Method invocation is enabled by default. + +* DisablePointerMethods + Disables invocation of error and Stringer interface methods on types + which only accept pointer receivers from non-pointer variables. This option + relies on access to the unsafe package, so it will not have any effect when + running in environments without access to the unsafe package such as Google + App Engine or with the "safe" build tag specified. + Pointer method invocation is enabled by default. + +* ContinueOnMethod + Enables recursion into types after invoking error and Stringer interface + methods. Recursion after method invocation is disabled by default. + +* SortKeys + Specifies map keys should be sorted before being printed. Use + this to have a more deterministic, diffable output. Note that + only native types (bool, int, uint, floats, uintptr and string) + and types which implement error or Stringer interfaces are supported, + with other types sorted according to the reflect.Value.String() output + which guarantees display stability. Natural map order is used by + default. + +* SpewKeys + SpewKeys specifies that, as a last resort attempt, map keys should be + spewed to strings and sorted by those strings. This is only considered + if SortKeys is true. + +``` + +## Unsafe Package Dependency + +This package relies on the unsafe package to perform some of the more advanced +features, however it also supports a "limited" mode which allows it to work in +environments where the unsafe package is not available. By default, it will +operate in this mode on Google App Engine and when compiled with GopherJS. The +"safe" build tag may also be specified to force the package to build without +using the unsafe package. + +## License + +Go-spew is licensed under the liberal ISC License. diff --git a/vendor/github.com/davecgh/go-spew/cov_report.sh b/vendor/github.com/davecgh/go-spew/cov_report.sh new file mode 100644 index 0000000000..9579497e41 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/cov_report.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This script uses gocov to generate a test coverage report. +# The gocov tool my be obtained with the following command: +# go get github.com/axw/gocov/gocov +# +# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. + +# Check for gocov. +if ! type gocov >/dev/null 2>&1; then + echo >&2 "This script requires the gocov tool." + echo >&2 "You may obtain it with the following command:" + echo >&2 "go get github.com/axw/gocov/gocov" + exit 1 +fi + +# Only run the cgo tests if gcc is installed. +if type gcc >/dev/null 2>&1; then + (cd spew && gocov test -tags testcgo | gocov report) +else + (cd spew && gocov test | gocov report) +fi diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go similarity index 95% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/spew/bypass.go rename to vendor/github.com/davecgh/go-spew/spew/bypass.go index 565bf5899f..d42a0bc4af 100644 --- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/bypass.go +++ b/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -13,9 +13,10 @@ // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // NOTE: Due to the following build constraints, this file will only be compiled -// when the code is not running on Google App Engine and "-tags disableunsafe" -// is not added to the go build command line. -// +build !appengine,!disableunsafe +// when the code is not running on Google App Engine, compiled by GopherJS, and +// "-tags safe" is not added to the go build command line. The "disableunsafe" +// tag is deprecated and thus should not be used. +// +build !js,!appengine,!safe,!disableunsafe package spew diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go similarity index 85% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/spew/bypasssafe.go rename to vendor/github.com/davecgh/go-spew/spew/bypasssafe.go index 457e41235e..e47a4e7951 100644 --- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/bypasssafe.go +++ b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -13,9 +13,10 @@ // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // NOTE: Due to the following build constraints, this file will only be compiled -// when either the code is running on Google App Engine or "-tags disableunsafe" -// is added to the go build command line. -// +build appengine disableunsafe +// when the code is running on Google App Engine, compiled by GopherJS, or +// "-tags safe" is added to the go build command line. The "disableunsafe" +// tag is deprecated and thus should not be used. +// +build js appengine safe disableunsafe package spew diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go similarity index 100% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/spew/common.go rename to vendor/github.com/davecgh/go-spew/spew/common.go diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go similarity index 99% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/spew/config.go rename to vendor/github.com/davecgh/go-spew/spew/config.go index ee1ab07b3f..5552827238 100644 --- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/config.go +++ b/vendor/github.com/davecgh/go-spew/spew/config.go @@ -64,7 +64,7 @@ type ConfigState struct { // inside these interface methods. As a result, this option relies on // access to the unsafe package, so it will not have any effect when // running in environments without access to the unsafe package such as - // Google App Engine or with the "disableunsafe" build tag specified. + // Google App Engine or with the "safe" build tag specified. DisablePointerMethods bool // ContinueOnMethod specifies whether or not recursion should continue once diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go similarity index 100% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/spew/doc.go rename to vendor/github.com/davecgh/go-spew/spew/doc.go diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go similarity index 100% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dump.go rename to vendor/github.com/davecgh/go-spew/spew/dump.go diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go similarity index 100% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/spew/format.go rename to vendor/github.com/davecgh/go-spew/spew/format.go diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go similarity index 100% rename from Godeps/_workspace/src/github.com/davecgh/go-spew/spew/spew.go rename to vendor/github.com/davecgh/go-spew/spew/spew.go diff --git a/vendor/github.com/davecgh/go-spew/test_coverage.txt b/vendor/github.com/davecgh/go-spew/test_coverage.txt new file mode 100644 index 0000000000..2cd087a2a1 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/test_coverage.txt @@ -0,0 +1,61 @@ + +github.com/davecgh/go-spew/spew/dump.go dumpState.dump 100.00% (88/88) +github.com/davecgh/go-spew/spew/format.go formatState.format 100.00% (82/82) +github.com/davecgh/go-spew/spew/format.go formatState.formatPtr 100.00% (52/52) +github.com/davecgh/go-spew/spew/dump.go dumpState.dumpPtr 100.00% (44/44) +github.com/davecgh/go-spew/spew/dump.go dumpState.dumpSlice 100.00% (39/39) +github.com/davecgh/go-spew/spew/common.go handleMethods 100.00% (30/30) +github.com/davecgh/go-spew/spew/common.go printHexPtr 100.00% (18/18) +github.com/davecgh/go-spew/spew/common.go unsafeReflectValue 100.00% (13/13) +github.com/davecgh/go-spew/spew/format.go formatState.constructOrigFormat 100.00% (12/12) +github.com/davecgh/go-spew/spew/dump.go fdump 100.00% (11/11) +github.com/davecgh/go-spew/spew/format.go formatState.Format 100.00% (11/11) +github.com/davecgh/go-spew/spew/common.go init 100.00% (10/10) +github.com/davecgh/go-spew/spew/common.go printComplex 100.00% (9/9) +github.com/davecgh/go-spew/spew/common.go valuesSorter.Less 100.00% (8/8) +github.com/davecgh/go-spew/spew/format.go formatState.buildDefaultFormat 100.00% (7/7) +github.com/davecgh/go-spew/spew/format.go formatState.unpackValue 100.00% (5/5) +github.com/davecgh/go-spew/spew/dump.go dumpState.indent 100.00% (4/4) +github.com/davecgh/go-spew/spew/common.go catchPanic 100.00% (4/4) +github.com/davecgh/go-spew/spew/config.go ConfigState.convertArgs 100.00% (4/4) +github.com/davecgh/go-spew/spew/spew.go convertArgs 100.00% (4/4) +github.com/davecgh/go-spew/spew/format.go newFormatter 100.00% (3/3) +github.com/davecgh/go-spew/spew/dump.go Sdump 100.00% (3/3) +github.com/davecgh/go-spew/spew/common.go printBool 100.00% (3/3) +github.com/davecgh/go-spew/spew/common.go sortValues 100.00% (3/3) +github.com/davecgh/go-spew/spew/config.go ConfigState.Sdump 100.00% (3/3) +github.com/davecgh/go-spew/spew/dump.go dumpState.unpackValue 100.00% (3/3) +github.com/davecgh/go-spew/spew/spew.go Printf 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Println 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Sprint 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Sprintf 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Sprintln 100.00% (1/1) +github.com/davecgh/go-spew/spew/common.go printFloat 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go NewDefaultConfig 100.00% (1/1) +github.com/davecgh/go-spew/spew/common.go printInt 100.00% (1/1) +github.com/davecgh/go-spew/spew/common.go printUint 100.00% (1/1) +github.com/davecgh/go-spew/spew/common.go valuesSorter.Len 100.00% (1/1) +github.com/davecgh/go-spew/spew/common.go valuesSorter.Swap 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Errorf 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Fprint 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Fprintf 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Fprintln 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Print 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Printf 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Println 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Sprint 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Sprintf 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Sprintln 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.NewFormatter 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Fdump 100.00% (1/1) +github.com/davecgh/go-spew/spew/config.go ConfigState.Dump 100.00% (1/1) +github.com/davecgh/go-spew/spew/dump.go Fdump 100.00% (1/1) +github.com/davecgh/go-spew/spew/dump.go Dump 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Fprintln 100.00% (1/1) +github.com/davecgh/go-spew/spew/format.go NewFormatter 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Errorf 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Fprint 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Fprintf 100.00% (1/1) +github.com/davecgh/go-spew/spew/spew.go Print 100.00% (1/1) +github.com/davecgh/go-spew/spew ------------------------------- 100.00% (505/505) + diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/.gitignore b/vendor/github.com/ethereum/ethash/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/.gitignore rename to vendor/github.com/ethereum/ethash/.gitignore diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml b/vendor/github.com/ethereum/ethash/.travis.yml similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml rename to vendor/github.com/ethereum/ethash/.travis.yml diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/CMakeLists.txt b/vendor/github.com/ethereum/ethash/CMakeLists.txt similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/CMakeLists.txt rename to vendor/github.com/ethereum/ethash/CMakeLists.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/MANIFEST.in b/vendor/github.com/ethereum/ethash/MANIFEST.in similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/MANIFEST.in rename to vendor/github.com/ethereum/ethash/MANIFEST.in diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/Makefile b/vendor/github.com/ethereum/ethash/Makefile similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/Makefile rename to vendor/github.com/ethereum/ethash/Makefile diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/README.md b/vendor/github.com/ethereum/ethash/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/README.md rename to vendor/github.com/ethereum/ethash/README.md diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/Vagrantfile b/vendor/github.com/ethereum/ethash/Vagrantfile similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/Vagrantfile rename to vendor/github.com/ethereum/ethash/Vagrantfile diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/appveyor.yml b/vendor/github.com/ethereum/ethash/appveyor.yml similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/appveyor.yml rename to vendor/github.com/ethereum/ethash/appveyor.yml diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go b/vendor/github.com/ethereum/ethash/ethash.go similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go rename to vendor/github.com/ethereum/ethash/ethash.go diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethashc.go b/vendor/github.com/ethereum/ethash/ethashc.go similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/ethashc.go rename to vendor/github.com/ethereum/ethash/ethashc.go diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py b/vendor/github.com/ethereum/ethash/setup.py similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/setup.py rename to vendor/github.com/ethereum/ethash/setup.py diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/CMakeLists.txt b/vendor/github.com/ethereum/ethash/src/libethash/CMakeLists.txt similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/CMakeLists.txt rename to vendor/github.com/ethereum/ethash/src/libethash/CMakeLists.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h b/vendor/github.com/ethereum/ethash/src/libethash/compiler.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h rename to vendor/github.com/ethereum/ethash/src/libethash/compiler.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h b/vendor/github.com/ethereum/ethash/src/libethash/data_sizes.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h rename to vendor/github.com/ethereum/ethash/src/libethash/data_sizes.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/endian.h b/vendor/github.com/ethereum/ethash/src/libethash/endian.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/endian.h rename to vendor/github.com/ethereum/ethash/src/libethash/endian.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/ethash.h b/vendor/github.com/ethereum/ethash/src/libethash/ethash.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/ethash.h rename to vendor/github.com/ethereum/ethash/src/libethash/ethash.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h b/vendor/github.com/ethereum/ethash/src/libethash/fnv.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h rename to vendor/github.com/ethereum/ethash/src/libethash/fnv.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c b/vendor/github.com/ethereum/ethash/src/libethash/internal.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c rename to vendor/github.com/ethereum/ethash/src/libethash/internal.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.h b/vendor/github.com/ethereum/ethash/src/libethash/internal.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.h rename to vendor/github.com/ethereum/ethash/src/libethash/internal.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.c b/vendor/github.com/ethereum/ethash/src/libethash/io.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.c rename to vendor/github.com/ethereum/ethash/src/libethash/io.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h b/vendor/github.com/ethereum/ethash/src/libethash/io.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h rename to vendor/github.com/ethereum/ethash/src/libethash/io.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_posix.c b/vendor/github.com/ethereum/ethash/src/libethash/io_posix.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_posix.c rename to vendor/github.com/ethereum/ethash/src/libethash/io_posix.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_win32.c b/vendor/github.com/ethereum/ethash/src/libethash/io_win32.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_win32.c rename to vendor/github.com/ethereum/ethash/src/libethash/io_win32.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/mmap.h b/vendor/github.com/ethereum/ethash/src/libethash/mmap.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/mmap.h rename to vendor/github.com/ethereum/ethash/src/libethash/mmap.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/mmap_win32.c b/vendor/github.com/ethereum/ethash/src/libethash/mmap_win32.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/mmap_win32.c rename to vendor/github.com/ethereum/ethash/src/libethash/mmap_win32.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.c b/vendor/github.com/ethereum/ethash/src/libethash/sha3.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.c rename to vendor/github.com/ethereum/ethash/src/libethash/sha3.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.h b/vendor/github.com/ethereum/ethash/src/libethash/sha3.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.h rename to vendor/github.com/ethereum/ethash/src/libethash/sha3.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.cpp b/vendor/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.cpp similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.cpp rename to vendor/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.cpp diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.h b/vendor/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.h rename to vendor/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.h b/vendor/github.com/ethereum/ethash/src/libethash/util.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.h rename to vendor/github.com/ethereum/ethash/src/libethash/util.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util_win32.c b/vendor/github.com/ethereum/ethash/src/libethash/util_win32.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util_win32.c rename to vendor/github.com/ethereum/ethash/src/libethash/util_win32.c diff --git a/vendor/github.com/fatih/color/.travis.yml b/vendor/github.com/fatih/color/.travis.yml new file mode 100644 index 0000000000..57b4b57c82 --- /dev/null +++ b/vendor/github.com/fatih/color/.travis.yml @@ -0,0 +1,5 @@ +language: go +go: + - 1.6 + - tip + diff --git a/Godeps/_workspace/src/github.com/fatih/color/LICENSE.md b/vendor/github.com/fatih/color/LICENSE.md similarity index 100% rename from Godeps/_workspace/src/github.com/fatih/color/LICENSE.md rename to vendor/github.com/fatih/color/LICENSE.md diff --git a/Godeps/_workspace/src/github.com/fatih/color/README.md b/vendor/github.com/fatih/color/README.md similarity index 88% rename from Godeps/_workspace/src/github.com/fatih/color/README.md rename to vendor/github.com/fatih/color/README.md index d6fb06a3e3..6e39e919f7 100644 --- a/Godeps/_workspace/src/github.com/fatih/color/README.md +++ b/vendor/github.com/fatih/color/README.md @@ -2,7 +2,10 @@ -Color lets you use colorized outputs in terms of [ANSI Escape Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It has support for Windows too! The API can be used in several ways, pick one that suits you. +Color lets you use colorized outputs in terms of [ANSI Escape +Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It +has support for Windows too! The API can be used in several ways, pick one that +suits you. @@ -78,8 +81,8 @@ info := color.New(color.FgWhite, color.BgGreen).SprintFunc() fmt.Printf("This %s rocks!\n", info("package")) // Use helper functions -fmt.Printf("This", color.RedString("warning"), "should be not neglected.") -fmt.Printf(color.GreenString("Info:"), "an important message." ) +fmt.Println("This", color.RedString("warning"), "should be not neglected.") +fmt.Printf("%v %v\n", color.GreenString("Info:"), "an important message.") // Windows supported too! Just don't forget to change the output to color.Output fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS")) @@ -143,7 +146,7 @@ c.Println("This prints again cyan...") ## Credits * [Fatih Arslan](https://github.com/fatih) - * Windows support via @shiena: [ansicolor](https://github.com/shiena/ansicolor) + * Windows support via @mattn: [colorable](https://github.com/mattn/go-colorable) ## License diff --git a/Godeps/_workspace/src/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go similarity index 82% rename from Godeps/_workspace/src/github.com/fatih/color/color.go rename to vendor/github.com/fatih/color/color.go index e3e997284d..06f4867f7f 100644 --- a/Godeps/_workspace/src/github.com/fatih/color/color.go +++ b/vendor/github.com/fatih/color/color.go @@ -5,6 +5,7 @@ import ( "os" "strconv" "strings" + "sync" "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" @@ -312,91 +313,111 @@ func boolPtr(v bool) *bool { return &v } +// colorsCache is used to reduce the count of created Color objects and +// allows to reuse already created objects with required Attribute. +var colorsCache = make(map[Attribute]*Color) + +var colorsCacheMu = new(sync.Mutex) // protects colorsCache + +func getCachedColor(p Attribute) *Color { + colorsCacheMu.Lock() + defer colorsCacheMu.Unlock() + + c, ok := colorsCache[p] + if !ok { + c = New(p) + colorsCache[p] = c + } + + return c +} + +func colorPrint(format string, p Attribute, a ...interface{}) { + c := getCachedColor(p) + + if !strings.HasSuffix(format, "\n") { + format += "\n" + } + + if len(a) == 0 { + c.Print(format) + } else { + c.Printf(format, a...) + } +} + +func colorString(format string, p Attribute, a ...interface{}) string { + c := getCachedColor(p) + + if len(a) == 0 { + return c.SprintFunc()(format) + } + + return c.SprintfFunc()(format, a...) +} + // Black is an convenient helper function to print with black foreground. A // newline is appended to format by default. -func Black(format string, a ...interface{}) { printColor(format, FgBlack, a...) } +func Black(format string, a ...interface{}) { colorPrint(format, FgBlack, a...) } // Red is an convenient helper function to print with red foreground. A // newline is appended to format by default. -func Red(format string, a ...interface{}) { printColor(format, FgRed, a...) } +func Red(format string, a ...interface{}) { colorPrint(format, FgRed, a...) } // Green is an convenient helper function to print with green foreground. A // newline is appended to format by default. -func Green(format string, a ...interface{}) { printColor(format, FgGreen, a...) } +func Green(format string, a ...interface{}) { colorPrint(format, FgGreen, a...) } // Yellow is an convenient helper function to print with yellow foreground. // A newline is appended to format by default. -func Yellow(format string, a ...interface{}) { printColor(format, FgYellow, a...) } +func Yellow(format string, a ...interface{}) { colorPrint(format, FgYellow, a...) } // Blue is an convenient helper function to print with blue foreground. A // newline is appended to format by default. -func Blue(format string, a ...interface{}) { printColor(format, FgBlue, a...) } +func Blue(format string, a ...interface{}) { colorPrint(format, FgBlue, a...) } // Magenta is an convenient helper function to print with magenta foreground. // A newline is appended to format by default. -func Magenta(format string, a ...interface{}) { printColor(format, FgMagenta, a...) } +func Magenta(format string, a ...interface{}) { colorPrint(format, FgMagenta, a...) } // Cyan is an convenient helper function to print with cyan foreground. A // newline is appended to format by default. -func Cyan(format string, a ...interface{}) { printColor(format, FgCyan, a...) } +func Cyan(format string, a ...interface{}) { colorPrint(format, FgCyan, a...) } // White is an convenient helper function to print with white foreground. A // newline is appended to format by default. -func White(format string, a ...interface{}) { printColor(format, FgWhite, a...) } - -func printColor(format string, p Attribute, a ...interface{}) { - if !strings.HasSuffix(format, "\n") { - format += "\n" - } - - c := &Color{params: []Attribute{p}} - c.Printf(format, a...) -} +func White(format string, a ...interface{}) { colorPrint(format, FgWhite, a...) } // BlackString is an convenient helper function to return a string with black // foreground. -func BlackString(format string, a ...interface{}) string { - return New(FgBlack).SprintfFunc()(format, a...) -} +func BlackString(format string, a ...interface{}) string { return colorString(format, FgBlack, a...) } // RedString is an convenient helper function to return a string with red // foreground. -func RedString(format string, a ...interface{}) string { - return New(FgRed).SprintfFunc()(format, a...) -} +func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) } // GreenString is an convenient helper function to return a string with green // foreground. -func GreenString(format string, a ...interface{}) string { - return New(FgGreen).SprintfFunc()(format, a...) -} +func GreenString(format string, a ...interface{}) string { return colorString(format, FgGreen, a...) } // YellowString is an convenient helper function to return a string with yellow // foreground. -func YellowString(format string, a ...interface{}) string { - return New(FgYellow).SprintfFunc()(format, a...) -} +func YellowString(format string, a ...interface{}) string { return colorString(format, FgYellow, a...) } // BlueString is an convenient helper function to return a string with blue // foreground. -func BlueString(format string, a ...interface{}) string { - return New(FgBlue).SprintfFunc()(format, a...) -} +func BlueString(format string, a ...interface{}) string { return colorString(format, FgBlue, a...) } // MagentaString is an convenient helper function to return a string with magenta // foreground. func MagentaString(format string, a ...interface{}) string { - return New(FgMagenta).SprintfFunc()(format, a...) + return colorString(format, FgMagenta, a...) } // CyanString is an convenient helper function to return a string with cyan // foreground. -func CyanString(format string, a ...interface{}) string { - return New(FgCyan).SprintfFunc()(format, a...) -} +func CyanString(format string, a ...interface{}) string { return colorString(format, FgCyan, a...) } // WhiteString is an convenient helper function to return a string with white // foreground. -func WhiteString(format string, a ...interface{}) string { - return New(FgWhite).SprintfFunc()(format, a...) -} +func WhiteString(format string, a ...interface{}) string { return colorString(format, FgWhite, a...) } diff --git a/Godeps/_workspace/src/github.com/fatih/color/doc.go b/vendor/github.com/fatih/color/doc.go similarity index 100% rename from Godeps/_workspace/src/github.com/fatih/color/doc.go rename to vendor/github.com/fatih/color/doc.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/.gitignore b/vendor/github.com/gizak/termui/.gitignore similarity index 97% rename from Godeps/_workspace/src/github.com/gizak/termui/.gitignore rename to vendor/github.com/gizak/termui/.gitignore index eb1369fd4f..8b156b0202 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/.gitignore +++ b/vendor/github.com/gizak/termui/.gitignore @@ -23,3 +23,4 @@ _testmain.go *.test *.prof .DS_Store +/vendor diff --git a/Godeps/_workspace/src/github.com/gizak/termui/.travis.yml b/vendor/github.com/gizak/termui/.travis.yml similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/.travis.yml rename to vendor/github.com/gizak/termui/.travis.yml diff --git a/Godeps/_workspace/src/github.com/gizak/termui/LICENSE b/vendor/github.com/gizak/termui/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/LICENSE rename to vendor/github.com/gizak/termui/LICENSE diff --git a/Godeps/_workspace/src/github.com/gizak/termui/README.md b/vendor/github.com/gizak/termui/README.md similarity index 94% rename from Godeps/_workspace/src/github.com/gizak/termui/README.md rename to vendor/github.com/gizak/termui/README.md index 0e1d41b089..4f3d4a4192 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/README.md +++ b/vendor/github.com/gizak/termui/README.md @@ -12,6 +12,8 @@ Now version v2 has arrived! It brings new event system, new theme system, new `B go get -u github.com/gizak/termui +It is recommanded to use locked deps by using [glide](https://glide.sh): move to `termui` src directory then run `glide up`. + For the compatible reason, you can choose to install the legacy version of `termui`: go get gopkg.in/gizak/termui.v1 @@ -24,7 +26,7 @@ To use `termui`, the very first thing you may want to know is how to manage layo __Absolute layout__ -Each widget has an underlying block structure which basically is a box model. It has border, label and padding properties. A border of a widget can be chosen to hide or display (with its border label), you can pick a different front/back colour for the border as well. To display such a widget at a specific location in terminal window, you need to assign `.X`, `.Y`, `.Height`, `.Width` values for each widget before send it to `.Render`. Let's demonstrate these by a code snippet: +Each widget has an underlying block structure which basically is a box model. It has border, label and padding properties. A border of a widget can be chosen to hide or display (with its border label), you can pick a different front/back colour for the border as well. To display such a widget at a specific location in terminal window, you need to assign `.X`, `.Y`, `.Height`, `.Width` values for each widget before sending it to `.Render`. Let's demonstrate these by a code snippet: `````go import ui "github.com/gizak/termui" // <- ui shortcut, optional @@ -65,7 +67,7 @@ __Grid layout:__ grid -Grid layout uses [12 columns grid system](http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp) with expressive syntax. To use `Grid`, all we need to do is build a widget tree consisting of `Row`s and Cols (Actually a Col is also a `Row` but with a widget endpoint attached). +Grid layout uses [12 columns grid system](http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp) with expressive syntax. To use `Grid`, all we need to do is build a widget tree consisting of `Row`s and `Col`s (Actually a `Col` is also a `Row` but with a widget endpoint attached). ```go import ui "github.com/gizak/termui" diff --git a/Godeps/_workspace/src/github.com/gizak/termui/barchart.go b/vendor/github.com/gizak/termui/barchart.go similarity index 91% rename from Godeps/_workspace/src/github.com/gizak/termui/barchart.go rename to vendor/github.com/gizak/termui/barchart.go index 980e958e2a..9e2a10689e 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/barchart.go +++ b/vendor/github.com/gizak/termui/barchart.go @@ -11,7 +11,7 @@ import "fmt" bc := termui.NewBarChart() data := []int{3, 2, 5, 3, 9, 5} bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"} - bc.Border.Label = "Bar Chart" + bc.BorderLabel = "Bar Chart" bc.Data = data bc.Width = 26 bc.Height = 10 @@ -29,6 +29,7 @@ type BarChart struct { DataLabels []string BarWidth int BarGap int + CellChar rune labels [][]rune dataNum [][]rune numBar int @@ -44,6 +45,7 @@ func NewBarChart() *BarChart { bc.TextColor = ThemeAttr("barchart.text.fg") bc.BarGap = 1 bc.BarWidth = 3 + bc.CellChar = ' ' return bc } @@ -87,16 +89,27 @@ func (bc *BarChart) Buffer() Buffer { for i := 0; i < bc.numBar && i < len(bc.Data) && i < len(bc.DataLabels); i++ { h := int(float64(bc.Data[i]) / bc.scale) oftX := i * (bc.BarWidth + bc.BarGap) + + barBg := bc.Bg + barFg := bc.BarColor + + if bc.CellChar == ' ' { + barBg = bc.BarColor + barFg = ColorDefault + if bc.BarColor == ColorDefault { // the same as above + barBg |= AttrReverse + } + } + // plot bar for j := 0; j < bc.BarWidth; j++ { for k := 0; k < h; k++ { c := Cell{ - Ch: ' ', - Bg: bc.BarColor, - } - if bc.BarColor == ColorDefault { // when color is default, space char treated as transparent! - c.Bg |= AttrReverse + Ch: bc.CellChar, + Bg: barBg, + Fg: barFg, } + x := bc.innerArea.Min.X + i*(bc.BarWidth+bc.BarGap) + j y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - k buf.Set(x, y, c) @@ -120,11 +133,9 @@ func (bc *BarChart) Buffer() Buffer { c := Cell{ Ch: bc.dataNum[i][j], Fg: bc.NumColor, - Bg: bc.BarColor, - } - if bc.BarColor == ColorDefault { // the same as above - c.Bg |= AttrReverse + Bg: barBg, } + if h == 0 { c.Bg = bc.Bg } diff --git a/Godeps/_workspace/src/github.com/gizak/termui/block.go b/vendor/github.com/gizak/termui/block.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/block.go rename to vendor/github.com/gizak/termui/block.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/block_common.go b/vendor/github.com/gizak/termui/block_common.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/block_common.go rename to vendor/github.com/gizak/termui/block_common.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/block_windows.go b/vendor/github.com/gizak/termui/block_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/block_windows.go rename to vendor/github.com/gizak/termui/block_windows.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/buffer.go b/vendor/github.com/gizak/termui/buffer.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/buffer.go rename to vendor/github.com/gizak/termui/buffer.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/canvas.go b/vendor/github.com/gizak/termui/canvas.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/canvas.go rename to vendor/github.com/gizak/termui/canvas.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/config b/vendor/github.com/gizak/termui/config old mode 100644 new mode 100755 similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/config rename to vendor/github.com/gizak/termui/config diff --git a/Godeps/_workspace/src/github.com/gizak/termui/doc.go b/vendor/github.com/gizak/termui/doc.go similarity index 92% rename from Godeps/_workspace/src/github.com/gizak/termui/doc.go rename to vendor/github.com/gizak/termui/doc.go index b80e464158..0d7108d308 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/doc.go +++ b/vendor/github.com/gizak/termui/doc.go @@ -19,9 +19,11 @@ A simplest example: g := ui.NewGauge() g.Percent = 50 g.Width = 50 - g.Border.Label = "Gauge" + g.BorderLabel = "Gauge" ui.Render(g) + + ui.Loop() } */ package termui diff --git a/Godeps/_workspace/src/github.com/gizak/termui/events.go b/vendor/github.com/gizak/termui/events.go similarity index 97% rename from Godeps/_workspace/src/github.com/gizak/termui/events.go rename to vendor/github.com/gizak/termui/events.go index 177bbb4b02..6627f8942f 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/events.go +++ b/vendor/github.com/gizak/termui/events.go @@ -221,6 +221,13 @@ func findMatch(mux map[string]func(Event), path string) string { return pattern } +// Remove all existing defined Handlers from the map +func (es *EvtStream) ResetHandlers() { + for Path, _ := range es.Handlers { + delete(es.Handlers, Path) + } + return +} func (es *EvtStream) match(path string) string { return findMatch(es.Handlers, path) diff --git a/Godeps/_workspace/src/github.com/gizak/termui/gauge.go b/vendor/github.com/gizak/termui/gauge.go similarity index 98% rename from Godeps/_workspace/src/github.com/gizak/termui/gauge.go rename to vendor/github.com/gizak/termui/gauge.go index 244d2995ee..01af0ea7c3 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/gauge.go +++ b/vendor/github.com/gizak/termui/gauge.go @@ -16,7 +16,7 @@ import ( g.Percent = 40 g.Width = 50 g.Height = 3 - g.Border.Label = "Slim Gauge" + g.BorderLabel = "Slim Gauge" g.BarColor = termui.ColorRed g.PercentColor = termui.ColorBlue */ diff --git a/vendor/github.com/gizak/termui/glide.lock b/vendor/github.com/gizak/termui/glide.lock new file mode 100644 index 0000000000..798e944d39 --- /dev/null +++ b/vendor/github.com/gizak/termui/glide.lock @@ -0,0 +1,14 @@ +hash: 67a478802ee1d122cf1df063c52458d074864900c96a5cc25dc6be4b7638eb1c +updated: 2016-04-06T21:16:00.849048757-04:00 +imports: +- name: github.com/mattn/go-runewidth + version: d6bea18f789704b5f83375793155289da36a3c7f +- name: github.com/mitchellh/go-wordwrap + version: ad45545899c7b13c020ea92b2072220eefad42b8 +- name: github.com/nsf/termbox-go + version: 362329b0aa6447eadd52edd8d660ec1dff470295 +- name: golang.org/x/net + version: af4fee9d05b66edc24197d189e6118f8ebce8c2b + subpackages: + - websocket +devImports: [] diff --git a/vendor/github.com/gizak/termui/glide.yaml b/vendor/github.com/gizak/termui/glide.yaml new file mode 100644 index 0000000000..d8e4452548 --- /dev/null +++ b/vendor/github.com/gizak/termui/glide.yaml @@ -0,0 +1,8 @@ +package: github.com/gizak/termui +import: +- package: github.com/mattn/go-runewidth +- package: github.com/mitchellh/go-wordwrap +- package: github.com/nsf/termbox-go +- package: golang.org/x/net + subpackages: + - websocket diff --git a/Godeps/_workspace/src/github.com/gizak/termui/grid.go b/vendor/github.com/gizak/termui/grid.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/grid.go rename to vendor/github.com/gizak/termui/grid.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/helper.go b/vendor/github.com/gizak/termui/helper.go similarity index 97% rename from Godeps/_workspace/src/github.com/gizak/termui/helper.go rename to vendor/github.com/gizak/termui/helper.go index 6690e7fb06..308f6c1db0 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/helper.go +++ b/vendor/github.com/gizak/termui/helper.go @@ -212,3 +212,11 @@ func DTrimTxCls(cs []Cell, w int) []Cell { return rt } + +func CellsToStr(cs []Cell) string { + str := "" + for _, c := range cs { + str += string(c.Ch) + } + return str +} diff --git a/Godeps/_workspace/src/github.com/gizak/termui/linechart.go b/vendor/github.com/gizak/termui/linechart.go similarity index 94% rename from Godeps/_workspace/src/github.com/gizak/termui/linechart.go rename to vendor/github.com/gizak/termui/linechart.go index f2829148ed..81834efdbc 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/linechart.go +++ b/vendor/github.com/gizak/termui/linechart.go @@ -39,7 +39,7 @@ var rSingleBraille = [4]rune{'\u2880', '⠠', '⠐', '⠈'} // because one braille char can represent two data points. /* lc := termui.NewLineChart() - lc.Border.Label = "braille-mode Line Chart" + lc.BorderLabel = "braille-mode Line Chart" lc.Data = [1.2, 1.3, 1.5, 1.7, 1.5, 1.6, 1.8, 2.0] lc.Width = 50 lc.Height = 12 @@ -60,8 +60,8 @@ type LineChart struct { drawingY int axisYHeight int axisXWidth int - axisYLebelGap int - axisXLebelGap int + axisYLabelGap int + axisXLabelGap int topValue float64 bottomValue float64 labelX [][]rune @@ -69,6 +69,7 @@ type LineChart struct { labelYSpace int maxY float64 minY float64 + autoLabels bool } // NewLineChart returns a new LineChart with current theme. @@ -78,8 +79,8 @@ func NewLineChart() *LineChart { lc.LineColor = ThemeAttr("linechart.line.fg") lc.Mode = "braille" lc.DotStyle = '•' - lc.axisXLebelGap = 2 - lc.axisYLebelGap = 1 + lc.axisXLabelGap = 2 + lc.axisYLabelGap = 1 lc.bottomValue = math.Inf(1) lc.topValue = math.Inf(-1) return lc @@ -162,7 +163,7 @@ func (lc *LineChart) calcLabelX() { if l+w <= lc.axisXWidth { lc.labelX = append(lc.labelX, s) } - l += w + lc.axisXLebelGap + l += w + lc.axisXLabelGap } else { // braille if 2*l >= len(lc.DataLabels) { break @@ -173,7 +174,7 @@ func (lc *LineChart) calcLabelX() { if l+w <= lc.axisXWidth { lc.labelX = append(lc.labelX, s) } - l += w + lc.axisXLebelGap + l += w + lc.axisXLabelGap } } @@ -195,7 +196,7 @@ func (lc *LineChart) calcLabelY() { span := lc.topValue - lc.bottomValue lc.scale = span / float64(lc.axisYHeight) - n := (1 + lc.axisYHeight) / (lc.axisYLebelGap + 1) + n := (1 + lc.axisYHeight) / (lc.axisYLabelGap + 1) lc.labelY = make([][]rune, n) maxLen := 0 for i := 0; i < n; i++ { @@ -211,7 +212,8 @@ func (lc *LineChart) calcLabelY() { func (lc *LineChart) calcLayout() { // set datalabels if it is not provided - if lc.DataLabels == nil || len(lc.DataLabels) == 0 { + if (lc.DataLabels == nil || len(lc.DataLabels) == 0) || lc.autoLabels { + lc.autoLabels = true lc.DataLabels = make([]string, len(lc.Data)) for i := range lc.Data { lc.DataLabels[i] = fmt.Sprint(i) @@ -293,7 +295,7 @@ func (lc *LineChart) plotAxes() Buffer { y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 1 buf.Set(x, y, c) } - oft += len(rs) + lc.axisXLebelGap + oft += len(rs) + lc.axisXLabelGap } // y labels @@ -301,7 +303,7 @@ func (lc *LineChart) plotAxes() Buffer { for j, r := range rs { buf.Set( lc.innerArea.Min.X+j, - origY-i*(lc.axisYLebelGap+1), + origY-i*(lc.axisYLabelGap+1), Cell{Ch: r, Fg: lc.AxesColor, Bg: lc.Bg}) } } diff --git a/Godeps/_workspace/src/github.com/gizak/termui/linechart_others.go b/vendor/github.com/gizak/termui/linechart_others.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/linechart_others.go rename to vendor/github.com/gizak/termui/linechart_others.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/linechart_windows.go b/vendor/github.com/gizak/termui/linechart_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/linechart_windows.go rename to vendor/github.com/gizak/termui/linechart_windows.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/list.go b/vendor/github.com/gizak/termui/list.go similarity index 98% rename from Godeps/_workspace/src/github.com/gizak/termui/list.go rename to vendor/github.com/gizak/termui/list.go index 670015fd3a..0029d26228 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/list.go +++ b/vendor/github.com/gizak/termui/list.go @@ -24,7 +24,7 @@ import "strings" ls := termui.NewList() ls.Items = strs ls.ItemFgColor = termui.ColorYellow - ls.Border.Label = "List" + ls.BorderLabel = "List" ls.Height = 7 ls.Width = 25 ls.Y = 0 diff --git a/Godeps/_workspace/src/github.com/gizak/termui/mbarchart.go b/vendor/github.com/gizak/termui/mbarchart.go similarity index 99% rename from Godeps/_workspace/src/github.com/gizak/termui/mbarchart.go rename to vendor/github.com/gizak/termui/mbarchart.go index 231de277ff..6828e65336 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/mbarchart.go +++ b/vendor/github.com/gizak/termui/mbarchart.go @@ -16,7 +16,7 @@ import ( data[0] := []int{3, 2, 5, 7, 9, 4} data[1] := []int{7, 8, 5, 3, 1, 6} bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"} - bc.Border.Label = "Bar Chart" + bc.BorderLabel = "Bar Chart" bc.Data = data bc.Width = 26 bc.Height = 10 diff --git a/vendor/github.com/gizak/termui/mkdocs.yml b/vendor/github.com/gizak/termui/mkdocs.yml new file mode 100644 index 0000000000..2ab45f064b --- /dev/null +++ b/vendor/github.com/gizak/termui/mkdocs.yml @@ -0,0 +1,28 @@ +pages: +- Home: 'index.md' +- Quickstart: 'quickstart.md' +- Recipes: 'recipes.md' +- References: + - Layouts: 'layouts.md' + - Components: 'components.md' + - Events: 'events.md' + - Themes: 'themes.md' +- Versions: 'versions.md' +- About: 'about.md' + +site_name: termui +repo_url: https://github.com/gizak/termui/ +site_description: 'termui user guide' +site_author: gizak + +docs_dir: '_docs' + +theme: readthedocs + +markdown_extensions: + - smarty + - admonition + - toc + +extra: + version: 1.0 diff --git a/Godeps/_workspace/src/github.com/gizak/termui/par.go b/vendor/github.com/gizak/termui/par.go similarity index 82% rename from Godeps/_workspace/src/github.com/gizak/termui/par.go rename to vendor/github.com/gizak/termui/par.go index c01bd0020f..78bffd0918 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/par.go +++ b/vendor/github.com/gizak/termui/par.go @@ -9,13 +9,14 @@ package termui par := termui.NewPar("Simple Text") par.Height = 3 par.Width = 17 - par.Border.Label = "Label" + par.BorderLabel = "Label" */ type Par struct { Block Text string TextFgColor Attribute TextBgColor Attribute + WrapLength int // words wrap limit. Note it may not work properly with multi-width char } // NewPar returns a new *Par with given text as its content. @@ -25,6 +26,7 @@ func NewPar(s string) *Par { Text: s, TextFgColor: ThemeAttr("par.text.fg"), TextBgColor: ThemeAttr("par.text.bg"), + WrapLength: 0, } } @@ -35,6 +37,13 @@ func (p *Par) Buffer() Buffer { fg, bg := p.TextFgColor, p.TextBgColor cs := DefaultTxBuilder.Build(p.Text, fg, bg) + // wrap if WrapLength set + if p.WrapLength < 0 { + cs = wrapTx(cs, p.Width-2) + } else if p.WrapLength > 0 { + cs = wrapTx(cs, p.WrapLength) + } + y, x, n := 0, 0, 0 for y < p.innerArea.Dy() && n < len(cs) { w := cs[n].Width() diff --git a/Godeps/_workspace/src/github.com/gizak/termui/pos.go b/vendor/github.com/gizak/termui/pos.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/pos.go rename to vendor/github.com/gizak/termui/pos.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/render.go b/vendor/github.com/gizak/termui/render.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/render.go rename to vendor/github.com/gizak/termui/render.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/sparkline.go b/vendor/github.com/gizak/termui/sparkline.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/sparkline.go rename to vendor/github.com/gizak/termui/sparkline.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/textbuilder.go b/vendor/github.com/gizak/termui/textbuilder.go similarity index 72% rename from Godeps/_workspace/src/github.com/gizak/termui/textbuilder.go rename to vendor/github.com/gizak/termui/textbuilder.go index 6ff6d21f3c..06a019beda 100644 --- a/Godeps/_workspace/src/github.com/gizak/termui/textbuilder.go +++ b/vendor/github.com/gizak/termui/textbuilder.go @@ -7,9 +7,11 @@ package termui import ( "regexp" "strings" + + "github.com/mitchellh/go-wordwrap" ) -// TextBuilder is a minial interface to produce text []Cell using sepcific syntax (markdown). +// TextBuilder is a minimal interface to produce text []Cell using specific syntax (markdown). type TextBuilder interface { Build(s string, fg, bg Attribute) []Cell } @@ -189,6 +191,67 @@ func (mtb *MarkdownTxBuilder) parse(str string) { mtb.plainTx = normTx } +func wrapTx(cs []Cell, wl int) []Cell { + tmpCell := make([]Cell, len(cs)) + copy(tmpCell, cs) + + // get the plaintext + plain := CellsToStr(cs) + + // wrap + plainWrapped := wordwrap.WrapString(plain, uint(wl)) + + // find differences and insert + finalCell := tmpCell // finalcell will get the inserts and is what is returned + + plainRune := []rune(plain) + plainWrappedRune := []rune(plainWrapped) + trigger := "go" + plainRuneNew := plainRune + + for trigger != "stop" { + plainRune = plainRuneNew + for i := range plainRune { + if plainRune[i] == plainWrappedRune[i] { + trigger = "stop" + } else if plainRune[i] != plainWrappedRune[i] && plainWrappedRune[i] == 10 { + trigger = "go" + cell := Cell{10, 0, 0} + j := i - 0 + + // insert a cell into the []Cell in correct position + tmpCell[i] = cell + + // insert the newline into plain so we avoid indexing errors + plainRuneNew = append(plainRune, 10) + copy(plainRuneNew[j+1:], plainRuneNew[j:]) + plainRuneNew[j] = plainWrappedRune[j] + + // restart the inner for loop until plain and plain wrapped are + // the same; yeah, it's inefficient, but the text amounts + // should be small + break + + } else if plainRune[i] != plainWrappedRune[i] && + plainWrappedRune[i-1] == 10 && // if the prior rune is a newline + plainRune[i] == 32 { // and this rune is a space + trigger = "go" + // need to delete plainRune[i] because it gets rid of an extra + // space + plainRuneNew = append(plainRune[:i], plainRune[i+1:]...) + break + + } else { + trigger = "stop" // stops the outer for loop + } + } + } + + finalCell = tmpCell + + return finalCell +} + // Build implements TextBuilder interface. func (mtb MarkdownTxBuilder) Build(s string, fg, bg Attribute) []Cell { mtb.baseFg = fg diff --git a/Godeps/_workspace/src/github.com/gizak/termui/theme.go b/vendor/github.com/gizak/termui/theme.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/theme.go rename to vendor/github.com/gizak/termui/theme.go diff --git a/Godeps/_workspace/src/github.com/gizak/termui/widget.go b/vendor/github.com/gizak/termui/widget.go similarity index 100% rename from Godeps/_workspace/src/github.com/gizak/termui/widget.go rename to vendor/github.com/gizak/termui/widget.go diff --git a/vendor/github.com/golang/snappy/.gitignore b/vendor/github.com/golang/snappy/.gitignore new file mode 100644 index 0000000000..042091d9b3 --- /dev/null +++ b/vendor/github.com/golang/snappy/.gitignore @@ -0,0 +1,16 @@ +cmd/snappytool/snappytool +testdata/bench + +# These explicitly listed benchmark data files are for an obsolete version of +# snappy_test.go. +testdata/alice29.txt +testdata/asyoulik.txt +testdata/fireworks.jpeg +testdata/geo.protodata +testdata/html +testdata/html_x_4 +testdata/kppkn.gtb +testdata/lcet10.txt +testdata/paper-100k.pdf +testdata/plrabn12.txt +testdata/urls.10K diff --git a/Godeps/_workspace/src/github.com/golang/snappy/AUTHORS b/vendor/github.com/golang/snappy/AUTHORS similarity index 100% rename from Godeps/_workspace/src/github.com/golang/snappy/AUTHORS rename to vendor/github.com/golang/snappy/AUTHORS diff --git a/Godeps/_workspace/src/github.com/golang/snappy/CONTRIBUTORS b/vendor/github.com/golang/snappy/CONTRIBUTORS similarity index 100% rename from Godeps/_workspace/src/github.com/golang/snappy/CONTRIBUTORS rename to vendor/github.com/golang/snappy/CONTRIBUTORS diff --git a/Godeps/_workspace/src/github.com/golang/snappy/LICENSE b/vendor/github.com/golang/snappy/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/golang/snappy/LICENSE rename to vendor/github.com/golang/snappy/LICENSE diff --git a/vendor/github.com/golang/snappy/README b/vendor/github.com/golang/snappy/README new file mode 100644 index 0000000000..cea12879a0 --- /dev/null +++ b/vendor/github.com/golang/snappy/README @@ -0,0 +1,107 @@ +The Snappy compression format in the Go programming language. + +To download and install from source: +$ go get github.com/golang/snappy + +Unless otherwise noted, the Snappy-Go source files are distributed +under the BSD-style license found in the LICENSE file. + + + +Benchmarks. + +The golang/snappy benchmarks include compressing (Z) and decompressing (U) ten +or so files, the same set used by the C++ Snappy code (github.com/google/snappy +and note the "google", not "golang"). On an "Intel(R) Core(TM) i7-3770 CPU @ +3.40GHz", Go's GOARCH=amd64 numbers as of 2016-05-29: + +"go test -test.bench=." + +_UFlat0-8 2.19GB/s ± 0% html +_UFlat1-8 1.41GB/s ± 0% urls +_UFlat2-8 23.5GB/s ± 2% jpg +_UFlat3-8 1.91GB/s ± 0% jpg_200 +_UFlat4-8 14.0GB/s ± 1% pdf +_UFlat5-8 1.97GB/s ± 0% html4 +_UFlat6-8 814MB/s ± 0% txt1 +_UFlat7-8 785MB/s ± 0% txt2 +_UFlat8-8 857MB/s ± 0% txt3 +_UFlat9-8 719MB/s ± 1% txt4 +_UFlat10-8 2.84GB/s ± 0% pb +_UFlat11-8 1.05GB/s ± 0% gaviota + +_ZFlat0-8 1.04GB/s ± 0% html +_ZFlat1-8 534MB/s ± 0% urls +_ZFlat2-8 15.7GB/s ± 1% jpg +_ZFlat3-8 740MB/s ± 3% jpg_200 +_ZFlat4-8 9.20GB/s ± 1% pdf +_ZFlat5-8 991MB/s ± 0% html4 +_ZFlat6-8 379MB/s ± 0% txt1 +_ZFlat7-8 352MB/s ± 0% txt2 +_ZFlat8-8 396MB/s ± 1% txt3 +_ZFlat9-8 327MB/s ± 1% txt4 +_ZFlat10-8 1.33GB/s ± 1% pb +_ZFlat11-8 605MB/s ± 1% gaviota + + + +"go test -test.bench=. -tags=noasm" + +_UFlat0-8 621MB/s ± 2% html +_UFlat1-8 494MB/s ± 1% urls +_UFlat2-8 23.2GB/s ± 1% jpg +_UFlat3-8 1.12GB/s ± 1% jpg_200 +_UFlat4-8 4.35GB/s ± 1% pdf +_UFlat5-8 609MB/s ± 0% html4 +_UFlat6-8 296MB/s ± 0% txt1 +_UFlat7-8 288MB/s ± 0% txt2 +_UFlat8-8 309MB/s ± 1% txt3 +_UFlat9-8 280MB/s ± 1% txt4 +_UFlat10-8 753MB/s ± 0% pb +_UFlat11-8 400MB/s ± 0% gaviota + +_ZFlat0-8 409MB/s ± 1% html +_ZFlat1-8 250MB/s ± 1% urls +_ZFlat2-8 12.3GB/s ± 1% jpg +_ZFlat3-8 132MB/s ± 0% jpg_200 +_ZFlat4-8 2.92GB/s ± 0% pdf +_ZFlat5-8 405MB/s ± 1% html4 +_ZFlat6-8 179MB/s ± 1% txt1 +_ZFlat7-8 170MB/s ± 1% txt2 +_ZFlat8-8 189MB/s ± 1% txt3 +_ZFlat9-8 164MB/s ± 1% txt4 +_ZFlat10-8 479MB/s ± 1% pb +_ZFlat11-8 270MB/s ± 1% gaviota + + + +For comparison (Go's encoded output is byte-for-byte identical to C++'s), here +are the numbers from C++ Snappy's + +make CXXFLAGS="-O2 -DNDEBUG -g" clean snappy_unittest.log && cat snappy_unittest.log + +BM_UFlat/0 2.4GB/s html +BM_UFlat/1 1.4GB/s urls +BM_UFlat/2 21.8GB/s jpg +BM_UFlat/3 1.5GB/s jpg_200 +BM_UFlat/4 13.3GB/s pdf +BM_UFlat/5 2.1GB/s html4 +BM_UFlat/6 1.0GB/s txt1 +BM_UFlat/7 959.4MB/s txt2 +BM_UFlat/8 1.0GB/s txt3 +BM_UFlat/9 864.5MB/s txt4 +BM_UFlat/10 2.9GB/s pb +BM_UFlat/11 1.2GB/s gaviota + +BM_ZFlat/0 944.3MB/s html (22.31 %) +BM_ZFlat/1 501.6MB/s urls (47.78 %) +BM_ZFlat/2 14.3GB/s jpg (99.95 %) +BM_ZFlat/3 538.3MB/s jpg_200 (73.00 %) +BM_ZFlat/4 8.3GB/s pdf (83.30 %) +BM_ZFlat/5 903.5MB/s html4 (22.52 %) +BM_ZFlat/6 336.0MB/s txt1 (57.88 %) +BM_ZFlat/7 312.3MB/s txt2 (61.91 %) +BM_ZFlat/8 353.1MB/s txt3 (54.99 %) +BM_ZFlat/9 289.9MB/s txt4 (66.26 %) +BM_ZFlat/10 1.2GB/s pb (19.68 %) +BM_ZFlat/11 527.4MB/s gaviota (37.72 %) diff --git a/Godeps/_workspace/src/github.com/golang/snappy/decode.go b/vendor/github.com/golang/snappy/decode.go similarity index 70% rename from Godeps/_workspace/src/github.com/golang/snappy/decode.go rename to vendor/github.com/golang/snappy/decode.go index 8bab5bdd02..72efb0353d 100644 --- a/Godeps/_workspace/src/github.com/golang/snappy/decode.go +++ b/vendor/github.com/golang/snappy/decode.go @@ -17,6 +17,8 @@ var ( ErrTooLarge = errors.New("snappy: decoded block is too large") // ErrUnsupported reports that the input isn't supported. ErrUnsupported = errors.New("snappy: unsupported input") + + errUnsupportedLiteralLength = errors.New("snappy: unsupported literal length") ) // DecodedLen returns the length of the decoded block. @@ -40,96 +42,33 @@ func decodedLen(src []byte) (blockLen, headerLen int, err error) { return int(v), n, nil } +const ( + decodeErrCodeCorrupt = 1 + decodeErrCodeUnsupportedLiteralLength = 2 +) + // Decode returns the decoded form of src. The returned slice may be a sub- // slice of dst if dst was large enough to hold the entire decoded block. // Otherwise, a newly allocated slice will be returned. -// It is valid to pass a nil dst. +// +// The dst and src must not overlap. It is valid to pass a nil dst. func Decode(dst, src []byte) ([]byte, error) { dLen, s, err := decodedLen(src) if err != nil { return nil, err } - if len(dst) < dLen { + if dLen <= len(dst) { + dst = dst[:dLen] + } else { dst = make([]byte, dLen) } - - var d, offset, length int - for s < len(src) { - switch src[s] & 0x03 { - case tagLiteral: - x := uint(src[s] >> 2) - switch { - case x < 60: - s++ - case x == 60: - s += 2 - if s > len(src) { - return nil, ErrCorrupt - } - x = uint(src[s-1]) - case x == 61: - s += 3 - if s > len(src) { - return nil, ErrCorrupt - } - x = uint(src[s-2]) | uint(src[s-1])<<8 - case x == 62: - s += 4 - if s > len(src) { - return nil, ErrCorrupt - } - x = uint(src[s-3]) | uint(src[s-2])<<8 | uint(src[s-1])<<16 - case x == 63: - s += 5 - if s > len(src) { - return nil, ErrCorrupt - } - x = uint(src[s-4]) | uint(src[s-3])<<8 | uint(src[s-2])<<16 | uint(src[s-1])<<24 - } - length = int(x + 1) - if length <= 0 { - return nil, errors.New("snappy: unsupported literal length") - } - if length > len(dst)-d || length > len(src)-s { - return nil, ErrCorrupt - } - copy(dst[d:], src[s:s+length]) - d += length - s += length - continue - - case tagCopy1: - s += 2 - if s > len(src) { - return nil, ErrCorrupt - } - length = 4 + int(src[s-2])>>2&0x7 - offset = int(src[s-2])&0xe0<<3 | int(src[s-1]) - - case tagCopy2: - s += 3 - if s > len(src) { - return nil, ErrCorrupt - } - length = 1 + int(src[s-3])>>2 - offset = int(src[s-2]) | int(src[s-1])<<8 - - case tagCopy4: - return nil, errors.New("snappy: unsupported COPY_4 tag") - } - - end := d + length - if offset > d || end > len(dst) { - return nil, ErrCorrupt - } - for ; d < end; d++ { - dst[d] = dst[d-offset] - } - } - if d != dLen { - return nil, ErrCorrupt + switch decode(dst, src[s:]) { + case 0: + return dst, nil + case decodeErrCodeUnsupportedLiteralLength: + return nil, errUnsupportedLiteralLength } - return dst[:d], nil + return nil, ErrCorrupt } // NewReader returns a new Reader that decompresses from r, using the framing @@ -138,8 +77,8 @@ func Decode(dst, src []byte) ([]byte, error) { func NewReader(r io.Reader) *Reader { return &Reader{ r: r, - decoded: make([]byte, maxUncompressedChunkLen), - buf: make([]byte, MaxEncodedLen(maxUncompressedChunkLen)+checksumSize), + decoded: make([]byte, maxBlockSize), + buf: make([]byte, maxEncodedLenOfMaxBlockSize+checksumSize), } } @@ -165,9 +104,9 @@ func (r *Reader) Reset(reader io.Reader) { r.readHeader = false } -func (r *Reader) readFull(p []byte) (ok bool) { +func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) { if _, r.err = io.ReadFull(r.r, p); r.err != nil { - if r.err == io.ErrUnexpectedEOF { + if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { r.err = ErrCorrupt } return false @@ -186,7 +125,7 @@ func (r *Reader) Read(p []byte) (int, error) { r.i += n return n, nil } - if !r.readFull(r.buf[:4]) { + if !r.readFull(r.buf[:4], true) { return 0, r.err } chunkType := r.buf[0] @@ -213,7 +152,7 @@ func (r *Reader) Read(p []byte) (int, error) { return 0, r.err } buf := r.buf[:chunkLen] - if !r.readFull(buf) { + if !r.readFull(buf, false) { return 0, r.err } checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 @@ -246,13 +185,17 @@ func (r *Reader) Read(p []byte) (int, error) { return 0, r.err } buf := r.buf[:checksumSize] - if !r.readFull(buf) { + if !r.readFull(buf, false) { return 0, r.err } checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 // Read directly into r.decoded instead of via r.buf. n := chunkLen - checksumSize - if !r.readFull(r.decoded[:n]) { + if n > len(r.decoded) { + r.err = ErrCorrupt + return 0, r.err + } + if !r.readFull(r.decoded[:n], false) { return 0, r.err } if crc(r.decoded[:n]) != checksum { @@ -268,7 +211,7 @@ func (r *Reader) Read(p []byte) (int, error) { r.err = ErrCorrupt return 0, r.err } - if !r.readFull(r.buf[:len(magicBody)]) { + if !r.readFull(r.buf[:len(magicBody)], false) { return 0, r.err } for i := 0; i < len(magicBody); i++ { @@ -287,7 +230,7 @@ func (r *Reader) Read(p []byte) (int, error) { } // Section 4.4 Padding (chunk type 0xfe). // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). - if !r.readFull(r.buf[:chunkLen]) { + if !r.readFull(r.buf[:chunkLen], false) { return 0, r.err } } diff --git a/vendor/github.com/golang/snappy/decode_amd64.go b/vendor/github.com/golang/snappy/decode_amd64.go new file mode 100644 index 0000000000..fcd192b849 --- /dev/null +++ b/vendor/github.com/golang/snappy/decode_amd64.go @@ -0,0 +1,14 @@ +// Copyright 2016 The Snappy-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. + +// +build !appengine +// +build gc +// +build !noasm + +package snappy + +// decode has the same semantics as in decode_other.go. +// +//go:noescape +func decode(dst, src []byte) int diff --git a/vendor/github.com/golang/snappy/decode_amd64.s b/vendor/github.com/golang/snappy/decode_amd64.s new file mode 100644 index 0000000000..e6179f65e3 --- /dev/null +++ b/vendor/github.com/golang/snappy/decode_amd64.s @@ -0,0 +1,490 @@ +// Copyright 2016 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. + +// +build !appengine +// +build gc +// +build !noasm + +#include "textflag.h" + +// The asm code generally follows the pure Go code in decode_other.go, except +// where marked with a "!!!". + +// func decode(dst, src []byte) int +// +// All local variables fit into registers. The non-zero stack size is only to +// spill registers and push args when issuing a CALL. The register allocation: +// - AX scratch +// - BX scratch +// - CX length or x +// - DX offset +// - SI &src[s] +// - DI &dst[d] +// + R8 dst_base +// + R9 dst_len +// + R10 dst_base + dst_len +// + R11 src_base +// + R12 src_len +// + R13 src_base + src_len +// - R14 used by doCopy +// - R15 used by doCopy +// +// The registers R8-R13 (marked with a "+") are set at the start of the +// function, and after a CALL returns, and are not otherwise modified. +// +// The d variable is implicitly DI - R8, and len(dst)-d is R10 - DI. +// The s variable is implicitly SI - R11, and len(src)-s is R13 - SI. +TEXT ·decode(SB), NOSPLIT, $48-56 + // Initialize SI, DI and R8-R13. + MOVQ dst_base+0(FP), R8 + MOVQ dst_len+8(FP), R9 + MOVQ R8, DI + MOVQ R8, R10 + ADDQ R9, R10 + MOVQ src_base+24(FP), R11 + MOVQ src_len+32(FP), R12 + MOVQ R11, SI + MOVQ R11, R13 + ADDQ R12, R13 + +loop: + // for s < len(src) + CMPQ SI, R13 + JEQ end + + // CX = uint32(src[s]) + // + // switch src[s] & 0x03 + MOVBLZX (SI), CX + MOVL CX, BX + ANDL $3, BX + CMPL BX, $1 + JAE tagCopy + + // ---------------------------------------- + // The code below handles literal tags. + + // case tagLiteral: + // x := uint32(src[s] >> 2) + // switch + SHRL $2, CX + CMPL CX, $60 + JAE tagLit60Plus + + // case x < 60: + // s++ + INCQ SI + +doLit: + // This is the end of the inner "switch", when we have a literal tag. + // + // We assume that CX == x and x fits in a uint32, where x is the variable + // used in the pure Go decode_other.go code. + + // length = int(x) + 1 + // + // Unlike the pure Go code, we don't need to check if length <= 0 because + // CX can hold 64 bits, so the increment cannot overflow. + INCQ CX + + // Prepare to check if copying length bytes will run past the end of dst or + // src. + // + // AX = len(dst) - d + // BX = len(src) - s + MOVQ R10, AX + SUBQ DI, AX + MOVQ R13, BX + SUBQ SI, BX + + // !!! Try a faster technique for short (16 or fewer bytes) copies. + // + // if length > 16 || len(dst)-d < 16 || len(src)-s < 16 { + // goto callMemmove // Fall back on calling runtime·memmove. + // } + // + // The C++ snappy code calls this TryFastAppend. It also checks len(src)-s + // against 21 instead of 16, because it cannot assume that all of its input + // is contiguous in memory and so it needs to leave enough source bytes to + // read the next tag without refilling buffers, but Go's Decode assumes + // contiguousness (the src argument is a []byte). + CMPQ CX, $16 + JGT callMemmove + CMPQ AX, $16 + JLT callMemmove + CMPQ BX, $16 + JLT callMemmove + + // !!! Implement the copy from src to dst as a 16-byte load and store. + // (Decode's documentation says that dst and src must not overlap.) + // + // This always copies 16 bytes, instead of only length bytes, but that's + // OK. If the input is a valid Snappy encoding then subsequent iterations + // will fix up the overrun. Otherwise, Decode returns a nil []byte (and a + // non-nil error), so the overrun will be ignored. + // + // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or + // 16-byte loads and stores. This technique probably wouldn't be as + // effective on architectures that are fussier about alignment. + MOVOU 0(SI), X0 + MOVOU X0, 0(DI) + + // d += length + // s += length + ADDQ CX, DI + ADDQ CX, SI + JMP loop + +callMemmove: + // if length > len(dst)-d || length > len(src)-s { etc } + CMPQ CX, AX + JGT errCorrupt + CMPQ CX, BX + JGT errCorrupt + + // copy(dst[d:], src[s:s+length]) + // + // This means calling runtime·memmove(&dst[d], &src[s], length), so we push + // DI, SI and CX as arguments. Coincidentally, we also need to spill those + // three registers to the stack, to save local variables across the CALL. + MOVQ DI, 0(SP) + MOVQ SI, 8(SP) + MOVQ CX, 16(SP) + MOVQ DI, 24(SP) + MOVQ SI, 32(SP) + MOVQ CX, 40(SP) + CALL runtime·memmove(SB) + + // Restore local variables: unspill registers from the stack and + // re-calculate R8-R13. + MOVQ 24(SP), DI + MOVQ 32(SP), SI + MOVQ 40(SP), CX + MOVQ dst_base+0(FP), R8 + MOVQ dst_len+8(FP), R9 + MOVQ R8, R10 + ADDQ R9, R10 + MOVQ src_base+24(FP), R11 + MOVQ src_len+32(FP), R12 + MOVQ R11, R13 + ADDQ R12, R13 + + // d += length + // s += length + ADDQ CX, DI + ADDQ CX, SI + JMP loop + +tagLit60Plus: + // !!! This fragment does the + // + // s += x - 58; if uint(s) > uint(len(src)) { etc } + // + // checks. In the asm version, we code it once instead of once per switch case. + ADDQ CX, SI + SUBQ $58, SI + MOVQ SI, BX + SUBQ R11, BX + CMPQ BX, R12 + JA errCorrupt + + // case x == 60: + CMPL CX, $61 + JEQ tagLit61 + JA tagLit62Plus + + // x = uint32(src[s-1]) + MOVBLZX -1(SI), CX + JMP doLit + +tagLit61: + // case x == 61: + // x = uint32(src[s-2]) | uint32(src[s-1])<<8 + MOVWLZX -2(SI), CX + JMP doLit + +tagLit62Plus: + CMPL CX, $62 + JA tagLit63 + + // case x == 62: + // x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16 + MOVWLZX -3(SI), CX + MOVBLZX -1(SI), BX + SHLL $16, BX + ORL BX, CX + JMP doLit + +tagLit63: + // case x == 63: + // x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + MOVL -4(SI), CX + JMP doLit + +// The code above handles literal tags. +// ---------------------------------------- +// The code below handles copy tags. + +tagCopy4: + // case tagCopy4: + // s += 5 + ADDQ $5, SI + + // if uint(s) > uint(len(src)) { etc } + MOVQ SI, BX + SUBQ R11, BX + CMPQ BX, R12 + JA errCorrupt + + // length = 1 + int(src[s-5])>>2 + SHRQ $2, CX + INCQ CX + + // offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24) + MOVLQZX -4(SI), DX + JMP doCopy + +tagCopy2: + // case tagCopy2: + // s += 3 + ADDQ $3, SI + + // if uint(s) > uint(len(src)) { etc } + MOVQ SI, BX + SUBQ R11, BX + CMPQ BX, R12 + JA errCorrupt + + // length = 1 + int(src[s-3])>>2 + SHRQ $2, CX + INCQ CX + + // offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8) + MOVWQZX -2(SI), DX + JMP doCopy + +tagCopy: + // We have a copy tag. We assume that: + // - BX == src[s] & 0x03 + // - CX == src[s] + CMPQ BX, $2 + JEQ tagCopy2 + JA tagCopy4 + + // case tagCopy1: + // s += 2 + ADDQ $2, SI + + // if uint(s) > uint(len(src)) { etc } + MOVQ SI, BX + SUBQ R11, BX + CMPQ BX, R12 + JA errCorrupt + + // offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1])) + MOVQ CX, DX + ANDQ $0xe0, DX + SHLQ $3, DX + MOVBQZX -1(SI), BX + ORQ BX, DX + + // length = 4 + int(src[s-2])>>2&0x7 + SHRQ $2, CX + ANDQ $7, CX + ADDQ $4, CX + +doCopy: + // This is the end of the outer "switch", when we have a copy tag. + // + // We assume that: + // - CX == length && CX > 0 + // - DX == offset + + // if offset <= 0 { etc } + CMPQ DX, $0 + JLE errCorrupt + + // if d < offset { etc } + MOVQ DI, BX + SUBQ R8, BX + CMPQ BX, DX + JLT errCorrupt + + // if length > len(dst)-d { etc } + MOVQ R10, BX + SUBQ DI, BX + CMPQ CX, BX + JGT errCorrupt + + // forwardCopy(dst[d:d+length], dst[d-offset:]); d += length + // + // Set: + // - R14 = len(dst)-d + // - R15 = &dst[d-offset] + MOVQ R10, R14 + SUBQ DI, R14 + MOVQ DI, R15 + SUBQ DX, R15 + + // !!! Try a faster technique for short (16 or fewer bytes) forward copies. + // + // First, try using two 8-byte load/stores, similar to the doLit technique + // above. Even if dst[d:d+length] and dst[d-offset:] can overlap, this is + // still OK if offset >= 8. Note that this has to be two 8-byte load/stores + // and not one 16-byte load/store, and the first store has to be before the + // second load, due to the overlap if offset is in the range [8, 16). + // + // if length > 16 || offset < 8 || len(dst)-d < 16 { + // goto slowForwardCopy + // } + // copy 16 bytes + // d += length + CMPQ CX, $16 + JGT slowForwardCopy + CMPQ DX, $8 + JLT slowForwardCopy + CMPQ R14, $16 + JLT slowForwardCopy + MOVQ 0(R15), AX + MOVQ AX, 0(DI) + MOVQ 8(R15), BX + MOVQ BX, 8(DI) + ADDQ CX, DI + JMP loop + +slowForwardCopy: + // !!! If the forward copy is longer than 16 bytes, or if offset < 8, we + // can still try 8-byte load stores, provided we can overrun up to 10 extra + // bytes. As above, the overrun will be fixed up by subsequent iterations + // of the outermost loop. + // + // The C++ snappy code calls this technique IncrementalCopyFastPath. Its + // commentary says: + // + // ---- + // + // The main part of this loop is a simple copy of eight bytes at a time + // until we've copied (at least) the requested amount of bytes. However, + // if d and d-offset are less than eight bytes apart (indicating a + // repeating pattern of length < 8), we first need to expand the pattern in + // order to get the correct results. For instance, if the buffer looks like + // this, with the eight-byte and patterns marked as + // intervals: + // + // abxxxxxxxxxxxx + // [------] d-offset + // [------] d + // + // a single eight-byte copy from to will repeat the pattern + // once, after which we can move two bytes without moving : + // + // ababxxxxxxxxxx + // [------] d-offset + // [------] d + // + // and repeat the exercise until the two no longer overlap. + // + // This allows us to do very well in the special case of one single byte + // repeated many times, without taking a big hit for more general cases. + // + // The worst case of extra writing past the end of the match occurs when + // offset == 1 and length == 1; the last copy will read from byte positions + // [0..7] and write to [4..11], whereas it was only supposed to write to + // position 1. Thus, ten excess bytes. + // + // ---- + // + // That "10 byte overrun" worst case is confirmed by Go's + // TestSlowForwardCopyOverrun, which also tests the fixUpSlowForwardCopy + // and finishSlowForwardCopy algorithm. + // + // if length > len(dst)-d-10 { + // goto verySlowForwardCopy + // } + SUBQ $10, R14 + CMPQ CX, R14 + JGT verySlowForwardCopy + +makeOffsetAtLeast8: + // !!! As above, expand the pattern so that offset >= 8 and we can use + // 8-byte load/stores. + // + // for offset < 8 { + // copy 8 bytes from dst[d-offset:] to dst[d:] + // length -= offset + // d += offset + // offset += offset + // // The two previous lines together means that d-offset, and therefore + // // R15, is unchanged. + // } + CMPQ DX, $8 + JGE fixUpSlowForwardCopy + MOVQ (R15), BX + MOVQ BX, (DI) + SUBQ DX, CX + ADDQ DX, DI + ADDQ DX, DX + JMP makeOffsetAtLeast8 + +fixUpSlowForwardCopy: + // !!! Add length (which might be negative now) to d (implied by DI being + // &dst[d]) so that d ends up at the right place when we jump back to the + // top of the loop. Before we do that, though, we save DI to AX so that, if + // length is positive, copying the remaining length bytes will write to the + // right place. + MOVQ DI, AX + ADDQ CX, DI + +finishSlowForwardCopy: + // !!! Repeat 8-byte load/stores until length <= 0. Ending with a negative + // length means that we overrun, but as above, that will be fixed up by + // subsequent iterations of the outermost loop. + CMPQ CX, $0 + JLE loop + MOVQ (R15), BX + MOVQ BX, (AX) + ADDQ $8, R15 + ADDQ $8, AX + SUBQ $8, CX + JMP finishSlowForwardCopy + +verySlowForwardCopy: + // verySlowForwardCopy is a simple implementation of forward copy. In C + // parlance, this is a do/while loop instead of a while loop, since we know + // that length > 0. In Go syntax: + // + // for { + // dst[d] = dst[d - offset] + // d++ + // length-- + // if length == 0 { + // break + // } + // } + MOVB (R15), BX + MOVB BX, (DI) + INCQ R15 + INCQ DI + DECQ CX + JNZ verySlowForwardCopy + JMP loop + +// The code above handles copy tags. +// ---------------------------------------- + +end: + // This is the end of the "for s < len(src)". + // + // if d != len(dst) { etc } + CMPQ DI, R10 + JNE errCorrupt + + // return 0 + MOVQ $0, ret+48(FP) + RET + +errCorrupt: + // return decodeErrCodeCorrupt + MOVQ $1, ret+48(FP) + RET diff --git a/vendor/github.com/golang/snappy/decode_other.go b/vendor/github.com/golang/snappy/decode_other.go new file mode 100644 index 0000000000..8c9f2049bc --- /dev/null +++ b/vendor/github.com/golang/snappy/decode_other.go @@ -0,0 +1,101 @@ +// Copyright 2016 The Snappy-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. + +// +build !amd64 appengine !gc noasm + +package snappy + +// decode writes the decoding of src to dst. It assumes that the varint-encoded +// length of the decompressed bytes has already been read, and that len(dst) +// equals that length. +// +// It returns 0 on success or a decodeErrCodeXxx error code on failure. +func decode(dst, src []byte) int { + var d, s, offset, length int + for s < len(src) { + switch src[s] & 0x03 { + case tagLiteral: + x := uint32(src[s] >> 2) + switch { + case x < 60: + s++ + case x == 60: + s += 2 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-1]) + case x == 61: + s += 3 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-2]) | uint32(src[s-1])<<8 + case x == 62: + s += 4 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16 + case x == 63: + s += 5 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + } + length = int(x) + 1 + if length <= 0 { + return decodeErrCodeUnsupportedLiteralLength + } + if length > len(dst)-d || length > len(src)-s { + return decodeErrCodeCorrupt + } + copy(dst[d:], src[s:s+length]) + d += length + s += length + continue + + case tagCopy1: + s += 2 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 4 + int(src[s-2])>>2&0x7 + offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1])) + + case tagCopy2: + s += 3 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 1 + int(src[s-3])>>2 + offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8) + + case tagCopy4: + s += 5 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 1 + int(src[s-5])>>2 + offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24) + } + + if offset <= 0 || d < offset || length > len(dst)-d { + return decodeErrCodeCorrupt + } + // Copy from an earlier sub-slice of dst to a later sub-slice. Unlike + // the built-in copy function, this byte-by-byte copy always runs + // forwards, even if the slices overlap. Conceptually, this is: + // + // d += forwardCopy(dst[d:d+length], dst[d-offset:]) + for end := d + length; d != end; d++ { + dst[d] = dst[d-offset] + } + } + if d != len(dst) { + return decodeErrCodeCorrupt + } + return 0 +} diff --git a/Godeps/_workspace/src/github.com/golang/snappy/encode.go b/vendor/github.com/golang/snappy/encode.go similarity index 65% rename from Godeps/_workspace/src/github.com/golang/snappy/encode.go rename to vendor/github.com/golang/snappy/encode.go index 834e3b06aa..8749689060 100644 --- a/Godeps/_workspace/src/github.com/golang/snappy/encode.go +++ b/vendor/github.com/golang/snappy/encode.go @@ -10,149 +10,74 @@ import ( "io" ) -// We limit how far copy back-references can go, the same as the C++ code. -const maxOffset = 1 << 15 - -// emitLiteral writes a literal chunk and returns the number of bytes written. -func emitLiteral(dst, lit []byte) int { - i, n := 0, uint(len(lit)-1) - switch { - case n < 60: - dst[0] = uint8(n)<<2 | tagLiteral - i = 1 - case n < 1<<8: - dst[0] = 60<<2 | tagLiteral - dst[1] = uint8(n) - i = 2 - case n < 1<<16: - dst[0] = 61<<2 | tagLiteral - dst[1] = uint8(n) - dst[2] = uint8(n >> 8) - i = 3 - case n < 1<<24: - dst[0] = 62<<2 | tagLiteral - dst[1] = uint8(n) - dst[2] = uint8(n >> 8) - dst[3] = uint8(n >> 16) - i = 4 - case int64(n) < 1<<32: - dst[0] = 63<<2 | tagLiteral - dst[1] = uint8(n) - dst[2] = uint8(n >> 8) - dst[3] = uint8(n >> 16) - dst[4] = uint8(n >> 24) - i = 5 - default: - panic("snappy: source buffer is too long") - } - if copy(dst[i:], lit) != len(lit) { - panic("snappy: destination buffer is too short") - } - return i + len(lit) -} - -// emitCopy writes a copy chunk and returns the number of bytes written. -func emitCopy(dst []byte, offset, length int) int { - i := 0 - for length > 0 { - x := length - 4 - if 0 <= x && x < 1<<3 && offset < 1<<11 { - dst[i+0] = uint8(offset>>8)&0x07<<5 | uint8(x)<<2 | tagCopy1 - dst[i+1] = uint8(offset) - i += 2 - break - } - - x = length - if x > 1<<6 { - x = 1 << 6 - } - dst[i+0] = uint8(x-1)<<2 | tagCopy2 - dst[i+1] = uint8(offset) - dst[i+2] = uint8(offset >> 8) - i += 3 - length -= x - } - return i -} - // Encode returns the encoded form of src. The returned slice may be a sub- // slice of dst if dst was large enough to hold the entire encoded block. // Otherwise, a newly allocated slice will be returned. -// It is valid to pass a nil dst. +// +// The dst and src must not overlap. It is valid to pass a nil dst. func Encode(dst, src []byte) []byte { - if n := MaxEncodedLen(len(src)); len(dst) < n { + if n := MaxEncodedLen(len(src)); n < 0 { + panic(ErrTooLarge) + } else if len(dst) < n { dst = make([]byte, n) } // The block starts with the varint-encoded length of the decompressed bytes. d := binary.PutUvarint(dst, uint64(len(src))) - // Return early if src is short. - if len(src) <= 4 { - if len(src) != 0 { - d += emitLiteral(dst[d:], src) - } - return dst[:d] - } - - // Initialize the hash table. Its size ranges from 1<<8 to 1<<14 inclusive. - const maxTableSize = 1 << 14 - shift, tableSize := uint(32-8), 1<<8 - for tableSize < maxTableSize && tableSize < len(src) { - shift-- - tableSize *= 2 - } - var table [maxTableSize]int - - // Iterate over the source bytes. - var ( - s int // The iterator position. - t int // The last position with the same hash as s. - lit int // The start position of any pending literal bytes. - ) - for s+3 < len(src) { - // Update the hash table. - b0, b1, b2, b3 := src[s], src[s+1], src[s+2], src[s+3] - h := uint32(b0) | uint32(b1)<<8 | uint32(b2)<<16 | uint32(b3)<<24 - p := &table[(h*0x1e35a7bd)>>shift] - // We need to to store values in [-1, inf) in table. To save - // some initialization time, (re)use the table's zero value - // and shift the values against this zero: add 1 on writes, - // subtract 1 on reads. - t, *p = *p-1, s+1 - // If t is invalid or src[s:s+4] differs from src[t:t+4], accumulate a literal byte. - if t < 0 || s-t >= maxOffset || b0 != src[t] || b1 != src[t+1] || b2 != src[t+2] || b3 != src[t+3] { - // Skip multiple bytes if the last match was >= 32 bytes prior. - s += 1 + (s-lit)>>5 - continue - } - // Otherwise, we have a match. First, emit any pending literal bytes. - if lit != s { - d += emitLiteral(dst[d:], src[lit:s]) + for len(src) > 0 { + p := src + src = nil + if len(p) > maxBlockSize { + p, src = p[:maxBlockSize], p[maxBlockSize:] } - // Extend the match to be as long as possible. - s0 := s - s, t = s+4, t+4 - for s < len(src) && src[s] == src[t] { - s++ - t++ + if len(p) < minNonLiteralBlockSize { + d += emitLiteral(dst[d:], p) + } else { + d += encodeBlock(dst[d:], p) } - // Emit the copied bytes. - d += emitCopy(dst[d:], s-t, s-s0) - lit = s - } - - // Emit any final pending literal bytes and return. - if lit != len(src) { - d += emitLiteral(dst[d:], src[lit:]) } return dst[:d] } +// inputMargin is the minimum number of extra input bytes to keep, inside +// encodeBlock's inner loop. On some architectures, this margin lets us +// implement a fast path for emitLiteral, where the copy of short (<= 16 byte) +// literals can be implemented as a single load to and store from a 16-byte +// register. That literal's actual length can be as short as 1 byte, so this +// can copy up to 15 bytes too much, but that's OK as subsequent iterations of +// the encoding loop will fix up the copy overrun, and this inputMargin ensures +// that we don't overrun the dst and src buffers. +const inputMargin = 16 - 1 + +// minNonLiteralBlockSize is the minimum size of the input to encodeBlock that +// could be encoded with a copy tag. This is the minimum with respect to the +// algorithm used by encodeBlock, not a minimum enforced by the file format. +// +// The encoded output must start with at least a 1 byte literal, as there are +// no previous bytes to copy. A minimal (1 byte) copy after that, generated +// from an emitCopy call in encodeBlock's main loop, would require at least +// another inputMargin bytes, for the reason above: we want any emitLiteral +// calls inside encodeBlock's main loop to use the fast path if possible, which +// requires being able to overrun by inputMargin bytes. Thus, +// minNonLiteralBlockSize equals 1 + 1 + inputMargin. +// +// The C++ code doesn't use this exact threshold, but it could, as discussed at +// https://groups.google.com/d/topic/snappy-compression/oGbhsdIJSJ8/discussion +// The difference between Go (2+inputMargin) and C++ (inputMargin) is purely an +// optimization. It should not affect the encoded form. This is tested by +// TestSameEncodingAsCppShortCopies. +const minNonLiteralBlockSize = 1 + 1 + inputMargin + // MaxEncodedLen returns the maximum length of a snappy block, given its // uncompressed length. +// +// It will return a negative value if srcLen is too large to encode. func MaxEncodedLen(srcLen int) int { + n := uint64(srcLen) + if n > 0xffffffff { + return -1 + } // Compressed data can be defined as: // compressed := item* literal* // item := literal* copy @@ -173,7 +98,11 @@ func MaxEncodedLen(srcLen int) int { // That is, 6 bytes of input turn into 7 bytes of "compressed" data. // // This last factor dominates the blowup, so the final estimate is: - return 32 + srcLen + srcLen/6 + n = 32 + n + n/6 + if n > 0xffffffff { + return -1 + } + return int(n) } var errClosed = errors.New("snappy: Writer is closed") @@ -204,7 +133,7 @@ func NewWriter(w io.Writer) *Writer { func NewBufferedWriter(w io.Writer) *Writer { return &Writer{ w: w, - ibuf: make([]byte, 0, maxUncompressedChunkLen), + ibuf: make([]byte, 0, maxBlockSize), obuf: make([]byte, obufLen), } } @@ -288,8 +217,8 @@ func (w *Writer) write(p []byte) (nRet int, errRet error) { } var uncompressed []byte - if len(p) > maxUncompressedChunkLen { - uncompressed, p = p[:maxUncompressedChunkLen], p[maxUncompressedChunkLen:] + if len(p) > maxBlockSize { + uncompressed, p = p[:maxBlockSize], p[maxBlockSize:] } else { uncompressed, p = p, nil } diff --git a/vendor/github.com/golang/snappy/encode_amd64.go b/vendor/github.com/golang/snappy/encode_amd64.go new file mode 100644 index 0000000000..2a56fb504c --- /dev/null +++ b/vendor/github.com/golang/snappy/encode_amd64.go @@ -0,0 +1,29 @@ +// Copyright 2016 The Snappy-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. + +// +build !appengine +// +build gc +// +build !noasm + +package snappy + +// emitLiteral has the same semantics as in encode_other.go. +// +//go:noescape +func emitLiteral(dst, lit []byte) int + +// emitCopy has the same semantics as in encode_other.go. +// +//go:noescape +func emitCopy(dst []byte, offset, length int) int + +// extendMatch has the same semantics as in encode_other.go. +// +//go:noescape +func extendMatch(src []byte, i, j int) int + +// encodeBlock has the same semantics as in encode_other.go. +// +//go:noescape +func encodeBlock(dst, src []byte) (d int) \ No newline at end of file diff --git a/vendor/github.com/golang/snappy/encode_amd64.s b/vendor/github.com/golang/snappy/encode_amd64.s new file mode 100644 index 0000000000..adfd979fe2 --- /dev/null +++ b/vendor/github.com/golang/snappy/encode_amd64.s @@ -0,0 +1,730 @@ +// Copyright 2016 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. + +// +build !appengine +// +build gc +// +build !noasm + +#include "textflag.h" + +// The XXX lines assemble on Go 1.4, 1.5 and 1.7, but not 1.6, due to a +// Go toolchain regression. See https://github.com/golang/go/issues/15426 and +// https://github.com/golang/snappy/issues/29 +// +// As a workaround, the package was built with a known good assembler, and +// those instructions were disassembled by "objdump -d" to yield the +// 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 +// style comments, in AT&T asm syntax. Note that rsp here is a physical +// register, not Go/asm's SP pseudo-register (see https://golang.org/doc/asm). +// The instructions were then encoded as "BYTE $0x.." sequences, which assemble +// fine on Go 1.6. + +// The asm code generally follows the pure Go code in encode_other.go, except +// where marked with a "!!!". + +// ---------------------------------------------------------------------------- + +// func emitLiteral(dst, lit []byte) int +// +// All local variables fit into registers. The register allocation: +// - AX len(lit) +// - BX n +// - DX return value +// - DI &dst[i] +// - R10 &lit[0] +// +// The 24 bytes of stack space is to call runtime·memmove. +// +// The unusual register allocation of local variables, such as R10 for the +// source pointer, matches the allocation used at the call site in encodeBlock, +// which makes it easier to manually inline this function. +TEXT ·emitLiteral(SB), NOSPLIT, $24-56 + MOVQ dst_base+0(FP), DI + MOVQ lit_base+24(FP), R10 + MOVQ lit_len+32(FP), AX + MOVQ AX, DX + MOVL AX, BX + SUBL $1, BX + + CMPL BX, $60 + JLT oneByte + CMPL BX, $256 + JLT twoBytes + +threeBytes: + MOVB $0xf4, 0(DI) + MOVW BX, 1(DI) + ADDQ $3, DI + ADDQ $3, DX + JMP memmove + +twoBytes: + MOVB $0xf0, 0(DI) + MOVB BX, 1(DI) + ADDQ $2, DI + ADDQ $2, DX + JMP memmove + +oneByte: + SHLB $2, BX + MOVB BX, 0(DI) + ADDQ $1, DI + ADDQ $1, DX + +memmove: + MOVQ DX, ret+48(FP) + + // copy(dst[i:], lit) + // + // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push + // DI, R10 and AX as arguments. + MOVQ DI, 0(SP) + MOVQ R10, 8(SP) + MOVQ AX, 16(SP) + CALL runtime·memmove(SB) + RET + +// ---------------------------------------------------------------------------- + +// func emitCopy(dst []byte, offset, length int) int +// +// All local variables fit into registers. The register allocation: +// - AX length +// - SI &dst[0] +// - DI &dst[i] +// - R11 offset +// +// The unusual register allocation of local variables, such as R11 for the +// offset, matches the allocation used at the call site in encodeBlock, which +// makes it easier to manually inline this function. +TEXT ·emitCopy(SB), NOSPLIT, $0-48 + MOVQ dst_base+0(FP), DI + MOVQ DI, SI + MOVQ offset+24(FP), R11 + MOVQ length+32(FP), AX + +loop0: + // for length >= 68 { etc } + CMPL AX, $68 + JLT step1 + + // Emit a length 64 copy, encoded as 3 bytes. + MOVB $0xfe, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $64, AX + JMP loop0 + +step1: + // if length > 64 { etc } + CMPL AX, $64 + JLE step2 + + // Emit a length 60 copy, encoded as 3 bytes. + MOVB $0xee, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $60, AX + +step2: + // if length >= 12 || offset >= 2048 { goto step3 } + CMPL AX, $12 + JGE step3 + CMPL R11, $2048 + JGE step3 + + // Emit the remaining copy, encoded as 2 bytes. + MOVB R11, 1(DI) + SHRL $8, R11 + SHLB $5, R11 + SUBB $4, AX + SHLB $2, AX + ORB AX, R11 + ORB $1, R11 + MOVB R11, 0(DI) + ADDQ $2, DI + + // Return the number of bytes written. + SUBQ SI, DI + MOVQ DI, ret+40(FP) + RET + +step3: + // Emit the remaining copy, encoded as 3 bytes. + SUBL $1, AX + SHLB $2, AX + ORB $2, AX + MOVB AX, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + + // Return the number of bytes written. + SUBQ SI, DI + MOVQ DI, ret+40(FP) + RET + +// ---------------------------------------------------------------------------- + +// func extendMatch(src []byte, i, j int) int +// +// All local variables fit into registers. The register allocation: +// - DX &src[0] +// - SI &src[j] +// - R13 &src[len(src) - 8] +// - R14 &src[len(src)] +// - R15 &src[i] +// +// The unusual register allocation of local variables, such as R15 for a source +// pointer, matches the allocation used at the call site in encodeBlock, which +// makes it easier to manually inline this function. +TEXT ·extendMatch(SB), NOSPLIT, $0-48 + MOVQ src_base+0(FP), DX + MOVQ src_len+8(FP), R14 + MOVQ i+24(FP), R15 + MOVQ j+32(FP), SI + ADDQ DX, R14 + ADDQ DX, R15 + ADDQ DX, SI + MOVQ R14, R13 + SUBQ $8, R13 + +cmp8: + // As long as we are 8 or more bytes before the end of src, we can load and + // compare 8 bytes at a time. If those 8 bytes are equal, repeat. + CMPQ SI, R13 + JA cmp1 + MOVQ (R15), AX + MOVQ (SI), BX + CMPQ AX, BX + JNE bsf + ADDQ $8, R15 + ADDQ $8, SI + JMP cmp8 + +bsf: + // If those 8 bytes were not equal, XOR the two 8 byte values, and return + // the index of the first byte that differs. The BSF instruction finds the + // least significant 1 bit, the amd64 architecture is little-endian, and + // the shift by 3 converts a bit index to a byte index. + XORQ AX, BX + BSFQ BX, BX + SHRQ $3, BX + ADDQ BX, SI + + // Convert from &src[ret] to ret. + SUBQ DX, SI + MOVQ SI, ret+40(FP) + RET + +cmp1: + // In src's tail, compare 1 byte at a time. + CMPQ SI, R14 + JAE extendMatchEnd + MOVB (R15), AX + MOVB (SI), BX + CMPB AX, BX + JNE extendMatchEnd + ADDQ $1, R15 + ADDQ $1, SI + JMP cmp1 + +extendMatchEnd: + // Convert from &src[ret] to ret. + SUBQ DX, SI + MOVQ SI, ret+40(FP) + RET + +// ---------------------------------------------------------------------------- + +// func encodeBlock(dst, src []byte) (d int) +// +// All local variables fit into registers, other than "var table". The register +// allocation: +// - AX . . +// - BX . . +// - CX 56 shift (note that amd64 shifts by non-immediates must use CX). +// - DX 64 &src[0], tableSize +// - SI 72 &src[s] +// - DI 80 &dst[d] +// - R9 88 sLimit +// - R10 . &src[nextEmit] +// - R11 96 prevHash, currHash, nextHash, offset +// - R12 104 &src[base], skip +// - R13 . &src[nextS], &src[len(src) - 8] +// - R14 . len(src), bytesBetweenHashLookups, &src[len(src)], x +// - R15 112 candidate +// +// The second column (56, 64, etc) is the stack offset to spill the registers +// when calling other functions. We could pack this slightly tighter, but it's +// simpler to have a dedicated spill map independent of the function called. +// +// "var table [maxTableSize]uint16" takes up 32768 bytes of stack space. An +// extra 56 bytes, to call other functions, and an extra 64 bytes, to spill +// local variables (registers) during calls gives 32768 + 56 + 64 = 32888. +TEXT ·encodeBlock(SB), 0, $32888-56 + MOVQ dst_base+0(FP), DI + MOVQ src_base+24(FP), SI + MOVQ src_len+32(FP), R14 + + // shift, tableSize := uint32(32-8), 1<<8 + MOVQ $24, CX + MOVQ $256, DX + +calcShift: + // for ; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 { + // shift-- + // } + CMPQ DX, $16384 + JGE varTable + CMPQ DX, R14 + JGE varTable + SUBQ $1, CX + SHLQ $1, DX + JMP calcShift + +varTable: + // var table [maxTableSize]uint16 + // + // In the asm code, unlike the Go code, we can zero-initialize only the + // first tableSize elements. Each uint16 element is 2 bytes and each MOVOU + // writes 16 bytes, so we can do only tableSize/8 writes instead of the + // 2048 writes that would zero-initialize all of table's 32768 bytes. + SHRQ $3, DX + LEAQ table-32768(SP), BX + PXOR X0, X0 + +memclr: + MOVOU X0, 0(BX) + ADDQ $16, BX + SUBQ $1, DX + JNZ memclr + + // !!! DX = &src[0] + MOVQ SI, DX + + // sLimit := len(src) - inputMargin + MOVQ R14, R9 + SUBQ $15, R9 + + // !!! Pre-emptively spill CX, DX and R9 to the stack. Their values don't + // change for the rest of the function. + MOVQ CX, 56(SP) + MOVQ DX, 64(SP) + MOVQ R9, 88(SP) + + // nextEmit := 0 + MOVQ DX, R10 + + // s := 1 + ADDQ $1, SI + + // nextHash := hash(load32(src, s), shift) + MOVL 0(SI), R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + +outer: + // for { etc } + + // skip := 32 + MOVQ $32, R12 + + // nextS := s + MOVQ SI, R13 + + // candidate := 0 + MOVQ $0, R15 + +inner0: + // for { etc } + + // s := nextS + MOVQ R13, SI + + // bytesBetweenHashLookups := skip >> 5 + MOVQ R12, R14 + SHRQ $5, R14 + + // nextS = s + bytesBetweenHashLookups + ADDQ R14, R13 + + // skip += bytesBetweenHashLookups + ADDQ R14, R12 + + // if nextS > sLimit { goto emitRemainder } + MOVQ R13, AX + SUBQ DX, AX + CMPQ AX, R9 + JA emitRemainder + + // candidate = int(table[nextHash]) + // XXX: MOVWQZX table-32768(SP)(R11*2), R15 + // XXX: 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 + BYTE $0x4e + BYTE $0x0f + BYTE $0xb7 + BYTE $0x7c + BYTE $0x5c + BYTE $0x78 + + // table[nextHash] = uint16(s) + MOVQ SI, AX + SUBQ DX, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // nextHash = hash(load32(src, nextS), shift) + MOVL 0(R13), R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // if load32(src, s) != load32(src, candidate) { continue } break + MOVL 0(SI), AX + MOVL (DX)(R15*1), BX + CMPL AX, BX + JNE inner0 + +fourByteMatch: + // As per the encode_other.go code: + // + // A 4-byte match has been found. We'll later see etc. + + // !!! Jump to a fast path for short (<= 16 byte) literals. See the comment + // on inputMargin in encode.go. + MOVQ SI, AX + SUBQ R10, AX + CMPQ AX, $16 + JLE emitLiteralFastPath + + // ---------------------------------------- + // Begin inline of the emitLiteral call. + // + // d += emitLiteral(dst[d:], src[nextEmit:s]) + + MOVL AX, BX + SUBL $1, BX + + CMPL BX, $60 + JLT inlineEmitLiteralOneByte + CMPL BX, $256 + JLT inlineEmitLiteralTwoBytes + +inlineEmitLiteralThreeBytes: + MOVB $0xf4, 0(DI) + MOVW BX, 1(DI) + ADDQ $3, DI + JMP inlineEmitLiteralMemmove + +inlineEmitLiteralTwoBytes: + MOVB $0xf0, 0(DI) + MOVB BX, 1(DI) + ADDQ $2, DI + JMP inlineEmitLiteralMemmove + +inlineEmitLiteralOneByte: + SHLB $2, BX + MOVB BX, 0(DI) + ADDQ $1, DI + +inlineEmitLiteralMemmove: + // Spill local variables (registers) onto the stack; call; unspill. + // + // copy(dst[i:], lit) + // + // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push + // DI, R10 and AX as arguments. + MOVQ DI, 0(SP) + MOVQ R10, 8(SP) + MOVQ AX, 16(SP) + ADDQ AX, DI // Finish the "d +=" part of "d += emitLiteral(etc)". + MOVQ SI, 72(SP) + MOVQ DI, 80(SP) + MOVQ R15, 112(SP) + CALL runtime·memmove(SB) + MOVQ 56(SP), CX + MOVQ 64(SP), DX + MOVQ 72(SP), SI + MOVQ 80(SP), DI + MOVQ 88(SP), R9 + MOVQ 112(SP), R15 + JMP inner1 + +inlineEmitLiteralEnd: + // End inline of the emitLiteral call. + // ---------------------------------------- + +emitLiteralFastPath: + // !!! Emit the 1-byte encoding "uint8(len(lit)-1)<<2". + MOVB AX, BX + SUBB $1, BX + SHLB $2, BX + MOVB BX, (DI) + ADDQ $1, DI + + // !!! Implement the copy from lit to dst as a 16-byte load and store. + // (Encode's documentation says that dst and src must not overlap.) + // + // This always copies 16 bytes, instead of only len(lit) bytes, but that's + // OK. Subsequent iterations will fix up the overrun. + // + // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or + // 16-byte loads and stores. This technique probably wouldn't be as + // effective on architectures that are fussier about alignment. + MOVOU 0(R10), X0 + MOVOU X0, 0(DI) + ADDQ AX, DI + +inner1: + // for { etc } + + // base := s + MOVQ SI, R12 + + // !!! offset := base - candidate + MOVQ R12, R11 + SUBQ R15, R11 + SUBQ DX, R11 + + // ---------------------------------------- + // Begin inline of the extendMatch call. + // + // s = extendMatch(src, candidate+4, s+4) + + // !!! R14 = &src[len(src)] + MOVQ src_len+32(FP), R14 + ADDQ DX, R14 + + // !!! R13 = &src[len(src) - 8] + MOVQ R14, R13 + SUBQ $8, R13 + + // !!! R15 = &src[candidate + 4] + ADDQ $4, R15 + ADDQ DX, R15 + + // !!! s += 4 + ADDQ $4, SI + +inlineExtendMatchCmp8: + // As long as we are 8 or more bytes before the end of src, we can load and + // compare 8 bytes at a time. If those 8 bytes are equal, repeat. + CMPQ SI, R13 + JA inlineExtendMatchCmp1 + MOVQ (R15), AX + MOVQ (SI), BX + CMPQ AX, BX + JNE inlineExtendMatchBSF + ADDQ $8, R15 + ADDQ $8, SI + JMP inlineExtendMatchCmp8 + +inlineExtendMatchBSF: + // If those 8 bytes were not equal, XOR the two 8 byte values, and return + // the index of the first byte that differs. The BSF instruction finds the + // least significant 1 bit, the amd64 architecture is little-endian, and + // the shift by 3 converts a bit index to a byte index. + XORQ AX, BX + BSFQ BX, BX + SHRQ $3, BX + ADDQ BX, SI + JMP inlineExtendMatchEnd + +inlineExtendMatchCmp1: + // In src's tail, compare 1 byte at a time. + CMPQ SI, R14 + JAE inlineExtendMatchEnd + MOVB (R15), AX + MOVB (SI), BX + CMPB AX, BX + JNE inlineExtendMatchEnd + ADDQ $1, R15 + ADDQ $1, SI + JMP inlineExtendMatchCmp1 + +inlineExtendMatchEnd: + // End inline of the extendMatch call. + // ---------------------------------------- + + // ---------------------------------------- + // Begin inline of the emitCopy call. + // + // d += emitCopy(dst[d:], base-candidate, s-base) + + // !!! length := s - base + MOVQ SI, AX + SUBQ R12, AX + +inlineEmitCopyLoop0: + // for length >= 68 { etc } + CMPL AX, $68 + JLT inlineEmitCopyStep1 + + // Emit a length 64 copy, encoded as 3 bytes. + MOVB $0xfe, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $64, AX + JMP inlineEmitCopyLoop0 + +inlineEmitCopyStep1: + // if length > 64 { etc } + CMPL AX, $64 + JLE inlineEmitCopyStep2 + + // Emit a length 60 copy, encoded as 3 bytes. + MOVB $0xee, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $60, AX + +inlineEmitCopyStep2: + // if length >= 12 || offset >= 2048 { goto inlineEmitCopyStep3 } + CMPL AX, $12 + JGE inlineEmitCopyStep3 + CMPL R11, $2048 + JGE inlineEmitCopyStep3 + + // Emit the remaining copy, encoded as 2 bytes. + MOVB R11, 1(DI) + SHRL $8, R11 + SHLB $5, R11 + SUBB $4, AX + SHLB $2, AX + ORB AX, R11 + ORB $1, R11 + MOVB R11, 0(DI) + ADDQ $2, DI + JMP inlineEmitCopyEnd + +inlineEmitCopyStep3: + // Emit the remaining copy, encoded as 3 bytes. + SUBL $1, AX + SHLB $2, AX + ORB $2, AX + MOVB AX, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + +inlineEmitCopyEnd: + // End inline of the emitCopy call. + // ---------------------------------------- + + // nextEmit = s + MOVQ SI, R10 + + // if s >= sLimit { goto emitRemainder } + MOVQ SI, AX + SUBQ DX, AX + CMPQ AX, R9 + JAE emitRemainder + + // As per the encode_other.go code: + // + // We could immediately etc. + + // x := load64(src, s-1) + MOVQ -1(SI), R14 + + // prevHash := hash(uint32(x>>0), shift) + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // table[prevHash] = uint16(s-1) + MOVQ SI, AX + SUBQ DX, AX + SUBQ $1, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // currHash := hash(uint32(x>>8), shift) + SHRQ $8, R14 + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // candidate = int(table[currHash]) + // XXX: MOVWQZX table-32768(SP)(R11*2), R15 + // XXX: 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 + BYTE $0x4e + BYTE $0x0f + BYTE $0xb7 + BYTE $0x7c + BYTE $0x5c + BYTE $0x78 + + // table[currHash] = uint16(s) + ADDQ $1, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // if uint32(x>>8) == load32(src, candidate) { continue } + MOVL (DX)(R15*1), BX + CMPL R14, BX + JEQ inner1 + + // nextHash = hash(uint32(x>>16), shift) + SHRQ $8, R14 + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // s++ + ADDQ $1, SI + + // break out of the inner1 for loop, i.e. continue the outer loop. + JMP outer + +emitRemainder: + // if nextEmit < len(src) { etc } + MOVQ src_len+32(FP), AX + ADDQ DX, AX + CMPQ R10, AX + JEQ encodeBlockEnd + + // d += emitLiteral(dst[d:], src[nextEmit:]) + // + // Push args. + MOVQ DI, 0(SP) + MOVQ $0, 8(SP) // Unnecessary, as the callee ignores it, but conservative. + MOVQ $0, 16(SP) // Unnecessary, as the callee ignores it, but conservative. + MOVQ R10, 24(SP) + SUBQ R10, AX + MOVQ AX, 32(SP) + MOVQ AX, 40(SP) // Unnecessary, as the callee ignores it, but conservative. + + // Spill local variables (registers) onto the stack; call; unspill. + MOVQ DI, 80(SP) + CALL ·emitLiteral(SB) + MOVQ 80(SP), DI + + // Finish the "d +=" part of "d += emitLiteral(etc)". + ADDQ 48(SP), DI + +encodeBlockEnd: + MOVQ dst_base+0(FP), AX + SUBQ AX, DI + MOVQ DI, d+48(FP) + RET diff --git a/vendor/github.com/golang/snappy/encode_other.go b/vendor/github.com/golang/snappy/encode_other.go new file mode 100644 index 0000000000..dbcae905e6 --- /dev/null +++ b/vendor/github.com/golang/snappy/encode_other.go @@ -0,0 +1,238 @@ +// Copyright 2016 The Snappy-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. + +// +build !amd64 appengine !gc noasm + +package snappy + +func load32(b []byte, i int) uint32 { + b = b[i : i+4 : len(b)] // Help the compiler eliminate bounds checks on the next line. + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +func load64(b []byte, i int) uint64 { + b = b[i : i+8 : len(b)] // Help the compiler eliminate bounds checks on the next line. + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | + uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 +} + +// emitLiteral writes a literal chunk and returns the number of bytes written. +// +// It assumes that: +// dst is long enough to hold the encoded bytes +// 1 <= len(lit) && len(lit) <= 65536 +func emitLiteral(dst, lit []byte) int { + i, n := 0, uint(len(lit)-1) + switch { + case n < 60: + dst[0] = uint8(n)<<2 | tagLiteral + i = 1 + case n < 1<<8: + dst[0] = 60<<2 | tagLiteral + dst[1] = uint8(n) + i = 2 + default: + dst[0] = 61<<2 | tagLiteral + dst[1] = uint8(n) + dst[2] = uint8(n >> 8) + i = 3 + } + return i + copy(dst[i:], lit) +} + +// emitCopy writes a copy chunk and returns the number of bytes written. +// +// It assumes that: +// dst is long enough to hold the encoded bytes +// 1 <= offset && offset <= 65535 +// 4 <= length && length <= 65535 +func emitCopy(dst []byte, offset, length int) int { + i := 0 + // The maximum length for a single tagCopy1 or tagCopy2 op is 64 bytes. The + // threshold for this loop is a little higher (at 68 = 64 + 4), and the + // length emitted down below is is a little lower (at 60 = 64 - 4), because + // it's shorter to encode a length 67 copy as a length 60 tagCopy2 followed + // by a length 7 tagCopy1 (which encodes as 3+2 bytes) than to encode it as + // a length 64 tagCopy2 followed by a length 3 tagCopy2 (which encodes as + // 3+3 bytes). The magic 4 in the 64±4 is because the minimum length for a + // tagCopy1 op is 4 bytes, which is why a length 3 copy has to be an + // encodes-as-3-bytes tagCopy2 instead of an encodes-as-2-bytes tagCopy1. + for length >= 68 { + // Emit a length 64 copy, encoded as 3 bytes. + dst[i+0] = 63<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + i += 3 + length -= 64 + } + if length > 64 { + // Emit a length 60 copy, encoded as 3 bytes. + dst[i+0] = 59<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + i += 3 + length -= 60 + } + if length >= 12 || offset >= 2048 { + // Emit the remaining copy, encoded as 3 bytes. + dst[i+0] = uint8(length-1)<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + return i + 3 + } + // Emit the remaining copy, encoded as 2 bytes. + dst[i+0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1 + dst[i+1] = uint8(offset) + return i + 2 +} + +// extendMatch returns the largest k such that k <= len(src) and that +// src[i:i+k-j] and src[j:k] have the same contents. +// +// It assumes that: +// 0 <= i && i < j && j <= len(src) +func extendMatch(src []byte, i, j int) int { + for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 { + } + return j +} + +func hash(u, shift uint32) uint32 { + return (u * 0x1e35a7bd) >> shift +} + +// encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It +// assumes that the varint-encoded length of the decompressed bytes has already +// been written. +// +// It also assumes that: +// len(dst) >= MaxEncodedLen(len(src)) && +// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize +func encodeBlock(dst, src []byte) (d int) { + // Initialize the hash table. Its size ranges from 1<<8 to 1<<14 inclusive. + // The table element type is uint16, as s < sLimit and sLimit < len(src) + // and len(src) <= maxBlockSize and maxBlockSize == 65536. + const ( + maxTableSize = 1 << 14 + // tableMask is redundant, but helps the compiler eliminate bounds + // checks. + tableMask = maxTableSize - 1 + ) + shift := uint32(32 - 8) + for tableSize := 1 << 8; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 { + shift-- + } + // In Go, all array elements are zero-initialized, so there is no advantage + // to a smaller tableSize per se. However, it matches the C++ algorithm, + // and in the asm versions of this code, we can get away with zeroing only + // the first tableSize elements. + var table [maxTableSize]uint16 + + // sLimit is when to stop looking for offset/length copies. The inputMargin + // lets us use a fast path for emitLiteral in the main loop, while we are + // looking for copies. + sLimit := len(src) - inputMargin + + // nextEmit is where in src the next emitLiteral should start from. + nextEmit := 0 + + // The encoded form must start with a literal, as there are no previous + // bytes to copy, so we start looking for hash matches at s == 1. + s := 1 + nextHash := hash(load32(src, s), shift) + + for { + // Copied from the C++ snappy implementation: + // + // Heuristic match skipping: If 32 bytes are scanned with no matches + // found, start looking only at every other byte. If 32 more bytes are + // scanned (or skipped), look at every third byte, etc.. When a match + // is found, immediately go back to looking at every byte. This is a + // small loss (~5% performance, ~0.1% density) for compressible data + // due to more bookkeeping, but for non-compressible data (such as + // JPEG) it's a huge win since the compressor quickly "realizes" the + // data is incompressible and doesn't bother looking for matches + // everywhere. + // + // The "skip" variable keeps track of how many bytes there are since + // the last match; dividing it by 32 (ie. right-shifting by five) gives + // the number of bytes to move ahead for each iteration. + skip := 32 + + nextS := s + candidate := 0 + for { + s = nextS + bytesBetweenHashLookups := skip >> 5 + nextS = s + bytesBetweenHashLookups + skip += bytesBetweenHashLookups + if nextS > sLimit { + goto emitRemainder + } + candidate = int(table[nextHash&tableMask]) + table[nextHash&tableMask] = uint16(s) + nextHash = hash(load32(src, nextS), shift) + if load32(src, s) == load32(src, candidate) { + break + } + } + + // A 4-byte match has been found. We'll later see if more than 4 bytes + // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit + // them as literal bytes. + d += emitLiteral(dst[d:], src[nextEmit:s]) + + // Call emitCopy, and then see if another emitCopy could be our next + // move. Repeat until we find no match for the input immediately after + // what was consumed by the last emitCopy call. + // + // If we exit this loop normally then we need to call emitLiteral next, + // though we don't yet know how big the literal will be. We handle that + // by proceeding to the next iteration of the main loop. We also can + // exit this loop via goto if we get close to exhausting the input. + for { + // Invariant: we have a 4-byte match at s, and no need to emit any + // literal bytes prior to s. + base := s + + // Extend the 4-byte match as long as possible. + // + // This is an inlined version of: + // s = extendMatch(src, candidate+4, s+4) + s += 4 + for i := candidate + 4; s < len(src) && src[i] == src[s]; i, s = i+1, s+1 { + } + + d += emitCopy(dst[d:], base-candidate, s-base) + nextEmit = s + if s >= sLimit { + goto emitRemainder + } + + // We could immediately start working at s now, but to improve + // compression we first update the hash table at s-1 and at s. If + // another emitCopy is not our next move, also calculate nextHash + // at s+1. At least on GOARCH=amd64, these three hash calculations + // are faster as one load64 call (with some shifts) instead of + // three load32 calls. + x := load64(src, s-1) + prevHash := hash(uint32(x>>0), shift) + table[prevHash&tableMask] = uint16(s - 1) + currHash := hash(uint32(x>>8), shift) + candidate = int(table[currHash&tableMask]) + table[currHash&tableMask] = uint16(s) + if uint32(x>>8) != load32(src, candidate) { + nextHash = hash(uint32(x>>16), shift) + s++ + break + } + } + } + +emitRemainder: + if nextEmit < len(src) { + d += emitLiteral(dst[d:], src[nextEmit:]) + } + return d +} diff --git a/Godeps/_workspace/src/github.com/golang/snappy/snappy.go b/vendor/github.com/golang/snappy/snappy.go similarity index 71% rename from Godeps/_workspace/src/github.com/golang/snappy/snappy.go rename to vendor/github.com/golang/snappy/snappy.go index ef1e33e00b..0cf5e379c4 100644 --- a/Godeps/_workspace/src/github.com/golang/snappy/snappy.go +++ b/vendor/github.com/golang/snappy/snappy.go @@ -6,7 +6,7 @@ // It aims for very high speeds and reasonable compression. // // The C++ snappy implementation is at https://github.com/google/snappy -package snappy +package snappy // import "github.com/golang/snappy" import ( "hash/crc32" @@ -32,7 +32,10 @@ Lempel-Ziv compression algorithms. In particular: - For l == 2, the offset ranges in [0, 1<<16) and the length in [1, 65). The length is 1 + m. The offset is the little-endian unsigned integer denoted by the next 2 bytes. - - For l == 3, this tag is a legacy format that is no longer supported. + - For l == 3, this tag is a legacy format that is no longer issued by most + encoders. Nonetheless, the offset ranges in [0, 1<<32) and the length in + [1, 65). The length is 1 + m. The offset is the little-endian unsigned + integer denoted by the next 4 bytes. */ const ( tagLiteral = 0x00 @@ -46,18 +49,25 @@ const ( chunkHeaderSize = 4 magicChunk = "\xff\x06\x00\x00" + magicBody magicBody = "sNaPpY" + + // maxBlockSize is the maximum size of the input to encodeBlock. It is not + // part of the wire format per se, but some parts of the encoder assume + // that an offset fits into a uint16. + // + // Also, for the framing format (Writer type instead of Encode function), // https://github.com/google/snappy/blob/master/framing_format.txt says - // that "the uncompressed data in a chunk must be no longer than 65536 bytes". - maxUncompressedChunkLen = 65536 + // that "the uncompressed data in a chunk must be no longer than 65536 + // bytes". + maxBlockSize = 65536 - // maxEncodedLenOfMaxUncompressedChunkLen equals - // MaxEncodedLen(maxUncompressedChunkLen), but is hard coded to be a const - // instead of a variable, so that obufLen can also be a const. Their - // equivalence is confirmed by TestMaxEncodedLenOfMaxUncompressedChunkLen. - maxEncodedLenOfMaxUncompressedChunkLen = 76490 + // maxEncodedLenOfMaxBlockSize equals MaxEncodedLen(maxBlockSize), but is + // hard coded to be a const instead of a variable, so that obufLen can also + // be a const. Their equivalence is confirmed by + // TestMaxEncodedLenOfMaxBlockSize. + maxEncodedLenOfMaxBlockSize = 76490 obufHeaderLen = len(magicChunk) + checksumSize + chunkHeaderSize - obufLen = obufHeaderLen + maxEncodedLenOfMaxUncompressedChunkLen + obufLen = obufHeaderLen + maxEncodedLenOfMaxBlockSize ) const ( diff --git a/Godeps/_workspace/src/github.com/hashicorp/golang-lru/.gitignore b/vendor/github.com/hashicorp/golang-lru/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/hashicorp/golang-lru/.gitignore rename to vendor/github.com/hashicorp/golang-lru/.gitignore diff --git a/Godeps/_workspace/src/github.com/hashicorp/golang-lru/2q.go b/vendor/github.com/hashicorp/golang-lru/2q.go similarity index 100% rename from Godeps/_workspace/src/github.com/hashicorp/golang-lru/2q.go rename to vendor/github.com/hashicorp/golang-lru/2q.go diff --git a/Godeps/_workspace/src/github.com/hashicorp/golang-lru/LICENSE b/vendor/github.com/hashicorp/golang-lru/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/hashicorp/golang-lru/LICENSE rename to vendor/github.com/hashicorp/golang-lru/LICENSE diff --git a/Godeps/_workspace/src/github.com/hashicorp/golang-lru/README.md b/vendor/github.com/hashicorp/golang-lru/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/hashicorp/golang-lru/README.md rename to vendor/github.com/hashicorp/golang-lru/README.md diff --git a/Godeps/_workspace/src/github.com/hashicorp/golang-lru/arc.go b/vendor/github.com/hashicorp/golang-lru/arc.go similarity index 100% rename from Godeps/_workspace/src/github.com/hashicorp/golang-lru/arc.go rename to vendor/github.com/hashicorp/golang-lru/arc.go diff --git a/Godeps/_workspace/src/github.com/hashicorp/golang-lru/lru.go b/vendor/github.com/hashicorp/golang-lru/lru.go similarity index 100% rename from Godeps/_workspace/src/github.com/hashicorp/golang-lru/lru.go rename to vendor/github.com/hashicorp/golang-lru/lru.go diff --git a/Godeps/_workspace/src/github.com/hashicorp/golang-lru/simplelru/lru.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go similarity index 99% rename from Godeps/_workspace/src/github.com/hashicorp/golang-lru/simplelru/lru.go rename to vendor/github.com/hashicorp/golang-lru/simplelru/lru.go index 68d097a1c0..cb416b394f 100644 --- a/Godeps/_workspace/src/github.com/hashicorp/golang-lru/simplelru/lru.go +++ b/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go @@ -47,7 +47,7 @@ func (c *LRU) Purge() { c.evictList.Init() } -// Add adds a value to the cache. Returns true if an eviction occured. +// Add adds a value to the cache. Returns true if an eviction occurred. func (c *LRU) Add(key, value interface{}) bool { // Check for existing item if ent, ok := c.items[key]; ok { diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/.gitignore b/vendor/github.com/huin/goupnp/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/.gitignore rename to vendor/github.com/huin/goupnp/.gitignore diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/LICENSE b/vendor/github.com/huin/goupnp/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/LICENSE rename to vendor/github.com/huin/goupnp/LICENSE diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/README.md b/vendor/github.com/huin/goupnp/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/README.md rename to vendor/github.com/huin/goupnp/README.md diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway1/internetgateway1.go b/vendor/github.com/huin/goupnp/dcps/internetgateway1/internetgateway1.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway1/internetgateway1.go rename to vendor/github.com/huin/goupnp/dcps/internetgateway1/internetgateway1.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway2/internetgateway2.go b/vendor/github.com/huin/goupnp/dcps/internetgateway2/internetgateway2.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway2/internetgateway2.go rename to vendor/github.com/huin/goupnp/dcps/internetgateway2/internetgateway2.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/device.go b/vendor/github.com/huin/goupnp/device.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/device.go rename to vendor/github.com/huin/goupnp/device.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go b/vendor/github.com/huin/goupnp/goupnp.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go rename to vendor/github.com/huin/goupnp/goupnp.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go b/vendor/github.com/huin/goupnp/httpu/httpu.go similarity index 87% rename from Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go rename to vendor/github.com/huin/goupnp/httpu/httpu.go index 862c3def42..f52dad68b1 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go +++ b/vendor/github.com/huin/goupnp/httpu/httpu.go @@ -3,6 +3,7 @@ package httpu import ( "bufio" "bytes" + "errors" "fmt" "log" "net" @@ -28,6 +29,20 @@ func NewHTTPUClient() (*HTTPUClient, error) { return &HTTPUClient{conn: conn}, nil } +// NewHTTPUClientAddr creates a new HTTPUClient which will broadcast packets +// from the specified address, opening up a new UDP socket for the purpose +func NewHTTPUClientAddr(addr string) (*HTTPUClient, error) { + ip := net.ParseIP(addr) + if ip == nil { + return nil, errors.New("Invalid listening address") + } + conn, err := net.ListenPacket("udp", ip.String()+":0") + if err != nil { + return nil, err + } + return &HTTPUClient{conn: conn}, nil +} + // Close shuts down the client. The client will no longer be useful following // this. func (httpu *HTTPUClient) Close() error { diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/serve.go b/vendor/github.com/huin/goupnp/httpu/serve.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/httpu/serve.go rename to vendor/github.com/huin/goupnp/httpu/serve.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/scpd/scpd.go b/vendor/github.com/huin/goupnp/scpd/scpd.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/scpd/scpd.go rename to vendor/github.com/huin/goupnp/scpd/scpd.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/service_client.go b/vendor/github.com/huin/goupnp/service_client.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/service_client.go rename to vendor/github.com/huin/goupnp/service_client.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go b/vendor/github.com/huin/goupnp/soap/soap.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go rename to vendor/github.com/huin/goupnp/soap/soap.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/soap/types.go b/vendor/github.com/huin/goupnp/soap/types.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/soap/types.go rename to vendor/github.com/huin/goupnp/soap/types.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/ssdp/registry.go b/vendor/github.com/huin/goupnp/ssdp/registry.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/ssdp/registry.go rename to vendor/github.com/huin/goupnp/ssdp/registry.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/ssdp/ssdp.go b/vendor/github.com/huin/goupnp/ssdp/ssdp.go similarity index 100% rename from Godeps/_workspace/src/github.com/huin/goupnp/ssdp/ssdp.go rename to vendor/github.com/huin/goupnp/ssdp/ssdp.go diff --git a/vendor/github.com/jackpal/go-nat-pmp/.travis.yml b/vendor/github.com/jackpal/go-nat-pmp/.travis.yml new file mode 100644 index 0000000000..9c3f6547da --- /dev/null +++ b/vendor/github.com/jackpal/go-nat-pmp/.travis.yml @@ -0,0 +1,13 @@ +language: go + +go: + - 1.6.2 + - tip + +allowed_failures: + - go: tip + +install: + - go get -d -v ./... && go install -race -v ./... + +script: go test -race -v ./... diff --git a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/LICENSE b/vendor/github.com/jackpal/go-nat-pmp/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/LICENSE rename to vendor/github.com/jackpal/go-nat-pmp/LICENSE diff --git a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/README.md b/vendor/github.com/jackpal/go-nat-pmp/README.md similarity index 73% rename from Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/README.md rename to vendor/github.com/jackpal/go-nat-pmp/README.md index 15f72fd815..3ca687f0b7 100644 --- a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/README.md +++ b/vendor/github.com/jackpal/go-nat-pmp/README.md @@ -8,6 +8,9 @@ NAT-PMP is supported by Apple brand routers and open source routers like Tomato See http://tools.ietf.org/html/draft-cheshire-nat-pmp-03 + +[![Build Status](https://travis-ci.org/jackpal/go-nat-pmp.svg)](https://travis-ci.org/jackpal/go-nat-pmp) + Get the package --------------- @@ -16,7 +19,15 @@ Get the package Usage ----- - import natpmp "github.com/jackpal/go-nat-pmp" + import ( + "github.com/jackpal/gateway" + natpmp "github.com/jackpal/go-nat-pmp" + ) + + gatewayIP, err = gateway.DiscoverGateway() + if err != nil { + return + } client := natpmp.NewClient(gatewayIP) response, err := client.GetExternalAddress() @@ -25,13 +36,6 @@ Usage } print("External IP address:", response.ExternalIPAddress) -Notes ------ - -There doesn't seem to be an easy way to programmatically determine the address of the default gateway. -(Linux and OSX have a "routes" kernel API that can be examined to get this information, but there is -no Go package for getting this information.) - Clients ------- diff --git a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go b/vendor/github.com/jackpal/go-nat-pmp/natpmp.go similarity index 60% rename from Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go rename to vendor/github.com/jackpal/go-nat-pmp/natpmp.go index 7d9fb604ee..5ca7680e41 100644 --- a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go +++ b/vendor/github.com/jackpal/go-nat-pmp/natpmp.go @@ -2,8 +2,6 @@ package natpmp import ( "fmt" - "github.com/jackpal/gateway" - "log" "net" "time" ) @@ -18,37 +16,33 @@ import ( // client := natpmp.NewClient(gatewayIP) // response, err := client.GetExternalAddress() -const nAT_PMP_PORT = 5351 - -const nAT_TRIES = 9 - -const nAT_INITIAL_MS = 250 - // The recommended mapping lifetime for AddPortMapping const RECOMMENDED_MAPPING_LIFETIME_SECONDS = 3600 +// Interface used to make remote procedure calls. +type caller interface { + call(msg []byte, timeout time.Duration) (result []byte, err error) +} + // Client is a NAT-PMP protocol client. type Client struct { - gateway net.IP + caller caller + timeout time.Duration } // Create a NAT-PMP client for the NAT-PMP server at the gateway. +// Uses default timeout which is around 128 seconds. func NewClient(gateway net.IP) (nat *Client) { - return &Client{gateway} + return &Client{&network{gateway}, 0} } -// Create a NAT-PMP client for the NAT-PMP server at the default gateway. -func NewClientForDefaultGateway() (nat *Client, err error) { - var g net.IP - g, err = gateway.DiscoverGateway() - if err != nil { - return - } - nat = NewClient(g) - return +// Create a NAT-PMP client for the NAT-PMP server at the gateway, with a timeout. +// Timeout defines the total amount of time we will keep retrying before giving up. +func NewClientWithTimeout(gateway net.IP, timeout time.Duration) (nat *Client) { + return &Client{&network{gateway}, timeout} } -// Results of the NAT-PMP GetExternalAddress operation +// Results of the NAT-PMP GetExternalAddress operation. type GetExternalAddressResult struct { SecondsSinceStartOfEpoc uint32 ExternalIPAddress [4]byte @@ -107,71 +101,34 @@ func (n *Client) AddPortMapping(protocol string, internalPort, requestedExternal } func (n *Client) rpc(msg []byte, resultSize int) (result []byte, err error) { - var server net.UDPAddr - server.IP = n.gateway - server.Port = nAT_PMP_PORT - conn, err := net.DialUDP("udp", nil, &server) + result, err = n.caller.call(msg, n.timeout) if err != nil { return } - defer conn.Close() - - result = make([]byte, resultSize) - - needNewDeadline := true - - var tries uint - for tries = 0; tries < nAT_TRIES; { - if needNewDeadline { - err = conn.SetDeadline(time.Now().Add((nAT_INITIAL_MS << tries) * time.Millisecond)) - if err != nil { - return - } - needNewDeadline = false - } - _, err = conn.Write(msg) - if err != nil { - return - } - var bytesRead int - var remoteAddr *net.UDPAddr - bytesRead, remoteAddr, err = conn.ReadFromUDP(result) - if err != nil { - if err.(net.Error).Timeout() { - tries++ - needNewDeadline = true - continue - } - return - } - if !remoteAddr.IP.Equal(n.gateway) { - log.Printf("Ignoring packet because IPs differ:", remoteAddr, n.gateway) - // Ignore this packet. - // Continue without increasing retransmission timeout or deadline. - continue - } - if bytesRead != resultSize { - err = fmt.Errorf("unexpected result size %d, expected %d", bytesRead, resultSize) - return - } - if result[0] != 0 { - err = fmt.Errorf("unknown protocol version %d", result[0]) - return - } - expectedOp := msg[1] | 0x80 - if result[1] != expectedOp { - err = fmt.Errorf("Unexpected opcode %d. Expected %d", result[1], expectedOp) - return - } - resultCode := readNetworkOrderUint16(result[2:4]) - if resultCode != 0 { - err = fmt.Errorf("Non-zero result code %d", resultCode) - return - } - // If we got here the RPC is good. + err = protocolChecks(msg, resultSize, result) + return +} + +func protocolChecks(msg []byte, resultSize int, result []byte) (err error) { + if len(result) != resultSize { + err = fmt.Errorf("unexpected result size %d, expected %d", len(result), resultSize) + return + } + if result[0] != 0 { + err = fmt.Errorf("unknown protocol version %d", result[0]) + return + } + expectedOp := msg[1] | 0x80 + if result[1] != expectedOp { + err = fmt.Errorf("Unexpected opcode %d. Expected %d", result[1], expectedOp) + return + } + resultCode := readNetworkOrderUint16(result[2:4]) + if resultCode != 0 { + err = fmt.Errorf("Non-zero result code %d", resultCode) return } - err = fmt.Errorf("Timed out trying to contact gateway") + // If we got here the RPC is good. return } diff --git a/vendor/github.com/jackpal/go-nat-pmp/network.go b/vendor/github.com/jackpal/go-nat-pmp/network.go new file mode 100644 index 0000000000..c42b4fee9d --- /dev/null +++ b/vendor/github.com/jackpal/go-nat-pmp/network.go @@ -0,0 +1,89 @@ +package natpmp + +import ( + "fmt" + "net" + "time" +) + +const nAT_PMP_PORT = 5351 +const nAT_TRIES = 9 +const nAT_INITIAL_MS = 250 + +// A caller that implements the NAT-PMP RPC protocol. +type network struct { + gateway net.IP +} + +func (n *network) call(msg []byte, timeout time.Duration) (result []byte, err error) { + var server net.UDPAddr + server.IP = n.gateway + server.Port = nAT_PMP_PORT + conn, err := net.DialUDP("udp", nil, &server) + if err != nil { + return + } + defer conn.Close() + + // 16 bytes is the maximum result size. + result = make([]byte, 16) + + var finalTimeout time.Time + if timeout != 0 { + finalTimeout = time.Now().Add(timeout) + } + + needNewDeadline := true + + var tries uint + for tries = 0; (tries < nAT_TRIES && finalTimeout.IsZero()) || time.Now().Before(finalTimeout); { + if needNewDeadline { + nextDeadline := time.Now().Add((nAT_INITIAL_MS << tries) * time.Millisecond) + err = conn.SetDeadline(minTime(nextDeadline, finalTimeout)) + if err != nil { + return + } + needNewDeadline = false + } + _, err = conn.Write(msg) + if err != nil { + return + } + var bytesRead int + var remoteAddr *net.UDPAddr + bytesRead, remoteAddr, err = conn.ReadFromUDP(result) + if err != nil { + if err.(net.Error).Timeout() { + tries++ + needNewDeadline = true + continue + } + return + } + if !remoteAddr.IP.Equal(n.gateway) { + // Ignore this packet. + // Continue without increasing retransmission timeout or deadline. + continue + } + // Trim result to actual number of bytes received + if bytesRead < len(result) { + result = result[:bytesRead] + } + return + } + err = fmt.Errorf("Timed out trying to contact gateway") + return +} + +func minTime(a, b time.Time) time.Time { + if a.IsZero() { + return b + } + if b.IsZero() { + return a + } + if a.Before(b) { + return a + } + return b +} diff --git a/vendor/github.com/jackpal/go-nat-pmp/recorder.go b/vendor/github.com/jackpal/go-nat-pmp/recorder.go new file mode 100644 index 0000000000..845703672b --- /dev/null +++ b/vendor/github.com/jackpal/go-nat-pmp/recorder.go @@ -0,0 +1,19 @@ +package natpmp + +import "time" + +type callObserver interface { + observeCall(msg []byte, result []byte, err error) +} + +// A caller that records the RPC call. +type recorder struct { + child caller + observer callObserver +} + +func (n *recorder) call(msg []byte, timeout time.Duration) (result []byte, err error) { + result, err = n.child.call(msg, timeout) + n.observer.observeCall(msg, result, err) + return +} diff --git a/vendor/github.com/mattn/go-colorable/.travis.yml b/vendor/github.com/mattn/go-colorable/.travis.yml new file mode 100644 index 0000000000..42768b8bf3 --- /dev/null +++ b/vendor/github.com/mattn/go-colorable/.travis.yml @@ -0,0 +1,8 @@ +language: go +go: + - tip + +sudo: false + +script: + - go test -v diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/LICENSE b/vendor/github.com/mattn/go-colorable/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-colorable/LICENSE rename to vendor/github.com/mattn/go-colorable/LICENSE diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/README.md b/vendor/github.com/mattn/go-colorable/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-colorable/README.md rename to vendor/github.com/mattn/go-colorable/README.md diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go b/vendor/github.com/mattn/go-colorable/colorable_others.go similarity index 55% rename from Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go rename to vendor/github.com/mattn/go-colorable/colorable_others.go index 219f02f62a..52d6653b34 100644 --- a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go +++ b/vendor/github.com/mattn/go-colorable/colorable_others.go @@ -7,6 +7,14 @@ import ( "os" ) +func NewColorable(file *os.File) io.Writer { + if file == nil { + panic("nil passed instead of *os.File to NewColorable()") + } + + return file +} + func NewColorableStdout() io.Writer { return os.Stdout } diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go b/vendor/github.com/mattn/go-colorable/colorable_windows.go similarity index 89% rename from Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go rename to vendor/github.com/mattn/go-colorable/colorable_windows.go index c551f77254..bc84adfaff 100644 --- a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go +++ b/vendor/github.com/mattn/go-colorable/colorable_windows.go @@ -2,7 +2,6 @@ package colorable import ( "bytes" - "fmt" "io" "math" "os" @@ -52,6 +51,11 @@ type consoleScreenBufferInfo struct { maximumWindowSize coord } +type consoleCursorInfo struct { + size dword + visible int32 +} + var ( kernel32 = syscall.NewLazyDLL("kernel32.dll") procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo") @@ -59,6 +63,8 @@ var ( procSetConsoleCursorPosition = kernel32.NewProc("SetConsoleCursorPosition") procFillConsoleOutputCharacter = kernel32.NewProc("FillConsoleOutputCharacterW") procFillConsoleOutputAttribute = kernel32.NewProc("FillConsoleOutputAttribute") + procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo") + procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo") ) type Writer struct { @@ -68,26 +74,27 @@ type Writer struct { oldattr word } -func NewColorableStdout() io.Writer { - var csbi consoleScreenBufferInfo - out := os.Stdout - if !isatty.IsTerminal(out.Fd()) { - return out +func NewColorable(file *os.File) io.Writer { + if file == nil { + panic("nil passed instead of *os.File to NewColorable()") + } + + if isatty.IsTerminal(file.Fd()) { + var csbi consoleScreenBufferInfo + handle := syscall.Handle(file.Fd()) + procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) + return &Writer{out: file, handle: handle, oldattr: csbi.attributes} + } else { + return file } - handle := syscall.Handle(out.Fd()) - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - return &Writer{out: out, handle: handle, oldattr: csbi.attributes} +} + +func NewColorableStdout() io.Writer { + return NewColorable(os.Stdout) } func NewColorableStderr() io.Writer { - var csbi consoleScreenBufferInfo - out := os.Stderr - if !isatty.IsTerminal(out.Fd()) { - return out - } - handle := syscall.Handle(out.Fd()) - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - return &Writer{out: out, handle: handle, oldattr: csbi.attributes} + return NewColorable(os.Stderr) } var color256 = map[int]int{ @@ -353,7 +360,8 @@ func (w *Writer) Write(data []byte) (n int, err error) { var csbi consoleScreenBufferInfo procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) - er := bytes.NewBuffer(data) + er := bytes.NewReader(data) + var bw [1]byte loop: for { r1, _, err := procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) @@ -361,32 +369,33 @@ loop: break loop } - c1, _, err := er.ReadRune() + c1, err := er.ReadByte() if err != nil { break loop } if c1 != 0x1b { - fmt.Fprint(w.out, string(c1)) + bw[0] = c1 + w.out.Write(bw[:]) continue } - c2, _, err := er.ReadRune() + c2, err := er.ReadByte() if err != nil { - w.lastbuf.WriteRune(c1) + w.lastbuf.WriteByte(c1) break loop } if c2 != 0x5b { - w.lastbuf.WriteRune(c1) - w.lastbuf.WriteRune(c2) + w.lastbuf.WriteByte(c1) + w.lastbuf.WriteByte(c2) continue } var buf bytes.Buffer - var m rune + var m byte for { - c, _, err := er.ReadRune() + c, err := er.ReadByte() if err != nil { - w.lastbuf.WriteRune(c1) - w.lastbuf.WriteRune(c2) + w.lastbuf.WriteByte(c1) + w.lastbuf.WriteByte(c2) w.lastbuf.Write(buf.Bytes()) break loop } @@ -458,7 +467,7 @@ loop: continue } procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) - csbi.cursorPosition.x = short(n) + csbi.cursorPosition.x = short(n - 1) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'H': token := strings.Split(buf.String(), ";") @@ -473,14 +482,15 @@ loop: if err != nil { continue } - csbi.cursorPosition.x = short(n2) - csbi.cursorPosition.x = short(n1) + csbi.cursorPosition.x = short(n2 - 1) + csbi.cursorPosition.y = short(n1 - 1) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'J': n, err := strconv.Atoi(buf.String()) if err != nil { continue } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) var cursor coord switch n { case 0: @@ -499,6 +509,7 @@ loop: if err != nil { continue } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) var cursor coord switch n { case 0: @@ -513,6 +524,7 @@ loop: procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) case 'm': + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) attr := csbi.attributes cs := buf.String() if cs == "" { @@ -520,7 +532,7 @@ loop: continue } token := strings.Split(cs, ";") - for i := 0; i < len(token); i += 1 { + for i := 0; i < len(token); i++ { ns := token[i] if n, err = strconv.Atoi(ns); err == nil { switch { @@ -535,7 +547,7 @@ loop: case n == 27: attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) case 30 <= n && n <= 37: - attr = (attr & backgroundMask) + attr &= backgroundMask if (n-30)&1 != 0 { attr |= foregroundRed } @@ -562,7 +574,7 @@ loop: attr &= backgroundMask attr |= w.oldattr & foregroundMask case 40 <= n && n <= 47: - attr = (attr & foregroundMask) + attr &= foregroundMask if (n-40)&1 != 0 { attr |= backgroundRed } @@ -616,6 +628,22 @@ loop: procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr)) } } + case 'h': + cs := buf.String() + if cs == "?25" { + var ci consoleCursorInfo + procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) + ci.visible = 1 + procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) + } + case 'l': + cs := buf.String() + if cs == "?25" { + var ci consoleCursorInfo + procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) + ci.visible = 0 + procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) + } } } return len(data) - w.lastbuf.Len(), nil diff --git a/vendor/github.com/mattn/go-colorable/noncolorable.go b/vendor/github.com/mattn/go-colorable/noncolorable.go new file mode 100644 index 0000000000..b60801dcd5 --- /dev/null +++ b/vendor/github.com/mattn/go-colorable/noncolorable.go @@ -0,0 +1,58 @@ +package colorable + +import ( + "bytes" + "io" +) + +type NonColorable struct { + out io.Writer + lastbuf bytes.Buffer +} + +func NewNonColorable(w io.Writer) io.Writer { + return &NonColorable{out: w} +} + +func (w *NonColorable) Write(data []byte) (n int, err error) { + er := bytes.NewReader(data) + var bw [1]byte +loop: + for { + c1, err := er.ReadByte() + if err != nil { + break loop + } + if c1 != 0x1b { + bw[0] = c1 + w.out.Write(bw[:]) + continue + } + c2, err := er.ReadByte() + if err != nil { + w.lastbuf.WriteByte(c1) + break loop + } + if c2 != 0x5b { + w.lastbuf.WriteByte(c1) + w.lastbuf.WriteByte(c2) + continue + } + + var buf bytes.Buffer + for { + c, err := er.ReadByte() + if err != nil { + w.lastbuf.WriteByte(c1) + w.lastbuf.WriteByte(c2) + w.lastbuf.Write(buf.Bytes()) + break loop + } + if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { + break + } + buf.Write([]byte(string(c))) + } + } + return len(data) - w.lastbuf.Len(), nil +} diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/LICENSE b/vendor/github.com/mattn/go-isatty/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-isatty/LICENSE rename to vendor/github.com/mattn/go-isatty/LICENSE diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/README.md b/vendor/github.com/mattn/go-isatty/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-isatty/README.md rename to vendor/github.com/mattn/go-isatty/README.md diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/doc.go b/vendor/github.com/mattn/go-isatty/doc.go similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-isatty/doc.go rename to vendor/github.com/mattn/go-isatty/doc.go diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_appengine.go b/vendor/github.com/mattn/go-isatty/isatty_appengine.go similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_appengine.go rename to vendor/github.com/mattn/go-isatty/isatty_appengine.go diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go similarity index 88% rename from Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_bsd.go rename to vendor/github.com/mattn/go-isatty/isatty_bsd.go index 98ffe86a4b..42f2514d13 100644 --- a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_bsd.go +++ b/vendor/github.com/mattn/go-isatty/isatty_bsd.go @@ -1,4 +1,4 @@ -// +build darwin freebsd openbsd netbsd +// +build darwin freebsd openbsd netbsd dragonfly // +build !appengine package isatty diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_linux.go b/vendor/github.com/mattn/go-isatty/isatty_linux.go similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_linux.go rename to vendor/github.com/mattn/go-isatty/isatty_linux.go diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_solaris.go b/vendor/github.com/mattn/go-isatty/isatty_solaris.go similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_solaris.go rename to vendor/github.com/mattn/go-isatty/isatty_solaris.go diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_windows.go b/vendor/github.com/mattn/go-isatty/isatty_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_windows.go rename to vendor/github.com/mattn/go-isatty/isatty_windows.go diff --git a/Godeps/_workspace/src/github.com/mattn/go-runewidth/.travis.yml b/vendor/github.com/mattn/go-runewidth/.travis.yml similarity index 84% rename from Godeps/_workspace/src/github.com/mattn/go-runewidth/.travis.yml rename to vendor/github.com/mattn/go-runewidth/.travis.yml index ad584f4da5..5c9c2a30f0 100644 --- a/Godeps/_workspace/src/github.com/mattn/go-runewidth/.travis.yml +++ b/vendor/github.com/mattn/go-runewidth/.travis.yml @@ -2,7 +2,6 @@ language: go go: - tip before_install: - - go get github.com/axw/gocov/gocov - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover script: diff --git a/vendor/github.com/mattn/go-runewidth/LICENSE b/vendor/github.com/mattn/go-runewidth/LICENSE new file mode 100644 index 0000000000..91b5cef30e --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Yasuhiro Matsumoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Godeps/_workspace/src/github.com/mattn/go-runewidth/README.mkd b/vendor/github.com/mattn/go-runewidth/README.mkd similarity index 67% rename from Godeps/_workspace/src/github.com/mattn/go-runewidth/README.mkd rename to vendor/github.com/mattn/go-runewidth/README.mkd index 4f0d583beb..66663a94b0 100644 --- a/Godeps/_workspace/src/github.com/mattn/go-runewidth/README.mkd +++ b/vendor/github.com/mattn/go-runewidth/README.mkd @@ -3,6 +3,8 @@ go-runewidth [![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth) [![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD) +[![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth) +[![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth) Provides functions to get fixed width of the character or string. diff --git a/Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go similarity index 93% rename from Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth.go rename to vendor/github.com/mattn/go-runewidth/runewidth.go index 3fbf33d595..3e730656b5 100644 --- a/Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth.go @@ -1,7 +1,12 @@ package runewidth -var EastAsianWidth = IsEastAsian() -var DefaultCondition = &Condition{EastAsianWidth} +var ( + // EastAsianWidth will be set true if the current locale is CJK + EastAsianWidth = IsEastAsian() + + // DefaultCondition is a condition in current locale + DefaultCondition = &Condition{EastAsianWidth} +) type interval struct { first rune @@ -302,10 +307,12 @@ var ctypes = []intervalType{ {0x100000, 0x10FFFE, ambiguous}, } +// Condition have flag EastAsianWidth whether the current locale is CJK or not. type Condition struct { EastAsianWidth bool } +// NewCondition return new instance of Condition which is current locale. func NewCondition() *Condition { return &Condition{EastAsianWidth} } @@ -344,6 +351,7 @@ func (c *Condition) RuneWidth(r rune) int { return 1 } +// StringWidth return width as you can see func (c *Condition) StringWidth(s string) (width int) { for _, r := range []rune(s) { width += c.RuneWidth(r) @@ -351,6 +359,7 @@ func (c *Condition) StringWidth(s string) (width int) { return width } +// Truncate return string truncated with w cells func (c *Condition) Truncate(s string, w int, tail string) string { if c.StringWidth(s) <= w { return s @@ -370,6 +379,7 @@ func (c *Condition) Truncate(s string, w int, tail string) string { return string(r[0:i]) + tail } +// Wrap return string wrapped with w cells func (c *Condition) Wrap(s string, w int) string { width := 0 out := "" @@ -392,6 +402,7 @@ func (c *Condition) Wrap(s string, w int) string { return out } +// FillLeft return string filled in left by spaces in w cells func (c *Condition) FillLeft(s string, w int) string { width := c.StringWidth(s) count := w - width @@ -405,6 +416,7 @@ func (c *Condition) FillLeft(s string, w int) string { return s } +// FillRight return string filled in left by spaces in w cells func (c *Condition) FillRight(s string, w int) string { width := c.StringWidth(s) count := w - width @@ -438,27 +450,32 @@ func IsAmbiguousWidth(r rune) bool { return ct(r) == ambiguous } -// IsAmbiguousWidth returns whether is ambiguous width or not. +// IsNeutralWidth returns whether is neutral width or not. func IsNeutralWidth(r rune) bool { return ct(r) == neutral } +// StringWidth return width as you can see func StringWidth(s string) (width int) { return DefaultCondition.StringWidth(s) } +// Truncate return string truncated with w cells func Truncate(s string, w int, tail string) string { return DefaultCondition.Truncate(s, w, tail) } +// Wrap return string wrapped with w cells func Wrap(s string, w int) string { return DefaultCondition.Wrap(s, w) } +// FillLeft return string filled in left by spaces in w cells func FillLeft(s string, w int) string { return DefaultCondition.FillLeft(s, w) } +// FillRight return string filled in left by spaces in w cells func FillRight(s string, w int) string { return DefaultCondition.FillRight(s, w) } diff --git a/Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth_js.go b/vendor/github.com/mattn/go-runewidth/runewidth_js.go similarity index 100% rename from Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth_js.go rename to vendor/github.com/mattn/go-runewidth/runewidth_js.go diff --git a/Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth_posix.go b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go similarity index 65% rename from Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth_posix.go rename to vendor/github.com/mattn/go-runewidth/runewidth_posix.go index a4495909d8..c579e9a314 100644 --- a/Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth_posix.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go @@ -10,20 +10,25 @@ import ( var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`) -func IsEastAsian() bool { - locale := os.Getenv("LC_CTYPE") - if locale == "" { - locale = os.Getenv("LANG") - } - - // ignore C locale - if locale == "POSIX" || locale == "C" { - return false - } - if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') { - return false - } +var mblenTable = map[string]int{ + "utf-8": 6, + "utf8": 6, + "jis": 8, + "eucjp": 3, + "euckr": 2, + "euccn": 2, + "sjis": 2, + "cp932": 2, + "cp51932": 2, + "cp936": 2, + "cp949": 2, + "cp950": 2, + "big5": 2, + "gbk": 2, + "gb2312": 2, +} +func isEastAsian(locale string) bool { charset := strings.ToLower(locale) r := reLoc.FindStringSubmatch(locale) if len(r) == 2 { @@ -40,26 +45,11 @@ func IsEastAsian() bool { break } } - - mbc_max := 1 - switch charset { - case "utf-8", "utf8": - mbc_max = 6 - case "jis": - mbc_max = 8 - case "eucjp": - mbc_max = 3 - case "euckr", "euccn": - mbc_max = 2 - case "sjis", "cp932", "cp51932", "cp936", "cp949", "cp950": - mbc_max = 2 - case "big5": - mbc_max = 2 - case "gbk", "gb2312": - mbc_max = 2 + max := 1 + if m, ok := mblenTable[charset]; ok { + max = m } - - if mbc_max > 1 && (charset[0] != 'u' || + if max > 1 && (charset[0] != 'u' || strings.HasPrefix(locale, "ja") || strings.HasPrefix(locale, "ko") || strings.HasPrefix(locale, "zh")) { @@ -67,3 +57,21 @@ func IsEastAsian() bool { } return false } + +// IsEastAsian return true if the current locale is CJK +func IsEastAsian() bool { + locale := os.Getenv("LC_CTYPE") + if locale == "" { + locale = os.Getenv("LANG") + } + + // ignore C locale + if locale == "POSIX" || locale == "C" { + return false + } + if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') { + return false + } + + return isEastAsian(locale) +} diff --git a/Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth_windows.go b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go similarity index 86% rename from Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth_windows.go rename to vendor/github.com/mattn/go-runewidth/runewidth_windows.go index bdd84454be..0258876b99 100644 --- a/Godeps/_workspace/src/github.com/mattn/go-runewidth/runewidth_windows.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go @@ -9,6 +9,7 @@ var ( procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP") ) +// IsEastAsian return true if the current locale is CJK func IsEastAsian() bool { r1, _, _ := procGetConsoleOutputCP.Call() if r1 == 0 { diff --git a/vendor/github.com/mitchellh/go-wordwrap/LICENSE.md b/vendor/github.com/mitchellh/go-wordwrap/LICENSE.md new file mode 100644 index 0000000000..2298515904 --- /dev/null +++ b/vendor/github.com/mitchellh/go-wordwrap/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Mitchell Hashimoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/mitchellh/go-wordwrap/README.md b/vendor/github.com/mitchellh/go-wordwrap/README.md new file mode 100644 index 0000000000..60ae311700 --- /dev/null +++ b/vendor/github.com/mitchellh/go-wordwrap/README.md @@ -0,0 +1,39 @@ +# go-wordwrap + +`go-wordwrap` (Golang package: `wordwrap`) is a package for Go that +automatically wraps words into multiple lines. The primary use case for this +is in formatting CLI output, but of course word wrapping is a generally useful +thing to do. + +## Installation and Usage + +Install using `go get github.com/mitchellh/go-wordwrap`. + +Full documentation is available at +http://godoc.org/github.com/mitchellh/go-wordwrap + +Below is an example of its usage ignoring errors: + +```go +wrapped := wordwrap.WrapString("foo bar baz", 3) +fmt.Println(wrapped) +``` + +Would output: + +``` +foo +bar +baz +``` + +## Word Wrap Algorithm + +This library doesn't use any clever algorithm for word wrapping. The wrapping +is actually very naive: whenever there is whitespace or an explicit linebreak. +The goal of this library is for word wrapping CLI output, so the input is +typically pretty well controlled human language. Because of this, the naive +approach typically works just fine. + +In the future, we'd like to make the algorithm more advanced. We would do +so without breaking the API. diff --git a/vendor/github.com/mitchellh/go-wordwrap/wordwrap.go b/vendor/github.com/mitchellh/go-wordwrap/wordwrap.go new file mode 100644 index 0000000000..ac67205bc2 --- /dev/null +++ b/vendor/github.com/mitchellh/go-wordwrap/wordwrap.go @@ -0,0 +1,73 @@ +package wordwrap + +import ( + "bytes" + "unicode" +) + +// WrapString wraps the given string within lim width in characters. +// +// Wrapping is currently naive and only happens at white-space. A future +// version of the library will implement smarter wrapping. This means that +// pathological cases can dramatically reach past the limit, such as a very +// long word. +func WrapString(s string, lim uint) string { + // Initialize a buffer with a slightly larger size to account for breaks + init := make([]byte, 0, len(s)) + buf := bytes.NewBuffer(init) + + var current uint + var wordBuf, spaceBuf bytes.Buffer + + for _, char := range s { + if char == '\n' { + if wordBuf.Len() == 0 { + if current+uint(spaceBuf.Len()) > lim { + current = 0 + } else { + current += uint(spaceBuf.Len()) + spaceBuf.WriteTo(buf) + } + spaceBuf.Reset() + } else { + current += uint(spaceBuf.Len() + wordBuf.Len()) + spaceBuf.WriteTo(buf) + spaceBuf.Reset() + wordBuf.WriteTo(buf) + wordBuf.Reset() + } + buf.WriteRune(char) + current = 0 + } else if unicode.IsSpace(char) { + if spaceBuf.Len() == 0 || wordBuf.Len() > 0 { + current += uint(spaceBuf.Len() + wordBuf.Len()) + spaceBuf.WriteTo(buf) + spaceBuf.Reset() + wordBuf.WriteTo(buf) + wordBuf.Reset() + } + + spaceBuf.WriteRune(char) + } else { + + wordBuf.WriteRune(char) + + if current+uint(spaceBuf.Len()+wordBuf.Len()) > lim && uint(wordBuf.Len()) < lim { + buf.WriteRune('\n') + current = 0 + spaceBuf.Reset() + } + } + } + + if wordBuf.Len() == 0 { + if current+uint(spaceBuf.Len()) <= lim { + spaceBuf.WriteTo(buf) + } + } else { + spaceBuf.WriteTo(buf) + wordBuf.WriteTo(buf) + } + + return buf.String() +} diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/AUTHORS b/vendor/github.com/nsf/termbox-go/AUTHORS similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/AUTHORS rename to vendor/github.com/nsf/termbox-go/AUTHORS diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/LICENSE b/vendor/github.com/nsf/termbox-go/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/LICENSE rename to vendor/github.com/nsf/termbox-go/LICENSE diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/README.md b/vendor/github.com/nsf/termbox-go/README.md similarity index 85% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/README.md rename to vendor/github.com/nsf/termbox-go/README.md index 6ff10c6b99..d152da4073 100644 --- a/Godeps/_workspace/src/github.com/nsf/termbox-go/README.md +++ b/vendor/github.com/nsf/termbox-go/README.md @@ -20,6 +20,10 @@ There are also some interesting projects using termbox-go: - [xterm-color-chart](https://github.com/kutuluk/xterm-color-chart) is a XTerm 256 color chart. - [gocui](https://github.com/jroimartin/gocui) is a minimalist Go library aimed at creating console user interfaces. - [dry](https://github.com/moncho/dry) is an interactive cli to manage Docker containers. + - [pxl](https://github.com/ichinaski/pxl) displays images in the terminal. + - [snake-game](https://github.com/DyegoCosta/snake-game) is an implementation of the Snake game. + - [gone](https://github.com/guillaumebreton/gone) is a CLI pomodoro® timer. + - [Spoof.go](https://github.com/sabey/spoofgo) controllable movement spoofing from the cli ### API reference [godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go) diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/api.go b/vendor/github.com/nsf/termbox-go/api.go similarity index 99% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/api.go rename to vendor/github.com/nsf/termbox-go/api.go index b8497b02e6..b339e532f8 100644 --- a/Godeps/_workspace/src/github.com/nsf/termbox-go/api.go +++ b/vendor/github.com/nsf/termbox-go/api.go @@ -57,7 +57,6 @@ func Init() error { tios.Iflag &^= syscall_IGNBRK | syscall_BRKINT | syscall_PARMRK | syscall_ISTRIP | syscall_INLCR | syscall_IGNCR | syscall_ICRNL | syscall_IXON - tios.Oflag &^= syscall_OPOST tios.Lflag &^= syscall_ECHO | syscall_ECHONL | syscall_ICANON | syscall_ISIG | syscall_IEXTEN tios.Cflag &^= syscall_CSIZE | syscall_PARENB diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/api_common.go b/vendor/github.com/nsf/termbox-go/api_common.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/api_common.go rename to vendor/github.com/nsf/termbox-go/api_common.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/api_windows.go b/vendor/github.com/nsf/termbox-go/api_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/api_windows.go rename to vendor/github.com/nsf/termbox-go/api_windows.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/collect_terminfo.py b/vendor/github.com/nsf/termbox-go/collect_terminfo.py old mode 100644 new mode 100755 similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/collect_terminfo.py rename to vendor/github.com/nsf/termbox-go/collect_terminfo.py diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls.go b/vendor/github.com/nsf/termbox-go/syscalls.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls.go rename to vendor/github.com/nsf/termbox-go/syscalls.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_darwin.go b/vendor/github.com/nsf/termbox-go/syscalls_darwin.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_darwin.go rename to vendor/github.com/nsf/termbox-go/syscalls_darwin.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_darwin_amd64.go b/vendor/github.com/nsf/termbox-go/syscalls_darwin_amd64.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_darwin_amd64.go rename to vendor/github.com/nsf/termbox-go/syscalls_darwin_amd64.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_freebsd.go b/vendor/github.com/nsf/termbox-go/syscalls_dragonfly.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_freebsd.go rename to vendor/github.com/nsf/termbox-go/syscalls_dragonfly.go diff --git a/vendor/github.com/nsf/termbox-go/syscalls_freebsd.go b/vendor/github.com/nsf/termbox-go/syscalls_freebsd.go new file mode 100644 index 0000000000..e03624ebc7 --- /dev/null +++ b/vendor/github.com/nsf/termbox-go/syscalls_freebsd.go @@ -0,0 +1,39 @@ +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs syscalls.go + +package termbox + +type syscall_Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed uint32 + Ospeed uint32 +} + +const ( + syscall_IGNBRK = 0x1 + syscall_BRKINT = 0x2 + syscall_PARMRK = 0x8 + syscall_ISTRIP = 0x20 + syscall_INLCR = 0x40 + syscall_IGNCR = 0x80 + syscall_ICRNL = 0x100 + syscall_IXON = 0x200 + syscall_OPOST = 0x1 + syscall_ECHO = 0x8 + syscall_ECHONL = 0x10 + syscall_ICANON = 0x100 + syscall_ISIG = 0x80 + syscall_IEXTEN = 0x400 + syscall_CSIZE = 0x300 + syscall_PARENB = 0x1000 + syscall_CS8 = 0x300 + syscall_VMIN = 0x10 + syscall_VTIME = 0x11 + + syscall_TCGETS = 0x402c7413 + syscall_TCSETS = 0x802c7414 +) diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_linux.go b/vendor/github.com/nsf/termbox-go/syscalls_linux.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_linux.go rename to vendor/github.com/nsf/termbox-go/syscalls_linux.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_netbsd.go b/vendor/github.com/nsf/termbox-go/syscalls_netbsd.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_netbsd.go rename to vendor/github.com/nsf/termbox-go/syscalls_netbsd.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_openbsd.go b/vendor/github.com/nsf/termbox-go/syscalls_openbsd.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_openbsd.go rename to vendor/github.com/nsf/termbox-go/syscalls_openbsd.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_windows.go b/vendor/github.com/nsf/termbox-go/syscalls_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_windows.go rename to vendor/github.com/nsf/termbox-go/syscalls_windows.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/termbox.go b/vendor/github.com/nsf/termbox-go/termbox.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/termbox.go rename to vendor/github.com/nsf/termbox-go/termbox.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/termbox_common.go b/vendor/github.com/nsf/termbox-go/termbox_common.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/termbox_common.go rename to vendor/github.com/nsf/termbox-go/termbox_common.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/termbox_windows.go b/vendor/github.com/nsf/termbox-go/termbox_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/termbox_windows.go rename to vendor/github.com/nsf/termbox-go/termbox_windows.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/terminfo.go b/vendor/github.com/nsf/termbox-go/terminfo.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/terminfo.go rename to vendor/github.com/nsf/termbox-go/terminfo.go diff --git a/Godeps/_workspace/src/github.com/nsf/termbox-go/terminfo_builtin.go b/vendor/github.com/nsf/termbox-go/terminfo_builtin.go similarity index 100% rename from Godeps/_workspace/src/github.com/nsf/termbox-go/terminfo_builtin.go rename to vendor/github.com/nsf/termbox-go/terminfo_builtin.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/.travis.yml b/vendor/github.com/pborman/uuid/.travis.yml similarity index 86% rename from Godeps/_workspace/src/github.com/pborman/uuid/.travis.yml rename to vendor/github.com/pborman/uuid/.travis.yml index a6a98db8a3..d8156a60ba 100644 --- a/Godeps/_workspace/src/github.com/pborman/uuid/.travis.yml +++ b/vendor/github.com/pborman/uuid/.travis.yml @@ -3,7 +3,6 @@ language: go go: - 1.4.3 - 1.5.3 - - release - tip script: diff --git a/vendor/github.com/pborman/uuid/CONTRIBUTING.md b/vendor/github.com/pborman/uuid/CONTRIBUTING.md new file mode 100644 index 0000000000..04fdf09f13 --- /dev/null +++ b/vendor/github.com/pborman/uuid/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to contribute + +We definitely welcome patches and contribution to this project! + +### Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +You may have already signed it for other Google projects. diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/CONTRIBUTORS b/vendor/github.com/pborman/uuid/CONTRIBUTORS similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/CONTRIBUTORS rename to vendor/github.com/pborman/uuid/CONTRIBUTORS diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/LICENSE b/vendor/github.com/pborman/uuid/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/LICENSE rename to vendor/github.com/pborman/uuid/LICENSE diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/README.md b/vendor/github.com/pborman/uuid/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/README.md rename to vendor/github.com/pborman/uuid/README.md diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/dce.go b/vendor/github.com/pborman/uuid/dce.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/dce.go rename to vendor/github.com/pborman/uuid/dce.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/doc.go b/vendor/github.com/pborman/uuid/doc.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/doc.go rename to vendor/github.com/pborman/uuid/doc.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/hash.go b/vendor/github.com/pborman/uuid/hash.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/hash.go rename to vendor/github.com/pborman/uuid/hash.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/json.go b/vendor/github.com/pborman/uuid/json.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/json.go rename to vendor/github.com/pborman/uuid/json.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/node.go b/vendor/github.com/pborman/uuid/node.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/node.go rename to vendor/github.com/pborman/uuid/node.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/sql.go b/vendor/github.com/pborman/uuid/sql.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/sql.go rename to vendor/github.com/pborman/uuid/sql.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/time.go b/vendor/github.com/pborman/uuid/time.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/time.go rename to vendor/github.com/pborman/uuid/time.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/util.go b/vendor/github.com/pborman/uuid/util.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/util.go rename to vendor/github.com/pborman/uuid/util.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/uuid.go b/vendor/github.com/pborman/uuid/uuid.go similarity index 85% rename from Godeps/_workspace/src/github.com/pborman/uuid/uuid.go rename to vendor/github.com/pborman/uuid/uuid.go index c4482cd873..7c643cf0a3 100644 --- a/Godeps/_workspace/src/github.com/pborman/uuid/uuid.go +++ b/vendor/github.com/pborman/uuid/uuid.go @@ -13,6 +13,20 @@ import ( "strings" ) +// Array is a pass-by-value UUID that can be used as an effecient key in a map. +type Array [16]byte + +// UUID converts uuid into a slice. +func (uuid Array) UUID() UUID { + return uuid[:] +} + +// String returns the string representation of uuid, +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. +func (uuid Array) String() string { + return uuid.UUID().String() +} + // A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC // 4122. type UUID []byte @@ -76,6 +90,17 @@ func Equal(uuid1, uuid2 UUID) bool { return bytes.Equal(uuid1, uuid2) } +// Array returns an array representation of uuid that can be used as a map key. +// Array panics if uuid is not valid. +func (uuid UUID) Array() Array { + if len(uuid) != 16 { + panic("invalid uuid") + } + var a Array + copy(a[:], uuid) + return a +} + // String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx // , or "" if uuid is invalid. func (uuid UUID) String() string { @@ -161,7 +186,7 @@ func (v Variant) String() string { return fmt.Sprintf("BadVariant%d", int(v)) } -// SetRand sets the random number generator to r, which implents io.Reader. +// SetRand sets the random number generator to r, which implements io.Reader. // If r.Read returns an error when the package requests random data then // a panic will be issued. // diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/version1.go b/vendor/github.com/pborman/uuid/version1.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/version1.go rename to vendor/github.com/pborman/uuid/version1.go diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/version4.go b/vendor/github.com/pborman/uuid/version4.go similarity index 100% rename from Godeps/_workspace/src/github.com/pborman/uuid/version4.go rename to vendor/github.com/pborman/uuid/version4.go diff --git a/Godeps/_workspace/src/github.com/peterh/liner/COPYING b/vendor/github.com/peterh/liner/COPYING similarity index 100% rename from Godeps/_workspace/src/github.com/peterh/liner/COPYING rename to vendor/github.com/peterh/liner/COPYING diff --git a/Godeps/_workspace/src/github.com/peterh/liner/README.md b/vendor/github.com/peterh/liner/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/peterh/liner/README.md rename to vendor/github.com/peterh/liner/README.md diff --git a/Godeps/_workspace/src/github.com/peterh/liner/bsdinput.go b/vendor/github.com/peterh/liner/bsdinput.go similarity index 94% rename from Godeps/_workspace/src/github.com/peterh/liner/bsdinput.go rename to vendor/github.com/peterh/liner/bsdinput.go index 4b552d44d9..35933982f1 100644 --- a/Godeps/_workspace/src/github.com/peterh/liner/bsdinput.go +++ b/vendor/github.com/peterh/liner/bsdinput.go @@ -37,3 +37,5 @@ type termios struct { Ispeed int32 Ospeed int32 } + +const cursorColumn = false diff --git a/Godeps/_workspace/src/github.com/peterh/liner/common.go b/vendor/github.com/peterh/liner/common.go similarity index 100% rename from Godeps/_workspace/src/github.com/peterh/liner/common.go rename to vendor/github.com/peterh/liner/common.go diff --git a/Godeps/_workspace/src/github.com/peterh/liner/fallbackinput.go b/vendor/github.com/peterh/liner/fallbackinput.go similarity index 100% rename from Godeps/_workspace/src/github.com/peterh/liner/fallbackinput.go rename to vendor/github.com/peterh/liner/fallbackinput.go diff --git a/Godeps/_workspace/src/github.com/peterh/liner/input.go b/vendor/github.com/peterh/liner/input.go similarity index 99% rename from Godeps/_workspace/src/github.com/peterh/liner/input.go rename to vendor/github.com/peterh/liner/input.go index c80c85f69d..0ee6be7afa 100644 --- a/Godeps/_workspace/src/github.com/peterh/liner/input.go +++ b/vendor/github.com/peterh/liner/input.go @@ -67,8 +67,7 @@ func NewLiner() *State { } if !s.outputRedirected { - s.getColumns() - s.outputRedirected = s.columns <= 0 + s.outputRedirected = !s.getColumns() } return &s diff --git a/Godeps/_workspace/src/github.com/peterh/liner/input_darwin.go b/vendor/github.com/peterh/liner/input_darwin.go similarity index 78% rename from Godeps/_workspace/src/github.com/peterh/liner/input_darwin.go rename to vendor/github.com/peterh/liner/input_darwin.go index 23c9c5da0f..e98ab4a49f 100644 --- a/Godeps/_workspace/src/github.com/peterh/liner/input_darwin.go +++ b/vendor/github.com/peterh/liner/input_darwin.go @@ -37,3 +37,7 @@ type termios struct { Ispeed uintptr Ospeed uintptr } + +// Terminal.app needs a column for the cursor when the input line is at the +// bottom of the window. +const cursorColumn = true diff --git a/Godeps/_workspace/src/github.com/peterh/liner/input_linux.go b/vendor/github.com/peterh/liner/input_linux.go similarity index 93% rename from Godeps/_workspace/src/github.com/peterh/liner/input_linux.go rename to vendor/github.com/peterh/liner/input_linux.go index 6ca87124ea..56ed185fad 100644 --- a/Godeps/_workspace/src/github.com/peterh/liner/input_linux.go +++ b/vendor/github.com/peterh/liner/input_linux.go @@ -24,3 +24,5 @@ const ( type termios struct { syscall.Termios } + +const cursorColumn = false diff --git a/Godeps/_workspace/src/github.com/peterh/liner/input_windows.go b/vendor/github.com/peterh/liner/input_windows.go similarity index 99% rename from Godeps/_workspace/src/github.com/peterh/liner/input_windows.go rename to vendor/github.com/peterh/liner/input_windows.go index 9dcc3115c7..199b9428e4 100644 --- a/Godeps/_workspace/src/github.com/peterh/liner/input_windows.go +++ b/vendor/github.com/peterh/liner/input_windows.go @@ -168,6 +168,9 @@ func (s *State) readNext() (interface{}, error) { if input.eventType == window_buffer_size_event { xy := (*coord)(unsafe.Pointer(&input.blob[0])) s.columns = int(xy.x) + if s.columns > 1 { + s.columns-- + } return winch, nil } if input.eventType != key_event { diff --git a/Godeps/_workspace/src/github.com/peterh/liner/line.go b/vendor/github.com/peterh/liner/line.go similarity index 97% rename from Godeps/_workspace/src/github.com/peterh/liner/line.go rename to vendor/github.com/peterh/liner/line.go index 95364ae566..903dd240d3 100644 --- a/Godeps/_workspace/src/github.com/peterh/liner/line.go +++ b/vendor/github.com/peterh/liner/line.go @@ -564,6 +564,15 @@ func (s *State) yank(p []rune, text []rune, pos int) ([]rune, int, interface{}, // newline character. An io.EOF error is returned if the user signals end-of-file // by pressing Ctrl-D. Prompt allows line editing if the terminal supports it. func (s *State) Prompt(prompt string) (string, error) { + return s.PromptWithSuggestion(prompt, "", 0) +} + +// PromptWithSuggestion displays prompt and an editable text with cursor at +// given position. The cursor will be set to the end of the line if given position +// is negative or greater than length of text. Returns a line of user input, not +// including a trailing newline character. An io.EOF error is returned if the user +// signals end-of-file by pressing Ctrl-D. +func (s *State) PromptWithSuggestion(prompt string, text string, pos int) (string, error) { if s.inputRedirected || !s.terminalSupported { return s.promptUnsupported(prompt) } @@ -576,8 +585,7 @@ func (s *State) Prompt(prompt string) (string, error) { fmt.Print(prompt) p := []rune(prompt) - var line []rune - pos := 0 + var line = []rune(text) historyEnd := "" prefixHistory := s.getHistoryByPrefix(string(line)) historyPos := len(prefixHistory) @@ -586,6 +594,13 @@ func (s *State) Prompt(prompt string) (string, error) { defer s.stopPrompt() + if pos < 0 || len(text) < pos { + pos = len(text) + } + if len(line) > 0 { + s.refresh(p, line, pos) + } + restart: s.startPrompt() s.getColumns() diff --git a/Godeps/_workspace/src/github.com/peterh/liner/output.go b/vendor/github.com/peterh/liner/output.go similarity index 91% rename from Godeps/_workspace/src/github.com/peterh/liner/output.go rename to vendor/github.com/peterh/liner/output.go index 049273b539..6d83d4ebfd 100644 --- a/Godeps/_workspace/src/github.com/peterh/liner/output.go +++ b/vendor/github.com/peterh/liner/output.go @@ -48,14 +48,18 @@ type winSize struct { xpixel, ypixel uint16 } -func (s *State) getColumns() { +func (s *State) getColumns() bool { var ws winSize ok, _, _ := syscall.Syscall(syscall.SYS_IOCTL, uintptr(syscall.Stdout), syscall.TIOCGWINSZ, uintptr(unsafe.Pointer(&ws))) - if ok < 0 { - s.columns = 80 + if int(ok) < 0 { + return false } s.columns = int(ws.col) + if cursorColumn && s.columns > 1 { + s.columns-- + } + return true } func (s *State) checkOutput() { diff --git a/Godeps/_workspace/src/github.com/peterh/liner/output_windows.go b/vendor/github.com/peterh/liner/output_windows.go similarity index 96% rename from Godeps/_workspace/src/github.com/peterh/liner/output_windows.go rename to vendor/github.com/peterh/liner/output_windows.go index 45cd978c96..63c9c5d757 100644 --- a/Godeps/_workspace/src/github.com/peterh/liner/output_windows.go +++ b/vendor/github.com/peterh/liner/output_windows.go @@ -69,4 +69,8 @@ func (s *State) getColumns() { var sbi consoleScreenBufferInfo procGetConsoleScreenBufferInfo.Call(uintptr(s.hOut), uintptr(unsafe.Pointer(&sbi))) s.columns = int(sbi.dwSize.x) + if s.columns > 1 { + // Windows 10 needs a spare column for the cursor + s.columns-- + } } diff --git a/Godeps/_workspace/src/github.com/peterh/liner/signal.go b/vendor/github.com/peterh/liner/signal.go similarity index 100% rename from Godeps/_workspace/src/github.com/peterh/liner/signal.go rename to vendor/github.com/peterh/liner/signal.go diff --git a/Godeps/_workspace/src/github.com/peterh/liner/signal_legacy.go b/vendor/github.com/peterh/liner/signal_legacy.go similarity index 100% rename from Godeps/_workspace/src/github.com/peterh/liner/signal_legacy.go rename to vendor/github.com/peterh/liner/signal_legacy.go diff --git a/Godeps/_workspace/src/github.com/peterh/liner/unixmode.go b/vendor/github.com/peterh/liner/unixmode.go similarity index 100% rename from Godeps/_workspace/src/github.com/peterh/liner/unixmode.go rename to vendor/github.com/peterh/liner/unixmode.go diff --git a/Godeps/_workspace/src/github.com/peterh/liner/width.go b/vendor/github.com/peterh/liner/width.go similarity index 100% rename from Godeps/_workspace/src/github.com/peterh/liner/width.go rename to vendor/github.com/peterh/liner/width.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/.gitignore b/vendor/github.com/rcrowley/go-metrics/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/.gitignore rename to vendor/github.com/rcrowley/go-metrics/.gitignore diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/.travis.yml b/vendor/github.com/rcrowley/go-metrics/.travis.yml similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/.travis.yml rename to vendor/github.com/rcrowley/go-metrics/.travis.yml diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/LICENSE b/vendor/github.com/rcrowley/go-metrics/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/LICENSE rename to vendor/github.com/rcrowley/go-metrics/LICENSE diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/README.md b/vendor/github.com/rcrowley/go-metrics/README.md similarity index 86% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/README.md rename to vendor/github.com/rcrowley/go-metrics/README.md index 66ba9cab55..2d1a6dcfa4 100644 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/README.md +++ b/vendor/github.com/rcrowley/go-metrics/README.md @@ -21,6 +21,9 @@ g := metrics.NewGauge() metrics.Register("bar", g) g.Update(47) +r := NewRegistry() +g := metrics.NewRegisteredFunctionalGauge("cache-evictions", r, func() int64 { return cache.getEvictionsCount() }) + s := metrics.NewExpDecaySample(1028, 0.015) // or metrics.NewUniformSample(1028) h := metrics.NewHistogram(s) metrics.Register("baz", h) @@ -36,6 +39,15 @@ t.Time(func() {}) t.Update(47) ``` +Register() is not threadsafe. For threadsafe metric registration use +GetOrRegister: + +``` +t := metrics.GetOrRegisterTimer("account.create.latency", nil) +t.Time(func() {}) +t.Update(47) +``` + Periodically log every metric in human-readable form to standard error: ```go @@ -67,7 +79,7 @@ issues [#121](https://github.com/rcrowley/go-metrics/issues/121) and [#124](https://github.com/rcrowley/go-metrics/issues/124) for progress and details. ```go -import "github.com/rcrowley/go-metrics/influxdb" +import "github.com/vrischmann/go-metrics-influxdb" go influxdb.Influxdb(metrics.DefaultRegistry, 10e9, &influxdb.Config{ Host: "127.0.0.1:8086", @@ -137,3 +149,5 @@ Clients are available for the following destinations: * Librato - [https://github.com/mihasya/go-metrics-librato](https://github.com/mihasya/go-metrics-librato) * Graphite - [https://github.com/cyberdelia/go-metrics-graphite](https://github.com/cyberdelia/go-metrics-graphite) * InfluxDB - [https://github.com/vrischmann/go-metrics-influxdb](https://github.com/vrischmann/go-metrics-influxdb) +* Ganglia - [https://github.com/appscode/metlia](https://github.com/appscode/metlia) +* Prometheus - [https://github.com/deathowl/go-metrics-prometheus](https://github.com/deathowl/go-metrics-prometheus) diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/counter.go b/vendor/github.com/rcrowley/go-metrics/counter.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/counter.go rename to vendor/github.com/rcrowley/go-metrics/counter.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/debug.go b/vendor/github.com/rcrowley/go-metrics/debug.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/debug.go rename to vendor/github.com/rcrowley/go-metrics/debug.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/ewma.go b/vendor/github.com/rcrowley/go-metrics/ewma.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/ewma.go rename to vendor/github.com/rcrowley/go-metrics/ewma.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/exp/exp.go b/vendor/github.com/rcrowley/go-metrics/exp/exp.go similarity index 93% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/exp/exp.go rename to vendor/github.com/rcrowley/go-metrics/exp/exp.go index 09a496f115..11dd3f898a 100644 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/exp/exp.go +++ b/vendor/github.com/rcrowley/go-metrics/exp/exp.go @@ -5,9 +5,10 @@ package exp import ( "expvar" "fmt" - "github.com/rcrowley/go-metrics" "net/http" "sync" + + "github.com/rcrowley/go-metrics" ) type exp struct { @@ -33,13 +34,20 @@ func (exp *exp) expHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "\n}\n") } +// Exp will register an expvar powered metrics handler with http.DefaultServeMux on "/debug/vars" func Exp(r metrics.Registry) { - e := exp{sync.Mutex{}, r} + h := ExpHandler(r) // this would cause a panic: // panic: http: multiple registrations for /debug/vars // http.HandleFunc("/debug/vars", e.expHandler) // haven't found an elegant way, so just use a different endpoint - http.HandleFunc("/debug/metrics", e.expHandler) + http.Handle("/debug/metrics", h) +} + +// ExpHandler will return an expvar powered metrics handler. +func ExpHandler(r metrics.Registry) http.Handler { + e := exp{sync.Mutex{}, r} + return http.HandlerFunc(e.expHandler) } func (exp *exp) getInt(name string) *expvar.Int { diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/gauge.go b/vendor/github.com/rcrowley/go-metrics/gauge.go similarity index 69% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/gauge.go rename to vendor/github.com/rcrowley/go-metrics/gauge.go index 807638a31b..d618c45533 100644 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/gauge.go +++ b/vendor/github.com/rcrowley/go-metrics/gauge.go @@ -36,6 +36,25 @@ func NewRegisteredGauge(name string, r Registry) Gauge { return c } +// NewFunctionalGauge constructs a new FunctionalGauge. +func NewFunctionalGauge(f func() int64) Gauge { + if UseNilMetrics { + return NilGauge{} + } + return &FunctionalGauge{value: f} +} + + +// NewRegisteredFunctionalGauge constructs and registers a new StandardGauge. +func NewRegisteredFunctionalGauge(name string, r Registry, f func() int64) Gauge { + c := NewFunctionalGauge(f) + if nil == r { + r = DefaultRegistry + } + r.Register(name, c) + return c +} + // GaugeSnapshot is a read-only copy of another Gauge. type GaugeSnapshot int64 @@ -82,3 +101,20 @@ func (g *StandardGauge) Update(v int64) { func (g *StandardGauge) Value() int64 { return atomic.LoadInt64(&g.value) } +// FunctionalGauge returns value from given function +type FunctionalGauge struct { + value func() int64 +} + +// Value returns the gauge's current value. +func (g FunctionalGauge) Value() int64 { + return g.value() +} + +// Snapshot returns the snapshot. +func (g FunctionalGauge) Snapshot() Gauge { return GaugeSnapshot(g.Value()) } + +// Update panics. +func (FunctionalGauge) Update(int64) { + panic("Update called on a FunctionalGauge") +} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/gauge_float64.go b/vendor/github.com/rcrowley/go-metrics/gauge_float64.go similarity index 70% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/gauge_float64.go rename to vendor/github.com/rcrowley/go-metrics/gauge_float64.go index 47c3566c25..6f93920b2c 100644 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/gauge_float64.go +++ b/vendor/github.com/rcrowley/go-metrics/gauge_float64.go @@ -38,6 +38,24 @@ func NewRegisteredGaugeFloat64(name string, r Registry) GaugeFloat64 { return c } +// NewFunctionalGauge constructs a new FunctionalGauge. +func NewFunctionalGaugeFloat64(f func() float64) GaugeFloat64 { + if UseNilMetrics { + return NilGaugeFloat64{} + } + return &FunctionalGaugeFloat64{value: f} +} + +// NewRegisteredFunctionalGauge constructs and registers a new StandardGauge. +func NewRegisteredFunctionalGaugeFloat64(name string, r Registry, f func() float64) GaugeFloat64 { + c := NewFunctionalGaugeFloat64(f) + if nil == r { + r = DefaultRegistry + } + r.Register(name, c) + return c +} + // GaugeFloat64Snapshot is a read-only copy of another GaugeFloat64. type GaugeFloat64Snapshot float64 @@ -89,3 +107,21 @@ func (g *StandardGaugeFloat64) Value() float64 { defer g.mutex.Unlock() return g.value } + +// FunctionalGaugeFloat64 returns value from given function +type FunctionalGaugeFloat64 struct { + value func() float64 +} + +// Value returns the gauge's current value. +func (g FunctionalGaugeFloat64) Value() float64 { + return g.value() +} + +// Snapshot returns the snapshot. +func (g FunctionalGaugeFloat64) Snapshot() GaugeFloat64 { return GaugeFloat64Snapshot(g.Value()) } + +// Update panics. +func (FunctionalGaugeFloat64) Update(float64) { + panic("Update called on a FunctionalGaugeFloat64") +} diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/graphite.go b/vendor/github.com/rcrowley/go-metrics/graphite.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/graphite.go rename to vendor/github.com/rcrowley/go-metrics/graphite.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/healthcheck.go b/vendor/github.com/rcrowley/go-metrics/healthcheck.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/healthcheck.go rename to vendor/github.com/rcrowley/go-metrics/healthcheck.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/histogram.go b/vendor/github.com/rcrowley/go-metrics/histogram.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/histogram.go rename to vendor/github.com/rcrowley/go-metrics/histogram.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/json.go b/vendor/github.com/rcrowley/go-metrics/json.go similarity index 95% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/json.go rename to vendor/github.com/rcrowley/go-metrics/json.go index 2676aeea5b..2fdcbcfbf1 100644 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/json.go +++ b/vendor/github.com/rcrowley/go-metrics/json.go @@ -81,3 +81,7 @@ func WriteJSON(r Registry, d time.Duration, w io.Writer) { func WriteJSONOnce(r Registry, w io.Writer) { json.NewEncoder(w).Encode(r) } + +func (p *PrefixedRegistry) MarshalJSON() ([]byte, error) { + return json.Marshal(p.underlying) +} diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/log.go b/vendor/github.com/rcrowley/go-metrics/log.go similarity index 95% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/log.go rename to vendor/github.com/rcrowley/go-metrics/log.go index f074eb03d2..f8074c0457 100644 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/log.go +++ b/vendor/github.com/rcrowley/go-metrics/log.go @@ -1,17 +1,20 @@ package metrics import ( - "log" "time" ) -func Log(r Registry, freq time.Duration, l *log.Logger) { +type Logger interface { + Printf(format string, v ...interface{}) +} + +func Log(r Registry, freq time.Duration, l Logger) { LogScaled(r, freq, time.Nanosecond, l) } // Output each metric in the given registry periodically using the given // logger. Print timings in `scale` units (eg time.Millisecond) rather than nanos. -func LogScaled(r Registry, freq time.Duration, scale time.Duration, l *log.Logger) { +func LogScaled(r Registry, freq time.Duration, scale time.Duration, l Logger) { du := float64(scale) duSuffix := scale.String()[1:] diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/memory.md b/vendor/github.com/rcrowley/go-metrics/memory.md similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/memory.md rename to vendor/github.com/rcrowley/go-metrics/memory.md diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/meter.go b/vendor/github.com/rcrowley/go-metrics/meter.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/meter.go rename to vendor/github.com/rcrowley/go-metrics/meter.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/metrics.go b/vendor/github.com/rcrowley/go-metrics/metrics.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/metrics.go rename to vendor/github.com/rcrowley/go-metrics/metrics.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/opentsdb.go b/vendor/github.com/rcrowley/go-metrics/opentsdb.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/opentsdb.go rename to vendor/github.com/rcrowley/go-metrics/opentsdb.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/registry.go b/vendor/github.com/rcrowley/go-metrics/registry.go similarity index 91% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/registry.go rename to vendor/github.com/rcrowley/go-metrics/registry.go index e1f68a5dcc..9086dcbdd1 100644 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/registry.go +++ b/vendor/github.com/rcrowley/go-metrics/registry.go @@ -3,6 +3,7 @@ package metrics import ( "fmt" "reflect" + "strings" "sync" ) @@ -166,12 +167,34 @@ func NewPrefixedChildRegistry(parent Registry, prefix string) Registry { // Call the given function for each registered metric. func (r *PrefixedRegistry) Each(fn func(string, interface{})) { - r.underlying.Each(fn) + wrappedFn := func (prefix string) func(string, interface{}) { + return func(name string, iface interface{}) { + if strings.HasPrefix(name,prefix) { + fn(name, iface) + } else { + return + } + } + } + + baseRegistry, prefix := findPrefix(r, "") + baseRegistry.Each(wrappedFn(prefix)) +} + +func findPrefix(registry Registry, prefix string) (Registry, string) { + switch r := registry.(type) { + case *PrefixedRegistry: + return findPrefix(r.underlying, r.prefix + prefix) + case *StandardRegistry: + return r, prefix + } + return nil, "" } // Get the metric by the given name or nil if none is registered. func (r *PrefixedRegistry) Get(name string) interface{} { - return r.underlying.Get(name) + realName := r.prefix + name + return r.underlying.Get(realName) } // Gets an existing metric or registers the given one. diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime.go b/vendor/github.com/rcrowley/go-metrics/runtime.go similarity index 97% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime.go rename to vendor/github.com/rcrowley/go-metrics/runtime.go index e8c8d15689..11c6b785a0 100644 --- a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime.go +++ b/vendor/github.com/rcrowley/go-metrics/runtime.go @@ -2,6 +2,7 @@ package metrics import ( "runtime" + "runtime/pprof" "time" ) @@ -39,6 +40,7 @@ var ( } NumCgoCall Gauge NumGoroutine Gauge + NumThread Gauge ReadMemStats Timer } frees uint64 @@ -46,6 +48,8 @@ var ( mallocs uint64 numGC uint32 numCgoCalls int64 + + threadCreateProfile = pprof.Lookup("threadcreate") ) // Capture new values for the Go runtime statistics exported in @@ -134,6 +138,8 @@ func CaptureRuntimeMemStatsOnce(r Registry) { numCgoCalls = currentNumCgoCalls runtimeMetrics.NumGoroutine.Update(int64(runtime.NumGoroutine())) + + runtimeMetrics.NumThread.Update(int64(threadCreateProfile.Count())) } // Register runtimeMetrics for the Go runtime statistics exported in runtime and @@ -169,6 +175,7 @@ func RegisterRuntimeMemStats(r Registry) { runtimeMetrics.MemStats.TotalAlloc = NewGauge() runtimeMetrics.NumCgoCall = NewGauge() runtimeMetrics.NumGoroutine = NewGauge() + runtimeMetrics.NumThread = NewGauge() runtimeMetrics.ReadMemStats = NewTimer() r.Register("runtime.MemStats.Alloc", runtimeMetrics.MemStats.Alloc) @@ -200,5 +207,6 @@ func RegisterRuntimeMemStats(r Registry) { r.Register("runtime.MemStats.TotalAlloc", runtimeMetrics.MemStats.TotalAlloc) r.Register("runtime.NumCgoCall", runtimeMetrics.NumCgoCall) r.Register("runtime.NumGoroutine", runtimeMetrics.NumGoroutine) + r.Register("runtime.NumThread", runtimeMetrics.NumThread) r.Register("runtime.ReadMemStats", runtimeMetrics.ReadMemStats) } diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_cgo.go b/vendor/github.com/rcrowley/go-metrics/runtime_cgo.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_cgo.go rename to vendor/github.com/rcrowley/go-metrics/runtime_cgo.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_gccpufraction.go b/vendor/github.com/rcrowley/go-metrics/runtime_gccpufraction.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_gccpufraction.go rename to vendor/github.com/rcrowley/go-metrics/runtime_gccpufraction.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_no_cgo.go b/vendor/github.com/rcrowley/go-metrics/runtime_no_cgo.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_no_cgo.go rename to vendor/github.com/rcrowley/go-metrics/runtime_no_cgo.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_no_gccpufraction.go b/vendor/github.com/rcrowley/go-metrics/runtime_no_gccpufraction.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/runtime_no_gccpufraction.go rename to vendor/github.com/rcrowley/go-metrics/runtime_no_gccpufraction.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/sample.go b/vendor/github.com/rcrowley/go-metrics/sample.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/sample.go rename to vendor/github.com/rcrowley/go-metrics/sample.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/syslog.go b/vendor/github.com/rcrowley/go-metrics/syslog.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/syslog.go rename to vendor/github.com/rcrowley/go-metrics/syslog.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/timer.go b/vendor/github.com/rcrowley/go-metrics/timer.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/timer.go rename to vendor/github.com/rcrowley/go-metrics/timer.go diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/validate.sh b/vendor/github.com/rcrowley/go-metrics/validate.sh old mode 100644 new mode 100755 similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/validate.sh rename to vendor/github.com/rcrowley/go-metrics/validate.sh diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/writer.go b/vendor/github.com/rcrowley/go-metrics/writer.go similarity index 100% rename from Godeps/_workspace/src/github.com/rcrowley/go-metrics/writer.go rename to vendor/github.com/rcrowley/go-metrics/writer.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/.gitignore b/vendor/github.com/rjeczalik/notify/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/.gitignore rename to vendor/github.com/rjeczalik/notify/.gitignore diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/.travis.yml b/vendor/github.com/rjeczalik/notify/.travis.yml similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/.travis.yml rename to vendor/github.com/rjeczalik/notify/.travis.yml diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/AUTHORS b/vendor/github.com/rjeczalik/notify/AUTHORS similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/AUTHORS rename to vendor/github.com/rjeczalik/notify/AUTHORS diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/LICENSE b/vendor/github.com/rjeczalik/notify/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/LICENSE rename to vendor/github.com/rjeczalik/notify/LICENSE diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/README.md b/vendor/github.com/rjeczalik/notify/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/README.md rename to vendor/github.com/rjeczalik/notify/README.md diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/appveyor.yml b/vendor/github.com/rjeczalik/notify/appveyor.yml similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/appveyor.yml rename to vendor/github.com/rjeczalik/notify/appveyor.yml diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/debug.go b/vendor/github.com/rjeczalik/notify/debug.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/debug.go rename to vendor/github.com/rjeczalik/notify/debug.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/debug_debug.go b/vendor/github.com/rjeczalik/notify/debug_debug.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/debug_debug.go rename to vendor/github.com/rjeczalik/notify/debug_debug.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/doc.go b/vendor/github.com/rjeczalik/notify/doc.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/doc.go rename to vendor/github.com/rjeczalik/notify/doc.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/event.go b/vendor/github.com/rjeczalik/notify/event.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/event.go rename to vendor/github.com/rjeczalik/notify/event.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/event_fen.go b/vendor/github.com/rjeczalik/notify/event_fen.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/event_fen.go rename to vendor/github.com/rjeczalik/notify/event_fen.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/event_fsevents.go b/vendor/github.com/rjeczalik/notify/event_fsevents.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/event_fsevents.go rename to vendor/github.com/rjeczalik/notify/event_fsevents.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/event_inotify.go b/vendor/github.com/rjeczalik/notify/event_inotify.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/event_inotify.go rename to vendor/github.com/rjeczalik/notify/event_inotify.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/event_kqueue.go b/vendor/github.com/rjeczalik/notify/event_kqueue.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/event_kqueue.go rename to vendor/github.com/rjeczalik/notify/event_kqueue.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/event_readdcw.go b/vendor/github.com/rjeczalik/notify/event_readdcw.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/event_readdcw.go rename to vendor/github.com/rjeczalik/notify/event_readdcw.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/event_stub.go b/vendor/github.com/rjeczalik/notify/event_stub.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/event_stub.go rename to vendor/github.com/rjeczalik/notify/event_stub.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/event_trigger.go b/vendor/github.com/rjeczalik/notify/event_trigger.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/event_trigger.go rename to vendor/github.com/rjeczalik/notify/event_trigger.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/node.go b/vendor/github.com/rjeczalik/notify/node.go similarity index 98% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/node.go rename to vendor/github.com/rjeczalik/notify/node.go index 4302071bb2..29c1bb20af 100644 --- a/Godeps/_workspace/src/github.com/rjeczalik/notify/node.go +++ b/vendor/github.com/rjeczalik/notify/node.go @@ -6,6 +6,7 @@ package notify import ( "errors" + "fmt" "io/ioutil" "os" "path/filepath" @@ -70,7 +71,7 @@ Traverse: case errSkip: continue Traverse default: - return err + return fmt.Errorf("error while traversing %q: %v", nd.Name, err) } // TODO(rjeczalik): tolerate open failures - add failed names to // AddDirError and notify users which names are not added to the tree. diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/notify.go b/vendor/github.com/rjeczalik/notify/notify.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/notify.go rename to vendor/github.com/rjeczalik/notify/notify.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/tree.go b/vendor/github.com/rjeczalik/notify/tree.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/tree.go rename to vendor/github.com/rjeczalik/notify/tree.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/tree_nonrecursive.go b/vendor/github.com/rjeczalik/notify/tree_nonrecursive.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/tree_nonrecursive.go rename to vendor/github.com/rjeczalik/notify/tree_nonrecursive.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/tree_recursive.go b/vendor/github.com/rjeczalik/notify/tree_recursive.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/tree_recursive.go rename to vendor/github.com/rjeczalik/notify/tree_recursive.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/util.go b/vendor/github.com/rjeczalik/notify/util.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/util.go rename to vendor/github.com/rjeczalik/notify/util.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher.go b/vendor/github.com/rjeczalik/notify/watcher.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher.go rename to vendor/github.com/rjeczalik/notify/watcher.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fen.go b/vendor/github.com/rjeczalik/notify/watcher_fen.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fen.go rename to vendor/github.com/rjeczalik/notify/watcher_fen.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fen_cgo.go b/vendor/github.com/rjeczalik/notify/watcher_fen_cgo.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fen_cgo.go rename to vendor/github.com/rjeczalik/notify/watcher_fen_cgo.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fsevents.go b/vendor/github.com/rjeczalik/notify/watcher_fsevents.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fsevents.go rename to vendor/github.com/rjeczalik/notify/watcher_fsevents.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fsevents_cgo.go b/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fsevents_cgo.go rename to vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_inotify.go b/vendor/github.com/rjeczalik/notify/watcher_inotify.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_inotify.go rename to vendor/github.com/rjeczalik/notify/watcher_inotify.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_kqueue.go b/vendor/github.com/rjeczalik/notify/watcher_kqueue.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_kqueue.go rename to vendor/github.com/rjeczalik/notify/watcher_kqueue.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_readdcw.go b/vendor/github.com/rjeczalik/notify/watcher_readdcw.go similarity index 99% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_readdcw.go rename to vendor/github.com/rjeczalik/notify/watcher_readdcw.go index e8359bba4f..5923bfddae 100644 --- a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_readdcw.go +++ b/vendor/github.com/rjeczalik/notify/watcher_readdcw.go @@ -377,7 +377,7 @@ func (r *readdcw) loopevent(n uint32, overEx *overlappedEx) { var currOffset uint32 for { raw := (*syscall.FileNotifyInformation)(unsafe.Pointer(&overEx.parent.buffer[currOffset])) - name := syscall.UTF16ToString((*[syscall.MAX_PATH]uint16)(unsafe.Pointer(&raw.FileName))[:raw.FileNameLength>>1]) + name := syscall.UTF16ToString((*[syscall.MAX_LONG_PATH]uint16)(unsafe.Pointer(&raw.FileName))[:raw.FileNameLength>>1]) events = append(events, &event{ pathw: overEx.parent.pathw, filter: overEx.parent.filter, diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_stub.go b/vendor/github.com/rjeczalik/notify/watcher_stub.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_stub.go rename to vendor/github.com/rjeczalik/notify/watcher_stub.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_trigger.go b/vendor/github.com/rjeczalik/notify/watcher_trigger.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_trigger.go rename to vendor/github.com/rjeczalik/notify/watcher_trigger.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watchpoint.go b/vendor/github.com/rjeczalik/notify/watchpoint.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watchpoint.go rename to vendor/github.com/rjeczalik/notify/watchpoint.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watchpoint_other.go b/vendor/github.com/rjeczalik/notify/watchpoint_other.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watchpoint_other.go rename to vendor/github.com/rjeczalik/notify/watchpoint_other.go diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/watchpoint_readdcw.go b/vendor/github.com/rjeczalik/notify/watchpoint_readdcw.go similarity index 100% rename from Godeps/_workspace/src/github.com/rjeczalik/notify/watchpoint_readdcw.go rename to vendor/github.com/rjeczalik/notify/watchpoint_readdcw.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/.gitignore b/vendor/github.com/robertkrimen/otto/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/.gitignore rename to vendor/github.com/robertkrimen/otto/.gitignore diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/DESIGN.markdown b/vendor/github.com/robertkrimen/otto/DESIGN.markdown similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/DESIGN.markdown rename to vendor/github.com/robertkrimen/otto/DESIGN.markdown diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/LICENSE b/vendor/github.com/robertkrimen/otto/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/LICENSE rename to vendor/github.com/robertkrimen/otto/LICENSE diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/Makefile b/vendor/github.com/robertkrimen/otto/Makefile similarity index 98% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/Makefile rename to vendor/github.com/robertkrimen/otto/Makefile index 8d74038eb2..9868db3cac 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/Makefile +++ b/vendor/github.com/robertkrimen/otto/Makefile @@ -18,7 +18,7 @@ test: parser inline.go parser: $(MAKE) -C parser -inline.go: inline +inline.go: inline.pl ./$< > $@ ################# diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/README.markdown b/vendor/github.com/robertkrimen/otto/README.markdown similarity index 79% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/README.markdown rename to vendor/github.com/robertkrimen/otto/README.markdown index fe8e1bd4a5..ed14f0ae9e 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/README.markdown +++ b/vendor/github.com/robertkrimen/otto/README.markdown @@ -1,87 +1,108 @@ # otto -- - import "github.com/robertkrimen/otto" +```go +import "github.com/robertkrimen/otto" +``` Package otto is a JavaScript parser and interpreter written natively in Go. http://godoc.org/github.com/robertkrimen/otto - import ( - "github.com/robertkrimen/otto" - ) +```go +import ( + "github.com/robertkrimen/otto" +) +``` Run something in the VM - vm := otto.New() - vm.Run(` - abc = 2 + 2; - console.log("The value of abc is " + abc); // 4 - `) +```go +vm := otto.New() +vm.Run(` + abc = 2 + 2; + console.log("The value of abc is " + abc); // 4 +`) +``` Get a value out of the VM - if value, err := vm.Get("abc"); err == nil { - if value_int, err := value.ToInteger(); err == nil { - fmt.Printf("", value_int, err) - } +```go +if value, err := vm.Get("abc"); err == nil { + if value_int, err := value.ToInteger(); err == nil { + fmt.Printf("", value_int, err) } +} +``` Set a number - vm.Set("def", 11) - vm.Run(` - console.log("The value of def is " + def); - // The value of def is 11 - `) +```go +vm.Set("def", 11) +vm.Run(` + console.log("The value of def is " + def); + // The value of def is 11 +`) +``` Set a string - vm.Set("xyzzy", "Nothing happens.") - vm.Run(` - console.log(xyzzy.length); // 16 - `) +```go +vm.Set("xyzzy", "Nothing happens.") +vm.Run(` + console.log(xyzzy.length); // 16 +`) +``` Get the value of an expression - value, _ = vm.Run("xyzzy.length") - { - // value is an int64 with a value of 16 - value, _ := value.ToInteger() - } +```go +value, _ = vm.Run("xyzzy.length") +{ + // value is an int64 with a value of 16 + value, _ := value.ToInteger() +} +``` An error happens - value, err = vm.Run("abcdefghijlmnopqrstuvwxyz.length") - if err != nil { - // err = ReferenceError: abcdefghijlmnopqrstuvwxyz is not defined - // If there is an error, then value.IsUndefined() is true - ... - } +```go +value, err = vm.Run("abcdefghijlmnopqrstuvwxyz.length") +if err != nil { + // err = ReferenceError: abcdefghijlmnopqrstuvwxyz is not defined + // If there is an error, then value.IsUndefined() is true + ... +} +``` Set a Go function - vm.Set("sayHello", func(call otto.FunctionCall) otto.Value { - fmt.Printf("Hello, %s.\n", call.Argument(0).String()) - return otto.Value{} - }) +```go +vm.Set("sayHello", func(call otto.FunctionCall) otto.Value { + fmt.Printf("Hello, %s.\n", call.Argument(0).String()) + return otto.Value{} +}) +``` Set a Go function that returns something useful - vm.Set("twoPlus", func(call otto.FunctionCall) otto.Value { - right, _ := call.Argument(0).ToInteger() - result, _ := vm.ToValue(2 + right) - return result - }) +```go +vm.Set("twoPlus", func(call otto.FunctionCall) otto.Value { + right, _ := call.Argument(0).ToInteger() + result, _ := vm.ToValue(2 + right) + return result +}) +``` Use the functions in JavaScript - result, _ = vm.Run(` - sayHello("Xyzzy"); // Hello, Xyzzy. - sayHello(); // Hello, undefined - - result = twoPlus(2.0); // 4 - `) +```go +result, _ = vm.Run(` + sayHello("Xyzzy"); // Hello, Xyzzy. + sayHello(); // Hello, undefined + result = twoPlus(2.0); // 4 +`) +``` ### Parser @@ -92,23 +113,25 @@ http://godoc.org/github.com/robertkrimen/otto/parser Parse and return an AST - filename := "" // A filename is optional - src := ` - // Sample xyzzy example - (function(){ - if (3.14159 > 0) { - console.log("Hello, World."); - return; - } +```go +filenamee := "" // A filename is optional +src := ` + // Sample xyzzy example + (function(){ + if (3.14159 > 0) { + console.log("Hello, World."); + return; + } - var xyzzy = NaN; - console.log("Nothing happens."); - return xyzzy; - })(); - ` + var xyzzy = NaN; + console.log("Nothing happens."); + return xyzzy; + })(); +` - // Parse some JavaScript, yielding a *ast.Program and/or an ErrorList - program, err := parser.ParseFile(nil, filename, src, 0) +// Parse some JavaScript, yielding a *ast.Program and/or an ErrorList +program, err := parser.ParseFile(nil, filename, src, 0) +``` ### otto @@ -126,12 +149,14 @@ Run JavaScript by entering some source on stdin or by giving otto a filename: Optionally include the JavaScript utility-belt library, underscore, with this import: - import ( - "github.com/robertkrimen/otto" - _ "github.com/robertkrimen/otto/underscore" - ) +```go +import ( + "github.com/robertkrimen/otto" + _ "github.com/robertkrimen/otto/underscore" +) - // Now every otto runtime will come loaded with underscore +// Now every otto runtime will come loaded with underscore +``` For more information: http://github.com/robertkrimen/otto/tree/master/underscore @@ -142,6 +167,7 @@ The following are some limitations with otto: * "use strict" will parse, but does nothing. * The regular expression engine (re2/regexp) is not fully compatible with the ECMA5 specification. + * Otto targets ES5. ES6 features (eg: Typed Arrays) are not supported. ### Regular Expression Incompatibility @@ -172,53 +198,55 @@ In addition to the above, re2 (Go) has a different definition for \s: [\t\n\f\r If you want to stop long running executions (like third-party code), you can use the interrupt channel to do this: - package main +```go +package main - import ( - "errors" - "fmt" - "os" - "time" +import ( + "errors" + "fmt" + "os" + "time" - "github.com/robertkrimen/otto" - ) + "github.com/robertkrimen/otto" +) - var halt = errors.New("Stahp") +var halt = errors.New("Stahp") - func main() { - runUnsafe(`var abc = [];`) - runUnsafe(` - while (true) { - // Loop forever - }`) - } +func main() { + runUnsafe(`var abc = [];`) + runUnsafe(` + while (true) { + // Loop forever + }`) +} - func runUnsafe(unsafe string) { - start := time.Now() - defer func() { - duration := time.Since(start) - if caught := recover(); caught != nil { - if caught == halt { - fmt.Fprintf(os.Stderr, "Some code took to long! Stopping after: %v\n", duration) - return - } - panic(caught) // Something else happened, repanic! +func runUnsafe(unsafe string) { + start := time.Now() + defer func() { + duration := time.Since(start) + if caught := recover(); caught != nil { + if caught == halt { + fmt.Fprintf(os.Stderr, "Some code took to long! Stopping after: %v\n", duration) + return } - fmt.Fprintf(os.Stderr, "Ran code successfully: %v\n", duration) - }() + panic(caught) // Something else happened, repanic! + } + fmt.Fprintf(os.Stderr, "Ran code successfully: %v\n", duration) + }() - vm := otto.New() - vm.Interrupt = make(chan func(), 1) // The buffer prevents blocking + vm := otto.New() + vm.Interrupt = make(chan func(), 1) // The buffer prevents blocking - go func() { - time.Sleep(2 * time.Second) // Stop after two seconds - vm.Interrupt <- func() { - panic(halt) - } - }() + go func() { + time.Sleep(2 * time.Second) // Stop after two seconds + vm.Interrupt <- func() { + panic(halt) + } + }() - vm.Run(unsafe) // Here be dragons (risky code) - } + vm.Run(unsafe) // Here be dragons (risky code) +} +``` Where is setTimeout/setInterval? @@ -425,15 +453,17 @@ If source begins with "new " (A lowercase new followed by a space), then Call will invoke the function constructor rather than performing a function call. In this case, the this argument has no effect. - // value is a String object - value, _ := vm.Call("Object", nil, "Hello, World.") +```go +// value is a String object +value, _ := vm.Call("Object", nil, "Hello, World.") - // Likewise... - value, _ := vm.Call("new Object", nil, "Hello, World.") +// Likewise... +value, _ := vm.Call("new Object", nil, "Hello, World.") - // This will perform a concat on the given array and return the result - // value is [ 1, 2, 3, undefined, 4, 5, 6, 7, "abc" ] - value, _ := vm.Call(`[ 1, 2, 3, undefined, 4 ].concat`, nil, 5, 6, 7, "abc") +// This will perform a concat on the given array and return the result +// value is [ 1, 2, 3, undefined, 4, 5, 6, 7, "abc" ] +value, _ := vm.Call(`[ 1, 2, 3, undefined, 4 ].concat`, nil, 5, 6, 7, "abc") +``` #### func (*Otto) Compile @@ -443,8 +473,10 @@ func (self *Otto) Compile(filename string, src interface{}) (*Script, error) Compile will parse the given source and return a Script value or nil and an error if there was a problem during compilation. - script, err := vm.Compile("", `var abc; if (!abc) abc = 0; abc += 2; abc;`) - vm.Run(script) +```go +script, err := vm.Compile("", `var abc; if (!abc) abc = 0; abc += 2; abc;`) +vm.Run(script) +``` #### func (*Otto) Copy @@ -479,16 +511,22 @@ Object will run the given source and return the result as an object. For example, accessing an existing object: - object, _ := vm.Object(`Number`) +```go +object, _ := vm.Object(`Number`) +``` Or, creating a new object: - object, _ := vm.Object(`({ xyzzy: "Nothing happens." })`) +```go +object, _ := vm.Object(`({ xyzzy: "Nothing happens." })`) +``` Or, creating and assigning an object: - object, _ := vm.Object(`xyzzy = {}`) - object.Set("volume", 11) +```go +object, _ := vm.Object(`xyzzy = {}`) +object.Set("volume", 11) +``` If there is an error (like the source does not result in an object), then nil and an error is returned. @@ -569,7 +607,9 @@ FalseValue will return a value representing false. It is equivalent to: - ToValue(false) +```go +ToValue(false) +``` #### func NaNValue @@ -580,7 +620,9 @@ NaNValue will return a value representing NaN. It is equivalent to: - ToValue(math.NaN()) +```go +ToValue(math.NaN()) +``` #### func NullValue @@ -609,7 +651,9 @@ TrueValue will return a value representing true. It is equivalent to: - ToValue(true) +```go +ToValue(true) +``` #### func UndefinedValue diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/ast/README.markdown b/vendor/github.com/robertkrimen/otto/ast/README.markdown similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/ast/README.markdown rename to vendor/github.com/robertkrimen/otto/ast/README.markdown diff --git a/vendor/github.com/robertkrimen/otto/ast/comments.go b/vendor/github.com/robertkrimen/otto/ast/comments.go new file mode 100644 index 0000000000..ef2cc3d89b --- /dev/null +++ b/vendor/github.com/robertkrimen/otto/ast/comments.go @@ -0,0 +1,278 @@ +package ast + +import ( + "fmt" + "github.com/robertkrimen/otto/file" +) + +// CommentPosition determines where the comment is in a given context +type CommentPosition int + +const ( + _ CommentPosition = iota + LEADING // Before the pertinent expression + TRAILING // After the pertinent expression + KEY // Before a key in an object + COLON // After a colon in a field declaration + FINAL // Final comments in a block, not belonging to a specific expression or the comment after a trailing , in an array or object literal + IF // After an if keyword + WHILE // After a while keyword + DO // After do keyword + FOR // After a for keyword + WITH // After a with keyword + TBD +) + +// Comment contains the data of the comment +type Comment struct { + Begin file.Idx + Text string + Position CommentPosition +} + +// NewComment creates a new comment +func NewComment(text string, idx file.Idx) *Comment { + comment := &Comment{ + Begin: idx, + Text: text, + Position: TBD, + } + + return comment +} + +// String returns a stringified version of the position +func (cp CommentPosition) String() string { + switch cp { + case LEADING: + return "Leading" + case TRAILING: + return "Trailing" + case KEY: + return "Key" + case COLON: + return "Colon" + case FINAL: + return "Final" + case IF: + return "If" + case WHILE: + return "While" + case DO: + return "Do" + case FOR: + return "For" + case WITH: + return "With" + default: + return "???" + } +} + +// String returns a stringified version of the comment +func (c Comment) String() string { + return fmt.Sprintf("Comment: %v", c.Text) +} + +// Comments defines the current view of comments from the parser +type Comments struct { + // CommentMap is a reference to the parser comment map + CommentMap CommentMap + // Comments lists the comments scanned, not linked to a node yet + Comments []*Comment + // future lists the comments after a line break during a sequence of comments + future []*Comment + // Current is node for which comments are linked to + Current Expression + + // wasLineBreak determines if a line break occured while scanning for comments + wasLineBreak bool + // primary determines whether or not processing a primary expression + primary bool + // afterBlock determines whether or not being after a block statement + afterBlock bool +} + +func NewComments() *Comments { + comments := &Comments{ + CommentMap: CommentMap{}, + } + + return comments +} + +func (c *Comments) String() string { + return fmt.Sprintf("NODE: %v, Comments: %v, Future: %v(LINEBREAK:%v)", c.Current, len(c.Comments), len(c.future), c.wasLineBreak) +} + +// FetchAll returns all the currently scanned comments, +// including those from the next line +func (c *Comments) FetchAll() []*Comment { + defer func() { + c.Comments = nil + c.future = nil + }() + + return append(c.Comments, c.future...) +} + +// Fetch returns all the currently scanned comments +func (c *Comments) Fetch() []*Comment { + defer func() { + c.Comments = nil + }() + + return c.Comments +} + +// ResetLineBreak marks the beginning of a new statement +func (c *Comments) ResetLineBreak() { + c.wasLineBreak = false +} + +// MarkPrimary will mark the context as processing a primary expression +func (c *Comments) MarkPrimary() { + c.primary = true + c.wasLineBreak = false +} + +// AfterBlock will mark the context as being after a block. +func (c *Comments) AfterBlock() { + c.afterBlock = true +} + +// AddComment adds a comment to the view. +// Depending on the context, comments are added normally or as post line break. +func (c *Comments) AddComment(comment *Comment) { + if c.primary { + if !c.wasLineBreak { + c.Comments = append(c.Comments, comment) + } else { + c.future = append(c.future, comment) + } + } else { + if !c.wasLineBreak || (c.Current == nil && !c.afterBlock) { + c.Comments = append(c.Comments, comment) + } else { + c.future = append(c.future, comment) + } + } +} + +// MarkComments will mark the found comments as the given position. +func (c *Comments) MarkComments(position CommentPosition) { + for _, comment := range c.Comments { + if comment.Position == TBD { + comment.Position = position + } + } + for _, c := range c.future { + if c.Position == TBD { + c.Position = position + } + } +} + +// Unset the current node and apply the comments to the current expression. +// Resets context variables. +func (c *Comments) Unset() { + if c.Current != nil { + c.applyComments(c.Current, c.Current, TRAILING) + c.Current = nil + } + c.wasLineBreak = false + c.primary = false + c.afterBlock = false +} + +// SetExpression sets the current expression. +// It is applied the found comments, unless the previous expression has not been unset. +// It is skipped if the node is already set or if it is a part of the previous node. +func (c *Comments) SetExpression(node Expression) { + // Skipping same node + if c.Current == node { + return + } + if c.Current != nil && c.Current.Idx1() == node.Idx1() { + c.Current = node + return + } + previous := c.Current + c.Current = node + + // Apply the found comments and futures to the node and the previous. + c.applyComments(node, previous, TRAILING) +} + +// PostProcessNode applies all found comments to the given node +func (c *Comments) PostProcessNode(node Node) { + c.applyComments(node, nil, TRAILING) +} + +// applyComments applies both the comments and the future comments to the given node and the previous one, +// based on the context. +func (c *Comments) applyComments(node, previous Node, position CommentPosition) { + if previous != nil { + c.CommentMap.AddComments(previous, c.Comments, position) + c.Comments = nil + } else { + c.CommentMap.AddComments(node, c.Comments, position) + c.Comments = nil + } + // Only apply the future comments to the node if the previous is set. + // This is for detecting end of line comments and which node comments on the following lines belongs to + if previous != nil { + c.CommentMap.AddComments(node, c.future, position) + c.future = nil + } +} + +// AtLineBreak will mark a line break +func (c *Comments) AtLineBreak() { + c.wasLineBreak = true +} + +// CommentMap is the data structure where all found comments are stored +type CommentMap map[Node][]*Comment + +// AddComment adds a single comment to the map +func (cm CommentMap) AddComment(node Node, comment *Comment) { + list := cm[node] + list = append(list, comment) + + cm[node] = list +} + +// AddComments adds a slice of comments, given a node and an updated position +func (cm CommentMap) AddComments(node Node, comments []*Comment, position CommentPosition) { + for _, comment := range comments { + if comment.Position == TBD { + comment.Position = position + } + cm.AddComment(node, comment) + } +} + +// Size returns the size of the map +func (cm CommentMap) Size() int { + size := 0 + for _, comments := range cm { + size += len(comments) + } + + return size +} + +// MoveComments moves comments with a given position from a node to another +func (cm CommentMap) MoveComments(from, to Node, position CommentPosition) { + for i, c := range cm[from] { + if c.Position == position { + cm.AddComment(to, c) + + // Remove the comment from the "from" slice + cm[from][i] = cm[from][len(cm[from])-1] + cm[from][len(cm[from])-1] = nil + cm[from] = cm[from][:len(cm[from])-1] + } + } +} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/ast/node.go b/vendor/github.com/robertkrimen/otto/ast/node.go similarity index 97% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/ast/node.go rename to vendor/github.com/robertkrimen/otto/ast/node.go index 8a651dc2f1..49ae375d12 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/ast/node.go +++ b/vendor/github.com/robertkrimen/otto/ast/node.go @@ -83,7 +83,7 @@ type ( DotExpression struct { Left Expression - Identifier Identifier + Identifier *Identifier } EmptyExpression struct { @@ -277,6 +277,10 @@ type ( Body Statement } + FunctionStatement struct { + Function *FunctionLiteral + } + IfStatement struct { If file.Idx Test Expression @@ -345,6 +349,7 @@ func (*EmptyStatement) _statementNode() {} func (*ExpressionStatement) _statementNode() {} func (*ForInStatement) _statementNode() {} func (*ForStatement) _statementNode() {} +func (*FunctionStatement) _statementNode() {} func (*IfStatement) _statementNode() {} func (*LabelledStatement) _statementNode() {} func (*ReturnStatement) _statementNode() {} @@ -390,6 +395,8 @@ type Program struct { DeclarationList []Declaration File *file.File + + Comments CommentMap } // ==== // @@ -430,6 +437,7 @@ func (self *EmptyStatement) Idx0() file.Idx { return self.Semicolon } func (self *ExpressionStatement) Idx0() file.Idx { return self.Expression.Idx0() } func (self *ForInStatement) Idx0() file.Idx { return self.For } func (self *ForStatement) Idx0() file.Idx { return self.For } +func (self *FunctionStatement) Idx0() file.Idx { return self.Function.Idx0() } func (self *IfStatement) Idx0() file.Idx { return self.If } func (self *LabelledStatement) Idx0() file.Idx { return self.Label.Idx0() } func (self *Program) Idx0() file.Idx { return self.Body[0].Idx0() } @@ -489,6 +497,7 @@ func (self *EmptyStatement) Idx1() file.Idx { return self.Semicolon + 1 } func (self *ExpressionStatement) Idx1() file.Idx { return self.Expression.Idx1() } func (self *ForInStatement) Idx1() file.Idx { return self.Body.Idx1() } func (self *ForStatement) Idx1() file.Idx { return self.Body.Idx1() } +func (self *FunctionStatement) Idx1() file.Idx { return self.Function.Idx1() } func (self *IfStatement) Idx1() file.Idx { if self.Alternate != nil { return self.Alternate.Idx1() diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin.go b/vendor/github.com/robertkrimen/otto/builtin.go similarity index 98% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin.go rename to vendor/github.com/robertkrimen/otto/builtin.go index c3375a1080..83f715083d 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin.go +++ b/vendor/github.com/robertkrimen/otto/builtin.go @@ -18,7 +18,7 @@ func builtinGlobal_eval(call FunctionCall) Value { return src } runtime := call.runtime - program := runtime.cmpl_parseOrThrow(src.string()) + program := runtime.cmpl_parseOrThrow(src.string(), nil) if !call.eval { // Not a direct call to eval, so we enter the global ExecutionContext runtime.enterGlobalScope() @@ -159,7 +159,7 @@ func builtinGlobal_parseFloat(call FunctionCall) Value { } value, err := strconv.ParseFloat(input, 64) if err != nil { - for end := len(input); end > 0; end -= 1 { + for end := len(input); end > 0; end-- { input := input[0:end] if !parseFloat_matchValid.MatchString(input) { return NaNValue() diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_array.go b/vendor/github.com/robertkrimen/otto/builtin_array.go similarity index 96% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_array.go rename to vendor/github.com/robertkrimen/otto/builtin_array.go index 160a251c65..557ffc0248 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_array.go +++ b/vendor/github.com/robertkrimen/otto/builtin_array.go @@ -416,27 +416,36 @@ func arraySortSwap(thisObject *_object, index0, index1 uint) { } } -func arraySortQuickPartition(thisObject *_object, left, right, pivot uint, compare *_object) uint { +func arraySortQuickPartition(thisObject *_object, left, right, pivot uint, compare *_object) (uint, uint) { arraySortSwap(thisObject, pivot, right) // Right is now the pivot value cursor := left + cursor2 := left for index := left; index < right; index++ { - if sortCompare(thisObject, index, right, compare) < 0 { // Compare to the pivot value + comparison := sortCompare(thisObject, index, right, compare) // Compare to the pivot value + if comparison < 0 { arraySortSwap(thisObject, index, cursor) + if cursor < cursor2 { + arraySortSwap(thisObject, index, cursor2) + } cursor += 1 + cursor2 += 1 + } else if comparison == 0 { + arraySortSwap(thisObject, index, cursor2) + cursor2 += 1 } } - arraySortSwap(thisObject, cursor, right) - return cursor + arraySortSwap(thisObject, cursor2, right) + return cursor, cursor2 } func arraySortQuickSort(thisObject *_object, left, right uint, compare *_object) { if left < right { - pivot := left + (right-left)/2 - pivot = arraySortQuickPartition(thisObject, left, right, pivot, compare) + middle := left + (right-left)/2 + pivot, pivot2 := arraySortQuickPartition(thisObject, left, right, middle, compare) if pivot > 0 { arraySortQuickSort(thisObject, left, pivot-1, compare) } - arraySortQuickSort(thisObject, pivot+1, right, compare) + arraySortQuickSort(thisObject, pivot2+1, right, compare) } } @@ -653,7 +662,7 @@ func builtinArray_reduceRight(call FunctionCall) Value { for ; index >= 0; index-- { if key := arrayIndexToString(index); thisObject.hasProperty(key) { accumulator = thisObject.get(key) - index -= 1 + index-- break } } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_boolean.go b/vendor/github.com/robertkrimen/otto/builtin_boolean.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_boolean.go rename to vendor/github.com/robertkrimen/otto/builtin_boolean.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_date.go b/vendor/github.com/robertkrimen/otto/builtin_date.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_date.go rename to vendor/github.com/robertkrimen/otto/builtin_date.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_error.go b/vendor/github.com/robertkrimen/otto/builtin_error.go similarity index 86% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_error.go rename to vendor/github.com/robertkrimen/otto/builtin_error.go index 4c054fbea8..41da84ef24 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_error.go +++ b/vendor/github.com/robertkrimen/otto/builtin_error.go @@ -5,11 +5,11 @@ import ( ) func builtinError(call FunctionCall) Value { - return toValue_object(call.runtime.newError("", call.Argument(0))) + return toValue_object(call.runtime.newError("Error", call.Argument(0), 1)) } func builtinNewError(self *_object, argumentList []Value) Value { - return toValue_object(self.runtime.newError("", valueOfArrayIndex(argumentList, 0))) + return toValue_object(self.runtime.newError("Error", valueOfArrayIndex(argumentList, 0), 0)) } func builtinError_toString(call FunctionCall) Value { @@ -42,7 +42,7 @@ func builtinError_toString(call FunctionCall) Value { } func (runtime *_runtime) newEvalError(message Value) *_object { - self := runtime.newErrorObject("EvalError", message) + self := runtime.newErrorObject("EvalError", message, 0) self.prototype = runtime.global.EvalErrorPrototype return self } @@ -56,7 +56,7 @@ func builtinNewEvalError(self *_object, argumentList []Value) Value { } func (runtime *_runtime) newTypeError(message Value) *_object { - self := runtime.newErrorObject("TypeError", message) + self := runtime.newErrorObject("TypeError", message, 0) self.prototype = runtime.global.TypeErrorPrototype return self } @@ -70,7 +70,7 @@ func builtinNewTypeError(self *_object, argumentList []Value) Value { } func (runtime *_runtime) newRangeError(message Value) *_object { - self := runtime.newErrorObject("RangeError", message) + self := runtime.newErrorObject("RangeError", message, 0) self.prototype = runtime.global.RangeErrorPrototype return self } @@ -84,13 +84,13 @@ func builtinNewRangeError(self *_object, argumentList []Value) Value { } func (runtime *_runtime) newURIError(message Value) *_object { - self := runtime.newErrorObject("URIError", message) + self := runtime.newErrorObject("URIError", message, 0) self.prototype = runtime.global.URIErrorPrototype return self } func (runtime *_runtime) newReferenceError(message Value) *_object { - self := runtime.newErrorObject("ReferenceError", message) + self := runtime.newErrorObject("ReferenceError", message, 0) self.prototype = runtime.global.ReferenceErrorPrototype return self } @@ -104,7 +104,7 @@ func builtinNewReferenceError(self *_object, argumentList []Value) Value { } func (runtime *_runtime) newSyntaxError(message Value) *_object { - self := runtime.newErrorObject("SyntaxError", message) + self := runtime.newErrorObject("SyntaxError", message, 0) self.prototype = runtime.global.SyntaxErrorPrototype return self } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_function.go b/vendor/github.com/robertkrimen/otto/builtin_function.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_function.go rename to vendor/github.com/robertkrimen/otto/builtin_function.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_json.go b/vendor/github.com/robertkrimen/otto/builtin_json.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_json.go rename to vendor/github.com/robertkrimen/otto/builtin_json.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_math.go b/vendor/github.com/robertkrimen/otto/builtin_math.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_math.go rename to vendor/github.com/robertkrimen/otto/builtin_math.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_number.go b/vendor/github.com/robertkrimen/otto/builtin_number.go similarity index 89% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_number.go rename to vendor/github.com/robertkrimen/otto/builtin_number.go index 26a03e7b61..f99a42a2fb 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_number.go +++ b/vendor/github.com/robertkrimen/otto/builtin_number.go @@ -30,7 +30,7 @@ func builtinNumber_toString(call FunctionCall) Value { if radixArgument.IsDefined() { integer := toIntegerFloat(radixArgument) if integer < 2 || integer > 36 { - panic(call.runtime.panicRangeError("RangeError: toString() radix must be between 2 and 36")) + panic(call.runtime.panicRangeError("toString() radix must be between 2 and 36")) } radix = int(integer) } @@ -67,7 +67,7 @@ func builtinNumber_toExponential(call FunctionCall) Value { if value := call.Argument(0); value.IsDefined() { precision = toIntegerFloat(value) if 0 > precision { - panic(call.runtime.panicRangeError("RangeError: toString() radix must be between 2 and 36")) + panic(call.runtime.panicRangeError("toString() radix must be between 2 and 36")) } } return toValue_string(strconv.FormatFloat(call.This.float64(), 'e', int(precision), 64)) @@ -83,7 +83,7 @@ func builtinNumber_toPrecision(call FunctionCall) Value { } precision := toIntegerFloat(value) if 1 > precision { - panic(call.runtime.panicRangeError("RangeError: toPrecision() precision must be greater than 1")) + panic(call.runtime.panicRangeError("toPrecision() precision must be greater than 1")) } return toValue_string(strconv.FormatFloat(call.This.float64(), 'g', int(precision), 64)) } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_object.go b/vendor/github.com/robertkrimen/otto/builtin_object.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_object.go rename to vendor/github.com/robertkrimen/otto/builtin_object.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_regexp.go b/vendor/github.com/robertkrimen/otto/builtin_regexp.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_regexp.go rename to vendor/github.com/robertkrimen/otto/builtin_regexp.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_string.go b/vendor/github.com/robertkrimen/otto/builtin_string.go similarity index 98% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_string.go rename to vendor/github.com/robertkrimen/otto/builtin_string.go index 6a17184589..f5f09fee18 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/builtin_string.go +++ b/vendor/github.com/robertkrimen/otto/builtin_string.go @@ -380,12 +380,7 @@ func builtinString_split(call FunctionCall) Value { split = split[:limit] } - valueArray := make([]Value, len(split)) - for index, value := range split { - valueArray[index] = toValue_string(value) - } - - return toValue_object(call.runtime.newArrayOf(valueArray)) + return call.runtime.toValue(split) } } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/clone.go b/vendor/github.com/robertkrimen/otto/clone.go similarity index 96% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/clone.go rename to vendor/github.com/robertkrimen/otto/clone.go index 82cb0f0af3..23b59f8acb 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/clone.go +++ b/vendor/github.com/robertkrimen/otto/clone.go @@ -17,7 +17,13 @@ func (in *_runtime) clone() *_runtime { in.lck.Lock() defer in.lck.Unlock() - out := &_runtime{} + out := &_runtime{ + debugger: in.debugger, + random: in.random, + stackLimit: in.stackLimit, + traceLimit: in.traceLimit, + } + clone := _clone{ runtime: out, _object: make(map[*_object]*_object), diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl.go b/vendor/github.com/robertkrimen/otto/cmpl.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl.go rename to vendor/github.com/robertkrimen/otto/cmpl.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_evaluate.go b/vendor/github.com/robertkrimen/otto/cmpl_evaluate.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_evaluate.go rename to vendor/github.com/robertkrimen/otto/cmpl_evaluate.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_evaluate_expression.go b/vendor/github.com/robertkrimen/otto/cmpl_evaluate_expression.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_evaluate_expression.go rename to vendor/github.com/robertkrimen/otto/cmpl_evaluate_expression.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_evaluate_statement.go b/vendor/github.com/robertkrimen/otto/cmpl_evaluate_statement.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_evaluate_statement.go rename to vendor/github.com/robertkrimen/otto/cmpl_evaluate_statement.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_parse.go b/vendor/github.com/robertkrimen/otto/cmpl_parse.go similarity index 99% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_parse.go rename to vendor/github.com/robertkrimen/otto/cmpl_parse.go index f1e002d390..dc5baa12a8 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/cmpl_parse.go +++ b/vendor/github.com/robertkrimen/otto/cmpl_parse.go @@ -271,6 +271,9 @@ func (cmpl *_compiler) parseStatement(in ast.Statement) _nodeStatement { } return out + case *ast.FunctionStatement: + return emptyStatement + case *ast.IfStatement: return &_nodeIfStatement{ test: cmpl.parseExpression(in.Test), diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/console.go b/vendor/github.com/robertkrimen/otto/console.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/console.go rename to vendor/github.com/robertkrimen/otto/console.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/dbg.go b/vendor/github.com/robertkrimen/otto/dbg.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/dbg.go rename to vendor/github.com/robertkrimen/otto/dbg.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/dbg/dbg.go b/vendor/github.com/robertkrimen/otto/dbg/dbg.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/dbg/dbg.go rename to vendor/github.com/robertkrimen/otto/dbg/dbg.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/error.go b/vendor/github.com/robertkrimen/otto/error.go similarity index 72% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/error.go rename to vendor/github.com/robertkrimen/otto/error.go index 1114710444..41a5c10e7c 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/error.go +++ b/vendor/github.com/robertkrimen/otto/error.go @@ -3,7 +3,6 @@ package otto import ( "errors" "fmt" - "strings" "github.com/robertkrimen/otto/file" ) @@ -32,10 +31,31 @@ type _error struct { offset int } +func (err _error) format() string { + if len(err.name) == 0 { + return err.message + } + if len(err.message) == 0 { + return err.name + } + return fmt.Sprintf("%s: %s", err.name, err.message) +} + +func (err _error) formatWithStack() string { + str := err.format() + "\n" + for _, frame := range err.trace { + str += " at " + frame.location() + "\n" + } + return str +} + type _frame struct { - file *file.File - offset int - callee string + native bool + nativeFile string + nativeLine int + file *file.File + offset int + callee string } var ( @@ -45,17 +65,25 @@ var ( type _at int func (fr _frame) location() string { - if fr.file == nil { - return "" - } - path := fr.file.Name() - line, column := _position(fr.file, fr.offset) + str := "" - if path == "" { - path = "" - } + switch { + case fr.native: + str = "" + if fr.nativeFile != "" && fr.nativeLine != 0 { + str = fmt.Sprintf("%s:%d", fr.nativeFile, fr.nativeLine) + } + case fr.file != nil: + if p := fr.file.Position(file.Idx(fr.offset)); p != nil { + path, line, column := p.Filename, p.Line, p.Column - str := fmt.Sprintf("%s:%d:%d", path, line, column) + if path == "" { + path = "" + } + + str = fmt.Sprintf("%s:%d:%d", path, line, column) + } + } if fr.callee != "" { str = fmt.Sprintf("%s (%s)", fr.callee, str) @@ -64,30 +92,6 @@ func (fr _frame) location() string { return str } -func _position(file *file.File, offset int) (line, column int) { - { - offset := offset - file.Base() - if offset < 0 { - return -offset, -1 - } - - src := file.Source() - if offset >= len(src) { - return -offset, -len(src) - } - src = src[:offset] - - line := 1 + strings.Count(src, "\n") - column := 0 - if index := strings.LastIndex(src, "\n"); index >= 0 { - column = offset - index - } else { - column = 1 + len(src) - } - return line, column - } -} - // An Error represents a runtime error, e.g. a TypeError, a ReferenceError, etc. type Error struct { _error @@ -98,13 +102,7 @@ type Error struct { // TypeError: 'def' is not a function // func (err Error) Error() string { - if len(err.name) == 0 { - return err.message - } - if len(err.message) == 0 { - return err.name - } - return fmt.Sprintf("%s: %s", err.name, err.message) + return err.format() } // String returns a description of the error and a trace of where the @@ -115,11 +113,7 @@ func (err Error) Error() string { // at :7:1/ // func (err Error) String() string { - str := err.Error() + "\n" - for _, frame := range err.trace { - str += " at " + frame.location() + "\n" - } - return str + return err.formatWithStack() } func (err _error) describe(format string, in ...interface{}) string { @@ -140,7 +134,7 @@ func (rt *_runtime) typeErrorResult(throw bool) bool { return false } -func newError(rt *_runtime, name string, in ...interface{}) _error { +func newError(rt *_runtime, name string, stackFramesToPop int, in ...interface{}) _error { err := _error{ name: name, offset: -1, @@ -148,33 +142,42 @@ func newError(rt *_runtime, name string, in ...interface{}) _error { description := "" length := len(in) - if rt != nil { + if rt != nil && rt.scope != nil { scope := rt.scope + + for i := 0; i < stackFramesToPop; i++ { + if scope.outer != nil { + scope = scope.outer + } + } + frame := scope.frame + if length > 0 { if at, ok := in[length-1].(_at); ok { in = in[0 : length-1] if scope != nil { frame.offset = int(at) } - length -= 1 + length-- } if length > 0 { description, in = in[0].(string), in[1:] } } - limit := 10 + + limit := rt.traceLimit + err.trace = append(err.trace, frame) if scope != nil { - for limit > 0 { - scope = scope.outer - if scope == nil { + for scope = scope.outer; scope != nil; scope = scope.outer { + if limit--; limit == 0 { break } + if scope.frame.offset >= 0 { err.trace = append(err.trace, scope.frame) } - limit-- } } } else { @@ -183,36 +186,37 @@ func newError(rt *_runtime, name string, in ...interface{}) _error { } } err.message = err.describe(description, in...) + return err } func (rt *_runtime) panicTypeError(argumentList ...interface{}) *_exception { return &_exception{ - value: newError(rt, "TypeError", argumentList...), + value: newError(rt, "TypeError", 0, argumentList...), } } func (rt *_runtime) panicReferenceError(argumentList ...interface{}) *_exception { return &_exception{ - value: newError(rt, "ReferenceError", argumentList...), + value: newError(rt, "ReferenceError", 0, argumentList...), } } func (rt *_runtime) panicURIError(argumentList ...interface{}) *_exception { return &_exception{ - value: newError(rt, "URIError", argumentList...), + value: newError(rt, "URIError", 0, argumentList...), } } func (rt *_runtime) panicSyntaxError(argumentList ...interface{}) *_exception { return &_exception{ - value: newError(rt, "SyntaxError", argumentList...), + value: newError(rt, "SyntaxError", 0, argumentList...), } } func (rt *_runtime) panicRangeError(argumentList ...interface{}) *_exception { return &_exception{ - value: newError(rt, "RangeError", argumentList...), + value: newError(rt, "RangeError", 0, argumentList...), } } @@ -223,6 +227,9 @@ func catchPanic(function func()) (err error) { caught = exception.eject() } switch caught := caught.(type) { + case *Error: + err = caught + return case _error: err = &Error{caught} return diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/evaluate.go b/vendor/github.com/robertkrimen/otto/evaluate.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/evaluate.go rename to vendor/github.com/robertkrimen/otto/evaluate.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/file/README.markdown b/vendor/github.com/robertkrimen/otto/file/README.markdown similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/file/README.markdown rename to vendor/github.com/robertkrimen/otto/file/README.markdown diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/file/file.go b/vendor/github.com/robertkrimen/otto/file/file.go similarity index 77% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/file/file.go rename to vendor/github.com/robertkrimen/otto/file/file.go index 76524ac39e..9093206e8e 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/file/file.go +++ b/vendor/github.com/robertkrimen/otto/file/file.go @@ -5,6 +5,8 @@ package file import ( "fmt" "strings" + + "gopkg.in/sourcemap.v1" ) // Idx is a compact encoding of a source position within a file set. @@ -90,28 +92,20 @@ func (self *FileSet) File(idx Idx) *File { // Position converts an Idx in the FileSet into a Position. func (self *FileSet) Position(idx Idx) *Position { - position := &Position{} for _, file := range self.files { if idx <= Idx(file.base+len(file.src)) { - offset := int(idx) - file.base - src := file.src[:offset] - position.Filename = file.name - position.Offset = offset - position.Line = 1 + strings.Count(src, "\n") - if index := strings.LastIndex(src, "\n"); index >= 0 { - position.Column = offset - index - } else { - position.Column = 1 + len(src) - } + return file.Position(idx - Idx(file.base)) } } - return position + + return nil } type File struct { name string src string base int // This will always be 1 or greater + sm *sourcemap.Consumer } func NewFile(filename, src string, base int) *File { @@ -122,6 +116,11 @@ func NewFile(filename, src string, base int) *File { } } +func (fl *File) WithSourceMap(sm *sourcemap.Consumer) *File { + fl.sm = sm + return fl +} + func (fl *File) Name() string { return fl.name } @@ -133,3 +132,33 @@ func (fl *File) Source() string { func (fl *File) Base() int { return fl.base } + +func (fl *File) Position(idx Idx) *Position { + position := &Position{} + + offset := int(idx) - fl.base + + if offset >= len(fl.src) || offset < 0 { + return nil + } + + src := fl.src[:offset] + + position.Filename = fl.name + position.Offset = offset + position.Line = strings.Count(src, "\n") + 1 + + if index := strings.LastIndex(src, "\n"); index >= 0 { + position.Column = offset - index + } else { + position.Column = len(src) + 1 + } + + if fl.sm != nil { + if f, _, l, c, ok := fl.sm.Source(position.Line, position.Column); ok { + position.Filename, position.Line, position.Column = f, l, c + } + } + + return position +} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/global.go b/vendor/github.com/robertkrimen/otto/global.go similarity index 94% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/global.go rename to vendor/github.com/robertkrimen/otto/global.go index 4f035314a1..eb2a2a0fbf 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/global.go +++ b/vendor/github.com/robertkrimen/otto/global.go @@ -166,7 +166,7 @@ func (runtime *_runtime) newDate(epoch float64) *_object { return self } -func (runtime *_runtime) newError(name string, message Value) *_object { +func (runtime *_runtime) newError(name string, message Value, stackFramesToPop int) *_object { var self *_object switch name { case "EvalError": @@ -183,7 +183,7 @@ func (runtime *_runtime) newError(name string, message Value) *_object { return runtime.newURIError(message) } - self = runtime.newErrorObject(name, message) + self = runtime.newErrorObject(name, message, stackFramesToPop) self.prototype = runtime.global.ErrorPrototype if name != "" { self.defineProperty("name", toValue_string(name), 0111, false) @@ -191,8 +191,8 @@ func (runtime *_runtime) newError(name string, message Value) *_object { return self } -func (runtime *_runtime) newNativeFunction(name string, _nativeFunction _nativeFunction) *_object { - self := runtime.newNativeFunctionObject(name, _nativeFunction, 0) +func (runtime *_runtime) newNativeFunction(name, file string, line int, _nativeFunction _nativeFunction) *_object { + self := runtime.newNativeFunctionObject(name, file, line, _nativeFunction, 0) self.prototype = runtime.global.FunctionPrototype prototype := runtime.newObject() self.defineProperty("prototype", toValue_object(prototype), 0100, false) diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/inline.go b/vendor/github.com/robertkrimen/otto/inline.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/inline.go rename to vendor/github.com/robertkrimen/otto/inline.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/inline b/vendor/github.com/robertkrimen/otto/inline.pl old mode 100644 new mode 100755 similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/inline rename to vendor/github.com/robertkrimen/otto/inline.pl diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/object.go b/vendor/github.com/robertkrimen/otto/object.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/object.go rename to vendor/github.com/robertkrimen/otto/object.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/object_class.go b/vendor/github.com/robertkrimen/otto/object_class.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/object_class.go rename to vendor/github.com/robertkrimen/otto/object_class.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/otto.go b/vendor/github.com/robertkrimen/otto/otto.go similarity index 80% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/otto.go rename to vendor/github.com/robertkrimen/otto/otto.go index 6135330828..b5b528d53b 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/otto.go +++ b/vendor/github.com/robertkrimen/otto/otto.go @@ -132,6 +132,7 @@ The following are some limitations with otto: * "use strict" will parse, but does nothing. * The regular expression engine (re2/regexp) is not fully compatible with the ECMA5 specification. + * Otto targets ES5. ES6 features (eg: Typed Arrays) are not supported. Regular Expression Incompatibility @@ -227,6 +228,7 @@ import ( "fmt" "strings" + "github.com/robertkrimen/otto/file" "github.com/robertkrimen/otto/registry" ) @@ -244,6 +246,7 @@ func New() *Otto { runtime: newContext(), } self.runtime.otto = self + self.runtime.traceLimit = 10 self.Set("console", self.runtime.newConsole()) registry.Apply(func(entry registry.Entry) { @@ -289,7 +292,7 @@ func Run(src interface{}) (*Otto, Value, error) { // src may also be a Program, but if the AST has been modified, then runtime behavior is undefined. // func (self Otto) Run(src interface{}) (Value, error) { - value, err := self.runtime.cmpl_run(src) + value, err := self.runtime.cmpl_run(src, nil) if !value.safe() { value = Value{} } @@ -307,7 +310,7 @@ func (self Otto) Eval(src interface{}) (Value, error) { defer self.runtime.leaveScope() } - value, err := self.runtime.cmpl_eval(src) + value, err := self.runtime.cmpl_eval(src, nil) if !value.safe() { value = Value{} } @@ -367,6 +370,51 @@ func (self Otto) SetRandomSource(fn func() float64) { self.runtime.random = fn } +// SetStackDepthLimit sets an upper limit to the depth of the JavaScript +// stack. In simpler terms, this limits the number of "nested" function calls +// you can make in a particular interpreter instance. +// +// Note that this doesn't take into account the Go stack depth. If your +// JavaScript makes a call to a Go function, otto won't keep track of what +// happens outside the interpreter. So if your Go function is infinitely +// recursive, you're still in trouble. +func (self Otto) SetStackDepthLimit(limit int) { + self.runtime.stackLimit = limit +} + +// SetStackTraceLimit sets an upper limit to the number of stack frames that +// otto will use when formatting an error's stack trace. By default, the limit +// is 10. This is consistent with V8 and SpiderMonkey. +// +// TODO: expose via `Error.stackTraceLimit` +func (self Otto) SetStackTraceLimit(limit int) { + self.runtime.traceLimit = limit +} + +// MakeCustomError creates a new Error object with the given name and message, +// returning it as a Value. +func (self Otto) MakeCustomError(name, message string) Value { + return self.runtime.toValue(self.runtime.newError(name, self.runtime.toValue(message), 0)) +} + +// MakeRangeError creates a new RangeError object with the given message, +// returning it as a Value. +func (self Otto) MakeRangeError(message string) Value { + return self.runtime.toValue(self.runtime.newRangeError(self.runtime.toValue(message))) +} + +// MakeSyntaxError creates a new SyntaxError object with the given message, +// returning it as a Value. +func (self Otto) MakeSyntaxError(message string) Value { + return self.runtime.toValue(self.runtime.newSyntaxError(self.runtime.toValue(message))) +} + +// MakeTypeError creates a new TypeError object with the given message, +// returning it as a Value. +func (self Otto) MakeTypeError(message string) Value { + return self.runtime.toValue(self.runtime.newTypeError(self.runtime.toValue(message))) +} + // Context is a structure that contains information about the current execution // context. type Context struct { @@ -379,8 +427,23 @@ type Context struct { Stacktrace []string } -// Context returns the current execution context of the vm -func (self Otto) Context() (ctx Context) { +// Context returns the current execution context of the vm, traversing up to +// ten stack frames, and skipping any innermost native function stack frames. +func (self Otto) Context() Context { + return self.ContextSkip(10, true) +} + +// ContextLimit returns the current execution context of the vm, with a +// specific limit on the number of stack frames to traverse, skipping any +// innermost native function stack frames. +func (self Otto) ContextLimit(limit int) Context { + return self.ContextSkip(limit, true) +} + +// ContextSkip returns the current execution context of the vm, with a +// specific limit on the number of stack frames to traverse, optionally +// skipping any innermost native function stack frames. +func (self Otto) ContextSkip(limit int, skipNative bool) (ctx Context) { // Ensure we are operating in a scope if self.runtime.scope == nil { self.runtime.enterGlobalScope() @@ -390,25 +453,40 @@ func (self Otto) Context() (ctx Context) { scope := self.runtime.scope frame := scope.frame + for skipNative && frame.native && scope.outer != nil { + scope = scope.outer + frame = scope.frame + } + // Get location information ctx.Filename = "" ctx.Callee = frame.callee - if frame.file != nil { - ctx.Filename = frame.file.Name() - if ctx.Filename == "" { - ctx.Filename = "" + + switch { + case frame.native: + ctx.Filename = frame.nativeFile + ctx.Line = frame.nativeLine + ctx.Column = 0 + case frame.file != nil: + ctx.Filename = "" + + if p := frame.file.Position(file.Idx(frame.offset)); p != nil { + ctx.Line = p.Line + ctx.Column = p.Column + + if p.Filename != "" { + ctx.Filename = p.Filename + } } - ctx.Line, ctx.Column = _position(frame.file, frame.offset) } // Get the current scope this Value ctx.This = toValue_object(scope.this) // Build stacktrace (up to 10 levels deep) - limit := 10 ctx.Symbols = make(map[string]Value) ctx.Stacktrace = append(ctx.Stacktrace, frame.location()) - for limit > 0 { + for limit != 0 { // Get variables stash := scope.lexical for { @@ -473,7 +551,7 @@ func (self Otto) Call(source string, this interface{}, argumentList ...interface }() if !construct && this == nil { - program, err := self.runtime.cmpl_parse("", source+"()") + program, err := self.runtime.cmpl_parse("", source+"()", nil) if err == nil { if node, ok := program.body[0].(*_nodeExpressionStatement); ok { if node, ok := node.expression.(*_nodeCallExpression); ok { @@ -538,7 +616,7 @@ func (self Otto) Call(source string, this interface{}, argumentList ...interface // If there is an error (like the source does not result in an object), then // nil and an error is returned. func (self Otto) Object(source string) (*Object, error) { - value, err := self.runtime.cmpl_run(source) + value, err := self.runtime.cmpl_run(source, nil) if err != nil { return nil, err } @@ -643,9 +721,9 @@ func (self Object) Set(name string, value interface{}) error { } } -// Get the keys for the object +// Keys gets the keys for the given object. // -// Equivalent to calling Object.keys on the object +// Equivalent to calling Object.keys on the object. func (self Object) Keys() []string { var keys []string self.object.enumerate(false, func(name string) bool { @@ -655,6 +733,25 @@ func (self Object) Keys() []string { return keys } +// KeysByParent gets the keys (and those of the parents) for the given object, +// in order of "closest" to "furthest". +func (self Object) KeysByParent() [][]string { + var a [][]string + + for o := self.object; o != nil; o = o.prototype { + var l []string + + o.enumerate(false, func(name string) bool { + l = append(l, name) + return true + }) + + a = append(a, l) + } + + return a +} + // Class will return the class string of the object. // // The return value will (generally) be one of: diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/otto_.go b/vendor/github.com/robertkrimen/otto/otto_.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/otto_.go rename to vendor/github.com/robertkrimen/otto/otto_.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/Makefile b/vendor/github.com/robertkrimen/otto/parser/Makefile similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/Makefile rename to vendor/github.com/robertkrimen/otto/parser/Makefile diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/README.markdown b/vendor/github.com/robertkrimen/otto/parser/README.markdown similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/README.markdown rename to vendor/github.com/robertkrimen/otto/parser/README.markdown diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/dbg.go b/vendor/github.com/robertkrimen/otto/parser/dbg.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/dbg.go rename to vendor/github.com/robertkrimen/otto/parser/dbg.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/error.go b/vendor/github.com/robertkrimen/otto/parser/error.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/error.go rename to vendor/github.com/robertkrimen/otto/parser/error.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/expression.go b/vendor/github.com/robertkrimen/otto/parser/expression.go similarity index 79% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/expression.go rename to vendor/github.com/robertkrimen/otto/parser/expression.go index a23a7279a4..63a169d402 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/expression.go +++ b/vendor/github.com/robertkrimen/otto/parser/expression.go @@ -11,14 +11,19 @@ import ( func (self *_parser) parseIdentifier() *ast.Identifier { literal := self.literal idx := self.idx + if self.mode&StoreComments != 0 { + self.comments.MarkComments(ast.LEADING) + } self.next() - comments := self.findComments(false) exp := &ast.Identifier{ Name: literal, Idx: idx, } - self.commentMap.AddComments(exp, comments, ast.TRAILING) + if self.mode&StoreComments != 0 { + self.comments.SetExpression(exp) + } + return exp } @@ -94,6 +99,9 @@ func (self *_parser) parsePrimaryExpression() ast.Expression { case token.LEFT_PARENTHESIS: self.expect(token.LEFT_PARENTHESIS) expression := self.parseExpression() + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.expect(token.RIGHT_PARENTHESIS) return expression case token.THIS: @@ -181,12 +189,18 @@ func (self *_parser) parseVariableDeclaration(declarationList *[]*ast.VariableEx Name: literal, Idx: idx, } + if self.mode&StoreComments != 0 { + self.comments.SetExpression(node) + } if declarationList != nil { *declarationList = append(*declarationList, node) } if self.token == token.ASSIGN { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() node.Initializer = self.parseAssignmentExpression() } @@ -200,20 +214,18 @@ func (self *_parser) parseVariableDeclarationList(var_ file.Idx) []ast.Expressio var list []ast.Expression for { - comments := self.findComments(false) - - decl := self.parseVariableDeclaration(&declarationList) if self.mode&StoreComments != 0 { - self.commentMap.AddComments(decl, comments, ast.LEADING) - self.commentMap.AddComments(decl, self.findComments(false), ast.TRAILING) + self.comments.MarkComments(ast.LEADING) } - + decl := self.parseVariableDeclaration(&declarationList) list = append(list, decl) if self.token != token.COMMA { break } + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - } self.scope.declare(&ast.VariableDeclaration{ @@ -224,13 +236,14 @@ func (self *_parser) parseVariableDeclarationList(var_ file.Idx) []ast.Expressio return list } -func (self *_parser) parseObjectPropertyKey() (string, string, []*ast.Comment) { +func (self *_parser) parseObjectPropertyKey() (string, string) { idx, tkn, literal := self.idx, self.token, self.literal value := "" + if self.mode&StoreComments != 0 { + self.comments.MarkComments(ast.KEY) + } self.next() - comments := self.findComments(false) - switch tkn { case token.IDENTIFIER: value = literal @@ -254,14 +267,14 @@ func (self *_parser) parseObjectPropertyKey() (string, string, []*ast.Comment) { value = literal } } - return literal, value, comments + return literal, value } func (self *_parser) parseObjectProperty() ast.Property { - literal, value, comments := self.parseObjectPropertyKey() + literal, value := self.parseObjectPropertyKey() if literal == "get" && self.token != token.COLON { idx := self.idx - _, value, _ := self.parseObjectPropertyKey() + _, value := self.parseObjectPropertyKey() parameterList := self.parseFunctionParameterList() node := &ast.FunctionLiteral{ @@ -276,7 +289,7 @@ func (self *_parser) parseObjectProperty() ast.Property { } } else if literal == "set" && self.token != token.COLON { idx := self.idx - _, value, _ := self.parseObjectPropertyKey() + _, value := self.parseObjectPropertyKey() parameterList := self.parseFunctionParameterList() node := &ast.FunctionLiteral{ @@ -291,8 +304,10 @@ func (self *_parser) parseObjectProperty() ast.Property { } } + if self.mode&StoreComments != 0 { + self.comments.MarkComments(ast.COLON) + } self.expect(token.COLON) - comments2 := self.findComments(false) exp := ast.Property{ Key: value, @@ -301,8 +316,7 @@ func (self *_parser) parseObjectProperty() ast.Property { } if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp.Value, comments, ast.KEY) - self.commentMap.AddComments(exp.Value, comments2, ast.COLON) + self.comments.SetExpression(exp.Value) } return exp } @@ -310,116 +324,91 @@ func (self *_parser) parseObjectProperty() ast.Property { func (self *_parser) parseObjectLiteral() ast.Expression { var value []ast.Property idx0 := self.expect(token.LEFT_BRACE) - - var comments2 []*ast.Comment for self.token != token.RIGHT_BRACE && self.token != token.EOF { - - // Leading comments for object literal - comments := self.findComments(false) - property := self.parseObjectProperty() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(property.Value, comments, ast.LEADING) - self.commentMap.AddComments(property.Value, comments2, ast.LEADING) - } - value = append(value, property) + value = append(value, self.parseObjectProperty()) if self.token == token.COMMA { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - - // Find leading comments after trailing comma - comments2 = self.findComments(false) continue } } + if self.mode&StoreComments != 0 { + self.comments.MarkComments(ast.FINAL) + } idx1 := self.expect(token.RIGHT_BRACE) - exp := &ast.ObjectLiteral{ + return &ast.ObjectLiteral{ LeftBrace: idx0, RightBrace: idx1, Value: value, } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp, comments2, ast.FINAL) - } - self.consumeComments(exp, ast.FINAL) - - return exp } func (self *_parser) parseArrayLiteral() ast.Expression { idx0 := self.expect(token.LEFT_BRACKET) - var comments2 []*ast.Comment - var comments []*ast.Comment var value []ast.Expression for self.token != token.RIGHT_BRACKET && self.token != token.EOF { - // Find leading comments for both empty and non-empty expressions - comments = self.findComments(false) - if self.token == token.COMMA { - self.next() - // This kind of comment requires a special empty expression node. empty := &ast.EmptyExpression{self.idx, self.idx} if self.mode&StoreComments != 0 { - self.commentMap.AddComments(empty, comments, ast.LEADING) - self.commentMap.AddComments(empty, comments2, ast.LEADING) + self.comments.SetExpression(empty) + self.comments.Unset() } - value = append(value, empty) - - // This comment belongs to the following expression, or trailing - comments2 = self.findComments(false) - + self.next() continue } exp := self.parseAssignmentExpression() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp, comments, ast.LEADING) - self.commentMap.AddComments(exp, comments2, ast.LEADING) - } value = append(value, exp) if self.token != token.RIGHT_BRACKET { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.expect(token.COMMA) } - - // This comment belongs to the following expression, or trailing - comments2 = self.findComments(false) + } + if self.mode&StoreComments != 0 { + self.comments.MarkComments(ast.FINAL) } idx1 := self.expect(token.RIGHT_BRACKET) - array := &ast.ArrayLiteral{ + return &ast.ArrayLiteral{ LeftBracket: idx0, RightBracket: idx1, Value: value, } - - // This is where comments after a possible trailing comma are added - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(array, comments2, ast.FINAL) - } - - return array } func (self *_parser) parseArgumentList() (argumentList []ast.Expression, idx0, idx1 file.Idx) { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } idx0 = self.expect(token.LEFT_PARENTHESIS) if self.token != token.RIGHT_PARENTHESIS { for { - comments := self.findComments(false) exp := self.parseAssignmentExpression() if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp, comments, ast.LEADING) + self.comments.SetExpression(exp) } argumentList = append(argumentList, exp) if self.token != token.COMMA { break } + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() } } + if self.mode&StoreComments != 0 { + self.comments.Unset() + } idx1 = self.expect(token.RIGHT_PARENTHESIS) return } @@ -434,7 +423,7 @@ func (self *_parser) parseCallExpression(left ast.Expression) ast.Expression { } if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp, self.findComments(false), ast.TRAILING) + self.comments.SetExpression(exp) } return exp } @@ -455,7 +444,7 @@ func (self *_parser) parseDotMember(left ast.Expression) ast.Expression { return &ast.DotExpression{ Left: left, - Identifier: ast.Identifier{ + Identifier: &ast.Identifier{ Idx: idx, Name: literal, }, @@ -489,7 +478,7 @@ func (self *_parser) parseNewExpression() ast.Expression { } if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, self.findComments(false), ast.TRAILING) + self.comments.SetExpression(node) } return node @@ -501,11 +490,15 @@ func (self *_parser) parseLeftHandSideExpression() ast.Expression { if self.token == token.NEW { left = self.parseNewExpression() } else { + if self.mode&StoreComments != 0 { + self.comments.MarkComments(ast.LEADING) + self.comments.MarkPrimary() + } left = self.parsePrimaryExpression() } if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left, self.findComments(false), ast.TRAILING) + self.comments.SetExpression(left) } for { @@ -531,13 +524,26 @@ func (self *_parser) parseLeftHandSideExpressionAllowCall() ast.Expression { var left ast.Expression if self.token == token.NEW { + var newComments []*ast.Comment + if self.mode&StoreComments != 0 { + newComments = self.comments.FetchAll() + self.comments.MarkComments(ast.LEADING) + self.comments.MarkPrimary() + } left = self.parseNewExpression() + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(left, newComments, ast.LEADING) + } } else { + if self.mode&StoreComments != 0 { + self.comments.MarkComments(ast.LEADING) + self.comments.MarkPrimary() + } left = self.parsePrimaryExpression() } if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left, self.findComments(false), ast.TRAILING) + self.comments.SetExpression(left) } for { @@ -566,6 +572,9 @@ func (self *_parser) parsePostfixExpression() ast.Expression { } tkn := self.token idx := self.idx + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() switch operand.(type) { case *ast.Identifier, *ast.DotExpression, *ast.BracketExpression: @@ -582,7 +591,7 @@ func (self *_parser) parsePostfixExpression() ast.Expression { } if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp, self.findComments(false), ast.TRAILING) + self.comments.SetExpression(exp) } return exp @@ -599,31 +608,24 @@ func (self *_parser) parseUnaryExpression() ast.Expression { case token.DELETE, token.VOID, token.TYPEOF: tkn := self.token idx := self.idx + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - comments := self.findComments(false) - - exp := &ast.UnaryExpression{ + return &ast.UnaryExpression{ Operator: tkn, Idx: idx, Operand: self.parseUnaryExpression(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp.Operand, comments, ast.LEADING) - } - return exp case token.INCREMENT, token.DECREMENT: tkn := self.token idx := self.idx - self.next() - - comments := self.findComments(false) - - operand := self.parseUnaryExpression() if self.mode&StoreComments != 0 { - self.commentMap.AddComments(operand, comments, ast.LEADING) + self.comments.Unset() } + self.next() + operand := self.parseUnaryExpression() switch operand.(type) { case *ast.Identifier, *ast.DotExpression, *ast.BracketExpression: default: @@ -648,19 +650,16 @@ func (self *_parser) parseMultiplicativeExpression() ast.Expression { for self.token == token.MULTIPLY || self.token == token.SLASH || self.token == token.REMAINDER { tkn := self.token + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -672,19 +671,16 @@ func (self *_parser) parseAdditiveExpression() ast.Expression { for self.token == token.PLUS || self.token == token.MINUS { tkn := self.token + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -697,19 +693,16 @@ func (self *_parser) parseShiftExpression() ast.Expression { for self.token == token.SHIFT_LEFT || self.token == token.SHIFT_RIGHT || self.token == token.UNSIGNED_SHIFT_RIGHT { tkn := self.token + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -728,55 +721,46 @@ func (self *_parser) parseRelationalExpression() ast.Expression { switch self.token { case token.LESS, token.LESS_OR_EQUAL, token.GREATER, token.GREATER_OR_EQUAL: tkn := self.token + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - comments := self.findComments(false) - exp := &ast.BinaryExpression{ Operator: tkn, Left: left, Right: self.parseRelationalExpression(), Comparison: true, } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp.Right, comments, ast.LEADING) - } return exp case token.INSTANCEOF: tkn := self.token + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - comments := self.findComments(false) - exp := &ast.BinaryExpression{ Operator: tkn, Left: left, Right: self.parseRelationalExpression(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp.Right, comments, ast.LEADING) - } return exp case token.IN: if !allowIn { return left } tkn := self.token + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - comments := self.findComments(false) - exp := &ast.BinaryExpression{ Operator: tkn, Left: left, Right: self.parseRelationalExpression(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp.Right, comments, ast.LEADING) - } return exp } @@ -790,20 +774,17 @@ func (self *_parser) parseEqualityExpression() ast.Expression { for self.token == token.EQUAL || self.token == token.NOT_EQUAL || self.token == token.STRICT_EQUAL || self.token == token.STRICT_NOT_EQUAL { tkn := self.token + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), Comparison: true, } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -814,20 +795,17 @@ func (self *_parser) parseBitwiseAndExpression() ast.Expression { left := next() for self.token == token.AND { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } tkn := self.token self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -838,20 +816,17 @@ func (self *_parser) parseBitwiseExclusiveOrExpression() ast.Expression { left := next() for self.token == token.EXCLUSIVE_OR { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } tkn := self.token self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -862,20 +837,17 @@ func (self *_parser) parseBitwiseOrExpression() ast.Expression { left := next() for self.token == token.OR { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } tkn := self.token self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -886,20 +858,17 @@ func (self *_parser) parseLogicalAndExpression() ast.Expression { left := next() for self.token == token.LOGICAL_AND { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } tkn := self.token self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -910,20 +879,17 @@ func (self *_parser) parseLogicalOrExpression() ast.Expression { left := next() for self.token == token.LOGICAL_OR { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } tkn := self.token self.next() - comments := self.findComments(false) - left = &ast.BinaryExpression{ Operator: tkn, Left: left, Right: next(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left.(*ast.BinaryExpression).Right, comments, ast.LEADING) - } } return left @@ -933,29 +899,22 @@ func (self *_parser) parseConditionlExpression() ast.Expression { left := self.parseLogicalOrExpression() if self.token == token.QUESTION_MARK { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - // Comments before the consequence - comments1 := self.findComments(false) - consequent := self.parseAssignmentExpression() if self.mode&StoreComments != 0 { - self.commentMap.AddComments(consequent, comments1, ast.LEADING) + self.comments.Unset() } - self.expect(token.COLON) - - // Comments before the alternate - comments2 := self.findComments(false) exp := &ast.ConditionalExpression{ Test: left, Consequent: consequent, Alternate: self.parseAssignmentExpression(), } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp.Alternate, comments2, ast.LEADING) - } return exp } @@ -996,6 +955,9 @@ func (self *_parser) parseAssignmentExpression() ast.Expression { if operator != 0 { idx := self.idx + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() switch left.(type) { case *ast.Identifier, *ast.DotExpression, *ast.BracketExpression: @@ -1005,8 +967,6 @@ func (self *_parser) parseAssignmentExpression() ast.Expression { return &ast.BadExpression{From: idx, To: self.idx} } - comments := self.findComments(false) - exp := &ast.AssignExpression{ Left: left, Operator: operator, @@ -1014,7 +974,7 @@ func (self *_parser) parseAssignmentExpression() ast.Expression { } if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp.Right, comments, ast.LEADING) + self.comments.SetExpression(exp) } return exp @@ -1024,10 +984,6 @@ func (self *_parser) parseAssignmentExpression() ast.Expression { } func (self *_parser) parseExpression() ast.Expression { - - comments := self.findComments(false) - statementComments := self.fetchComments() - next := self.parseAssignmentExpression left := next() @@ -1045,10 +1001,5 @@ func (self *_parser) parseExpression() ast.Expression { } } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left, comments, ast.LEADING) - self.commentMap.AddComments(left, statementComments, ast.LEADING) - } - return left } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/lexer.go b/vendor/github.com/robertkrimen/otto/parser/lexer.go similarity index 98% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/lexer.go rename to vendor/github.com/robertkrimen/otto/parser/lexer.go index a510c76d22..d9d69e124c 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/lexer.go +++ b/vendor/github.com/robertkrimen/otto/parser/lexer.go @@ -10,6 +10,7 @@ import ( "unicode" "unicode/utf8" + "github.com/robertkrimen/otto/ast" "github.com/robertkrimen/otto/file" "github.com/robertkrimen/otto/token" ) @@ -120,7 +121,6 @@ func isLineTerminator(chr rune) bool { func (self *_parser) scan() (tkn token.Token, literal string, idx file.Idx) { self.implicitSemicolon = false - self.skippedLineBreak = false for { self.skipWhiteSpace() @@ -196,6 +196,7 @@ func (self *_parser) scan() (tkn token.Token, literal string, idx file.Idx) { case '\r', '\n', '\u2028', '\u2029': self.insertSemicolon = false self.implicitSemicolon = true + self.comments.AtLineBreak() continue case ':': tkn = token.COLON @@ -240,18 +241,17 @@ func (self *_parser) scan() (tkn token.Token, literal string, idx file.Idx) { case '/': if self.chr == '/' { if self.mode&StoreComments != 0 { - runes := self.readSingleLineComment() - literal = string(runes) - tkn = token.COMMENT - return + literal := string(self.readSingleLineComment()) + self.comments.AddComment(ast.NewComment(literal, self.idx)) + continue } self.skipSingleLineComment() continue } else if self.chr == '*' { if self.mode&StoreComments != 0 { literal = string(self.readMultiLineComment()) - tkn = token.COMMENT - return + self.comments.AddComment(ast.NewComment(literal, self.idx)) + continue } self.skipMultiLineComment() continue @@ -487,7 +487,7 @@ func (self *_parser) skipWhiteSpace() { continue case '\r': if self._peek() == '\n' { - self.skippedLineBreak = true + self.comments.AtLineBreak() self.read() } fallthrough @@ -495,7 +495,7 @@ func (self *_parser) skipWhiteSpace() { if self.insertSemicolon { return } - self.skippedLineBreak = true + self.comments.AtLineBreak() self.read() continue } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/parser.go b/vendor/github.com/robertkrimen/otto/parser/parser.go similarity index 68% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/parser.go rename to vendor/github.com/robertkrimen/otto/parser/parser.go index 18328edd6c..75b7c500c4 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/parser.go +++ b/vendor/github.com/robertkrimen/otto/parser/parser.go @@ -35,6 +35,7 @@ package parser import ( "bytes" + "encoding/base64" "errors" "io" "io/ioutil" @@ -42,6 +43,7 @@ import ( "github.com/robertkrimen/otto/ast" "github.com/robertkrimen/otto/file" "github.com/robertkrimen/otto/token" + "gopkg.in/sourcemap.v1" ) // A Mode value is a set of flags (or 0). They control optional parser functionality. @@ -81,26 +83,27 @@ type _parser struct { file *file.File - comments []*ast.Comment - commentMap *ast.CommentMap - skippedLineBreak bool + comments *ast.Comments } -func _newParser(filename, src string, base int) *_parser { +type Parser interface { + Scan() (tkn token.Token, literal string, idx file.Idx) +} + +func _newParser(filename, src string, base int, sm *sourcemap.Consumer) *_parser { return &_parser{ - chr: ' ', // This is set so we can start scanning by skipping whitespace - str: src, - length: len(src), - base: base, - file: file.NewFile(filename, src, base), - comments: make([]*ast.Comment, 0), - commentMap: &ast.CommentMap{}, - skippedLineBreak: false, + chr: ' ', // This is set so we can start scanning by skipping whitespace + str: src, + length: len(src), + base: base, + file: file.NewFile(filename, src, base).WithSourceMap(sm), + comments: ast.NewComments(), } } -func newParser(filename, src string) *_parser { - return _newParser(filename, src, 1) +// Returns a new Parser. +func NewParser(filename, src string) Parser { + return _newParser(filename, src, 1, nil) } func ReadSource(filename string, src interface{}) ([]byte, error) { @@ -126,6 +129,70 @@ func ReadSource(filename string, src interface{}) ([]byte, error) { return ioutil.ReadFile(filename) } +func ReadSourceMap(filename string, src interface{}) (*sourcemap.Consumer, error) { + if src == nil { + return nil, nil + } + + switch src := src.(type) { + case string: + return sourcemap.Parse(filename, []byte(src)) + case []byte: + return sourcemap.Parse(filename, src) + case *bytes.Buffer: + if src != nil { + return sourcemap.Parse(filename, src.Bytes()) + } + case io.Reader: + var bfr bytes.Buffer + if _, err := io.Copy(&bfr, src); err != nil { + return nil, err + } + return sourcemap.Parse(filename, bfr.Bytes()) + case *sourcemap.Consumer: + return src, nil + } + + return nil, errors.New("invalid sourcemap type") +} + +func ParseFileWithSourceMap(fileSet *file.FileSet, filename string, javascriptSource, sourcemapSource interface{}, mode Mode) (*ast.Program, error) { + src, err := ReadSource(filename, javascriptSource) + if err != nil { + return nil, err + } + + if sourcemapSource == nil { + lines := bytes.Split(src, []byte("\n")) + lastLine := lines[len(lines)-1] + if bytes.HasPrefix(lastLine, []byte("//# sourceMappingURL=data:application/json")) { + bits := bytes.SplitN(lastLine, []byte(","), 2) + if len(bits) == 2 { + if d, err := base64.StdEncoding.DecodeString(string(bits[1])); err == nil { + sourcemapSource = d + } + } + } + } + + sm, err := ReadSourceMap(filename, sourcemapSource) + if err != nil { + return nil, err + } + + base := 1 + if fileSet != nil { + base = fileSet.AddFile(filename, string(src)) + } + + parser := _newParser(filename, string(src), base, sm) + parser.mode = mode + program, err := parser.parse() + program.Comments = parser.comments.CommentMap + + return program, err +} + // ParseFile parses the source code of a single JavaScript/ECMAScript source file and returns // the corresponding ast.Program node. // @@ -140,22 +207,7 @@ func ReadSource(filename string, src interface{}) ([]byte, error) { // program, err := parser.ParseFile(nil, "", `if (abc > 1) {}`, 0) // func ParseFile(fileSet *file.FileSet, filename string, src interface{}, mode Mode) (*ast.Program, error) { - str, err := ReadSource(filename, src) - if err != nil { - return nil, err - } - { - str := string(str) - - base := 1 - if fileSet != nil { - base = fileSet.AddFile(filename, str) - } - - parser := _newParser(filename, str, base) - parser.mode = mode - return parser.parse() - } + return ParseFileWithSourceMap(fileSet, filename, src, nil, mode) } // ParseFunction parses a given parameter list and body as a function and returns the @@ -167,7 +219,7 @@ func ParseFunction(parameterList, body string) (*ast.FunctionLiteral, error) { src := "(function(" + parameterList + ") {\n" + body + "\n})" - parser := _newParser("", src, 1) + parser := _newParser("", src, 1, nil) program, err := parser.parse() if err != nil { return nil, err @@ -176,6 +228,13 @@ func ParseFunction(parameterList, body string) (*ast.FunctionLiteral, error) { return program.Body[0].(*ast.ExpressionStatement).Expression.(*ast.FunctionLiteral), nil } +// Scan reads a single token from the source at the current offset, increments the offset and +// returns the token.Token token, a string literal representing the value of the token (if applicable) +// and it's current file.Idx index. +func (self *_parser) Scan() (tkn token.Token, literal string, idx file.Idx) { + return self.scan() +} + func (self *_parser) slice(idx0, idx1 file.Idx) string { from := int(idx0) - self.base to := int(idx1) - self.base @@ -193,7 +252,9 @@ func (self *_parser) parse() (*ast.Program, error) { self.errors.Sort() } - self.addCommentStatements(program, ast.FINAL) + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(program, self.comments.FetchAll(), ast.TRAILING) + } return program, self.errors.Err() } @@ -281,63 +342,3 @@ func (self *_parser) position(idx file.Idx) file.Position { return position } - -// findComments finds the following comments. -// Comments on the same line will be grouped together and returned. -// After the first line break, comments will be added as statement comments. -func (self *_parser) findComments(ignoreLineBreak bool) []*ast.Comment { - if self.mode&StoreComments == 0 { - return nil - } - comments := make([]*ast.Comment, 0) - - newline := false - - for self.implicitSemicolon == false || ignoreLineBreak { - if self.token != token.COMMENT { - break - } - - comment := &ast.Comment{ - Begin: self.idx, - Text: self.literal, - Position: ast.TBD, - } - - newline = self.skippedLineBreak || newline - - if newline && !ignoreLineBreak { - self.comments = append(self.comments, comment) - } else { - comments = append(comments, comment) - } - - self.next() - } - - return comments -} - -// addCommentStatements will add the previously parsed, not positioned comments to the provided node -func (self *_parser) addCommentStatements(node ast.Node, position ast.CommentPosition) { - if len(self.comments) > 0 { - self.commentMap.AddComments(node, self.comments, position) - - // Reset comments - self.comments = make([]*ast.Comment, 0) - } -} - -// fetchComments fetches the current comments, resets the slice and returns the comments -func (self *_parser) fetchComments() (comments []*ast.Comment) { - comments = self.comments - self.comments = nil - - return comments -} - -// consumeComments consumes the current comments and appends them to the provided node -func (self *_parser) consumeComments(node ast.Node, position ast.CommentPosition) { - self.commentMap.AddComments(node, self.comments, position) - self.comments = nil -} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/regexp.go b/vendor/github.com/robertkrimen/otto/parser/regexp.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/regexp.go rename to vendor/github.com/robertkrimen/otto/parser/regexp.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/scope.go b/vendor/github.com/robertkrimen/otto/parser/scope.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/scope.go rename to vendor/github.com/robertkrimen/otto/parser/scope.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/statement.go b/vendor/github.com/robertkrimen/otto/parser/statement.go similarity index 72% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/parser/statement.go rename to vendor/github.com/robertkrimen/otto/parser/statement.go index 987ac02c1f..6ff19d9753 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser/statement.go +++ b/vendor/github.com/robertkrimen/otto/parser/statement.go @@ -10,19 +10,25 @@ func (self *_parser) parseBlockStatement() *ast.BlockStatement { // Find comments before the leading brace if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, self.findComments(false), ast.LEADING) + self.comments.CommentMap.AddComments(node, self.comments.FetchAll(), ast.LEADING) + self.comments.Unset() } node.LeftBrace = self.expect(token.LEFT_BRACE) node.List = self.parseStatementList() - self.consumeComments(node, ast.FINAL) + if self.mode&StoreComments != 0 { + self.comments.Unset() + self.comments.CommentMap.AddComments(node, self.comments.FetchAll(), ast.FINAL) + self.comments.AfterBlock() + } node.RightBrace = self.expect(token.RIGHT_BRACE) // Find comments after the trailing brace if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, self.findComments(false), ast.TRAILING) + self.comments.ResetLineBreak() + self.comments.CommentMap.AddComments(node, self.comments.Fetch(), ast.TRAILING) } return node @@ -35,14 +41,8 @@ func (self *_parser) parseEmptyStatement() ast.Statement { func (self *_parser) parseStatementList() (list []ast.Statement) { for self.token != token.RIGHT_BRACE && self.token != token.EOF { - if self.token == token.COMMENT { - self.parseCommentElement() - continue - } statement := self.parseStatement() list = append(list, statement) - - self.addCommentStatements(statement, ast.LEADING) } return @@ -55,6 +55,10 @@ func (self *_parser) parseStatement() ast.Statement { return &ast.BadStatement{From: self.idx, To: self.idx + 1} } + if self.mode&StoreComments != 0 { + self.comments.ResetLineBreak() + } + switch self.token { case token.SEMICOLON: return self.parseEmptyStatement() @@ -63,7 +67,9 @@ func (self *_parser) parseStatement() ast.Statement { case token.IF: return self.parseIfStatement() case token.DO: - return self.parseDoWhileStatement() + statement := self.parseDoWhileStatement() + self.comments.PostProcessNode(statement) + return statement case token.WHILE: return self.parseWhileStatement() case token.FOR: @@ -79,9 +85,7 @@ func (self *_parser) parseStatement() ast.Statement { case token.VAR: return self.parseVariableStatement() case token.FUNCTION: - self.parseFunction(true) - // FIXME - return &ast.EmptyStatement{} + return self.parseFunctionStatement() case token.SWITCH: return self.parseSwitchStatement() case token.RETURN: @@ -92,21 +96,31 @@ func (self *_parser) parseStatement() ast.Statement { return self.parseTryStatement() } + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } + expression := self.parseExpression() if identifier, isIdentifier := expression.(*ast.Identifier); isIdentifier && self.token == token.COLON { // LabelledStatement colon := self.idx + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() // : - comments := self.findComments(false) - label := identifier.Name for _, value := range self.scope.labels { if label == value { self.error(identifier.Idx0(), "Label '%s' already exists", label) } } + var labelComments []*ast.Comment + if self.mode&StoreComments != 0 { + labelComments = self.comments.FetchAll() + } self.scope.labels = append(self.scope.labels, label) // Push the label statement := self.parseStatement() self.scope.labels = self.scope.labels[:len(self.scope.labels)-1] // Pop the label @@ -115,9 +129,8 @@ func (self *_parser) parseStatement() ast.Statement { Colon: colon, Statement: statement, } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(exp, comments, ast.TRAILING) + self.comments.CommentMap.AddComments(exp, labelComments, ast.LEADING) } return exp @@ -125,60 +138,69 @@ func (self *_parser) parseStatement() ast.Statement { self.optionalSemicolon() - return &ast.ExpressionStatement{ + statement := &ast.ExpressionStatement{ Expression: expression, } + + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(statement, comments, ast.LEADING) + } + return statement } func (self *_parser) parseTryStatement() ast.Statement { - + var tryComments []*ast.Comment + if self.mode&StoreComments != 0 { + tryComments = self.comments.FetchAll() + } node := &ast.TryStatement{ Try: self.expect(token.TRY), Body: self.parseBlockStatement(), } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Body, self.findComments(true), ast.TRAILING) + self.comments.CommentMap.AddComments(node, tryComments, ast.LEADING) + self.comments.CommentMap.AddComments(node.Body, self.comments.FetchAll(), ast.TRAILING) } if self.token == token.CATCH { catch := self.idx + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() self.expect(token.LEFT_PARENTHESIS) - comments := self.findComments(true) if self.token != token.IDENTIFIER { self.expect(token.IDENTIFIER) self.nextStatement() return &ast.BadStatement{From: catch, To: self.idx} } else { identifier := self.parseIdentifier() - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(identifier, comments, ast.LEADING) - } - self.expect(token.RIGHT_PARENTHESIS) node.Catch = &ast.CatchStatement{ Catch: catch, Parameter: identifier, Body: self.parseBlockStatement(), } - } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Catch, self.findComments(true), ast.TRAILING) + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(node.Catch.Body, self.comments.FetchAll(), ast.TRAILING) + } } } if self.token == token.FINALLY { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() - - comments := self.findComments(true) + if self.mode&StoreComments != 0 { + tryComments = self.comments.FetchAll() + } node.Finally = self.parseBlockStatement() if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Finally, comments, ast.LEADING) + self.comments.CommentMap.AddComments(node.Finally, tryComments, ast.LEADING) } } @@ -192,19 +214,21 @@ func (self *_parser) parseTryStatement() ast.Statement { func (self *_parser) parseFunctionParameterList() *ast.ParameterList { opening := self.expect(token.LEFT_PARENTHESIS) + if self.mode&StoreComments != 0 { + self.comments.Unset() + } var list []*ast.Identifier for self.token != token.RIGHT_PARENTHESIS && self.token != token.EOF { - comments := self.findComments(true) if self.token != token.IDENTIFIER { self.expect(token.IDENTIFIER) } else { identifier := self.parseIdentifier() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(identifier, comments, ast.LEADING) - } list = append(list, identifier) } if self.token != token.RIGHT_PARENTHESIS { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.expect(token.COMMA) } } @@ -231,6 +255,21 @@ func (self *_parser) parseParameterList() (list []string) { return } +func (self *_parser) parseFunctionStatement() *ast.FunctionStatement { + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } + function := &ast.FunctionStatement{ + Function: self.parseFunction(true), + } + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(function, comments, ast.LEADING) + } + + return function +} + func (self *_parser) parseFunction(declaration bool) *ast.FunctionLiteral { node := &ast.FunctionLiteral{ @@ -249,6 +288,9 @@ func (self *_parser) parseFunction(declaration bool) *ast.FunctionLiteral { // Use expect error handling self.expect(token.IDENTIFIER) } + if self.mode&StoreComments != 0 { + self.comments.Unset() + } node.Name = name node.ParameterList = self.parseFunctionParameterList() self.parseFunctionBlock(node) @@ -274,29 +316,23 @@ func (self *_parser) parseFunctionBlock(node *ast.FunctionLiteral) { func (self *_parser) parseDebuggerStatement() ast.Statement { idx := self.expect(token.DEBUGGER) - comments := self.findComments(true) - node := &ast.DebuggerStatement{ Debugger: idx, } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, comments, ast.TRAILING) + self.comments.CommentMap.AddComments(node, self.comments.FetchAll(), ast.TRAILING) } self.semicolon() - - if !self.skippedLineBreak { - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, self.findComments(false), ast.TRAILING) - } - } - return node } func (self *_parser) parseReturnStatement() ast.Statement { idx := self.expect(token.RETURN) + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } if !self.scope.inFunction { self.error(idx, "Illegal return statement") @@ -311,6 +347,9 @@ func (self *_parser) parseReturnStatement() ast.Statement { if !self.implicitSemicolon && self.token != token.SEMICOLON && self.token != token.RIGHT_BRACE && self.token != token.EOF { node.Argument = self.parseExpression() } + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(node, comments, ast.LEADING) + } self.semicolon() @@ -318,6 +357,10 @@ func (self *_parser) parseReturnStatement() ast.Statement { } func (self *_parser) parseThrowStatement() ast.Statement { + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } idx := self.expect(token.THROW) if self.implicitSemicolon { @@ -333,6 +376,9 @@ func (self *_parser) parseThrowStatement() ast.Statement { node := &ast.ThrowStatement{ Argument: self.parseExpression(), } + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(node, comments, ast.LEADING) + } self.semicolon() @@ -340,13 +386,23 @@ func (self *_parser) parseThrowStatement() ast.Statement { } func (self *_parser) parseSwitchStatement() ast.Statement { + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } self.expect(token.SWITCH) + if self.mode&StoreComments != 0 { + comments = append(comments, self.comments.FetchAll()...) + } self.expect(token.LEFT_PARENTHESIS) node := &ast.SwitchStatement{ Discriminant: self.parseExpression(), Default: -1, } self.expect(token.RIGHT_PARENTHESIS) + if self.mode&StoreComments != 0 { + comments = append(comments, self.comments.FetchAll()...) + } self.expect(token.LEFT_BRACE) @@ -372,14 +428,23 @@ func (self *_parser) parseSwitchStatement() ast.Statement { node.Body = append(node.Body, clause) } + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(node, comments, ast.LEADING) + } + return node } func (self *_parser) parseWithStatement() ast.Statement { + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } self.expect(token.WITH) - - // Find the comments after with - comments := self.findComments(true) + var withComments []*ast.Comment + if self.mode&StoreComments != 0 { + withComments = self.comments.FetchAll() + } self.expect(token.LEFT_PARENTHESIS) @@ -388,65 +453,39 @@ func (self *_parser) parseWithStatement() ast.Statement { } self.expect(token.RIGHT_PARENTHESIS) - // Add the key comments if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, comments, ast.KEY) + //comments = append(comments, self.comments.FetchAll()...) + self.comments.CommentMap.AddComments(node, comments, ast.LEADING) + self.comments.CommentMap.AddComments(node, withComments, ast.WITH) } - // Find the leading comments for the body - comments = self.findComments(true) - node.Body = self.parseStatement() - // Add the body comments - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Body, comments, ast.LEADING) - } - - // Move the trailing comments to the with statement - self.commentMap.MoveComments(node.Body, node, ast.TRAILING) - return node } func (self *_parser) parseCaseStatement() *ast.CaseStatement { - - var comments []*ast.Comment - node := &ast.CaseStatement{ Case: self.idx, } + var comments []*ast.Comment if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, self.findComments(true), ast.LEADING) + comments = self.comments.FetchAll() + self.comments.Unset() } - // Consume current comments - self.consumeComments(node, ast.LEADING) - if self.token == token.DEFAULT { self.next() } else { self.expect(token.CASE) - - comments = self.findComments(true) - node.Test = self.parseExpression() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Test, comments, ast.LEADING) - } - - comments = self.findComments(true) - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Test, comments, ast.TRAILING) - } } - self.expect(token.COLON) - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Test, self.findComments(false), ast.TRAILING) + self.comments.Unset() } + self.expect(token.COLON) for { if self.token == token.EOF || @@ -457,10 +496,11 @@ func (self *_parser) parseCaseStatement() *ast.CaseStatement { } consequent := self.parseStatement() node.Consequent = append(node.Consequent, consequent) + } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(consequent, self.findComments(false), ast.TRAILING) - } + // Link the comments to the case statement + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(node, comments, ast.LEADING) } return node @@ -479,21 +519,9 @@ func (self *_parser) parseForIn(into ast.Expression) *ast.ForInStatement { // Already have consumed " in" - // Comments after the in, before the expression - comments := self.findComments(true) - source := self.parseExpression() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(source, comments, ast.LEADING) - } - self.expect(token.RIGHT_PARENTHESIS) - - comments = self.findComments(true) body := self.parseIterationStatement() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(body, comments, ast.LEADING) - } forin := &ast.ForInStatement{ Into: into, @@ -501,8 +529,6 @@ func (self *_parser) parseForIn(into ast.Expression) *ast.ForInStatement { Body: body, } - self.commentMap.MoveComments(body, forin, ast.TRAILING) - return forin } @@ -510,34 +536,21 @@ func (self *_parser) parseFor(initializer ast.Expression) *ast.ForStatement { // Already have consumed " ;" - comments := self.findComments(true) - var test, update ast.Expression if self.token != token.SEMICOLON { test = self.parseExpression() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(test, comments, ast.LEADING) - } + } + if self.mode&StoreComments != 0 { + self.comments.Unset() } self.expect(token.SEMICOLON) - comments = self.findComments(true) - if self.token != token.RIGHT_PARENTHESIS { update = self.parseExpression() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(update, comments, ast.LEADING) - } } self.expect(token.RIGHT_PARENTHESIS) - - comments = self.findComments(true) - body := self.parseIterationStatement() - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(body, comments, ast.LEADING) - } forstatement := &ast.ForStatement{ Initializer: initializer, @@ -546,17 +559,21 @@ func (self *_parser) parseFor(initializer ast.Expression) *ast.ForStatement { Body: body, } - self.commentMap.MoveComments(body, forstatement, ast.TRAILING) - return forstatement } func (self *_parser) parseForOrForInStatement() ast.Statement { + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } idx := self.expect(token.FOR) + var forComments []*ast.Comment + if self.mode&StoreComments != 0 { + forComments = self.comments.FetchAll() + } self.expect(token.LEFT_PARENTHESIS) - comments := self.findComments(true) - var left []ast.Expression forIn := false @@ -566,15 +583,26 @@ func (self *_parser) parseForOrForInStatement() ast.Statement { self.scope.allowIn = false if self.token == token.VAR { var_ := self.idx + var varComments []*ast.Comment + if self.mode&StoreComments != 0 { + varComments = self.comments.FetchAll() + self.comments.Unset() + } self.next() list := self.parseVariableDeclarationList(var_) if len(list) == 1 && self.token == token.IN { + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.next() // in forIn = true left = []ast.Expression{list[0]} // There is only one declaration } else { left = list } + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(left[0], varComments, ast.LEADING) + } } else { left = append(left, self.parseExpression()) if self.token == token.IN { @@ -595,22 +623,32 @@ func (self *_parser) parseForOrForInStatement() ast.Statement { return &ast.BadStatement{From: idx, To: self.idx} } + forin := self.parseForIn(left[0]) if self.mode&StoreComments != 0 { - self.commentMap.AddComments(left[0], comments, ast.LEADING) + self.comments.CommentMap.AddComments(forin, comments, ast.LEADING) + self.comments.CommentMap.AddComments(forin, forComments, ast.FOR) } - return self.parseForIn(left[0]) + return forin } + if self.mode&StoreComments != 0 { + self.comments.Unset() + } self.expect(token.SEMICOLON) initializer := &ast.SequenceExpression{Sequence: left} + forstatement := self.parseFor(initializer) if self.mode&StoreComments != 0 { - self.commentMap.AddComments(initializer, comments, ast.LEADING) + self.comments.CommentMap.AddComments(forstatement, comments, ast.LEADING) + self.comments.CommentMap.AddComments(forstatement, forComments, ast.FOR) } - return self.parseFor(initializer) + return forstatement } func (self *_parser) parseVariableStatement() *ast.VariableStatement { - + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } idx := self.expect(token.VAR) list := self.parseVariableDeclarationList(idx) @@ -619,21 +657,12 @@ func (self *_parser) parseVariableStatement() *ast.VariableStatement { Var: idx, List: list, } - - self.commentMap.MoveComments(statement.List[len(statement.List)-1], statement, ast.TRAILING) - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(statement, self.findComments(true), ast.TRAILING) + self.comments.CommentMap.AddComments(statement, comments, ast.LEADING) + self.comments.Unset() } - self.semicolon() - if self.skippedLineBreak { - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(statement, self.findComments(false), ast.TRAILING) - } - } - return statement } @@ -644,14 +673,17 @@ func (self *_parser) parseDoWhileStatement() ast.Statement { self.scope.inIteration = inIteration }() + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } self.expect(token.DO) - - comments := self.findComments(true) - - node := &ast.DoWhileStatement{} + var doComments []*ast.Comment if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, comments, ast.KEY) + doComments = self.comments.FetchAll() } + + node := &ast.DoWhileStatement{} if self.token == token.LEFT_BRACE { node.Body = self.parseBlockStatement() } else { @@ -659,125 +691,91 @@ func (self *_parser) parseDoWhileStatement() ast.Statement { } self.expect(token.WHILE) - - comments = self.findComments(true) - - self.expect(token.LEFT_PARENTHESIS) - node.Test = self.parseExpression() + var whileComments []*ast.Comment if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Test, comments, ast.LEADING) + whileComments = self.comments.FetchAll() } - + self.expect(token.LEFT_PARENTHESIS) + node.Test = self.parseExpression() self.expect(token.RIGHT_PARENTHESIS) if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Test, self.findComments(false), ast.TRAILING) + self.comments.CommentMap.AddComments(node, comments, ast.LEADING) + self.comments.CommentMap.AddComments(node, doComments, ast.DO) + self.comments.CommentMap.AddComments(node, whileComments, ast.WHILE) } return node } func (self *_parser) parseWhileStatement() ast.Statement { + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } self.expect(token.WHILE) - // Comments after while keyword - comments := self.findComments(true) + var whileComments []*ast.Comment + if self.mode&StoreComments != 0 { + whileComments = self.comments.FetchAll() + } self.expect(token.LEFT_PARENTHESIS) node := &ast.WhileStatement{ Test: self.parseExpression(), } - - // Add the while comments - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, comments, ast.KEY) - } - self.expect(token.RIGHT_PARENTHESIS) - - // Finding comments prior to the body - comments = self.findComments(true) - node.Body = self.parseIterationStatement() - // Adding the comments prior to the body if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Body, comments, ast.LEADING) + self.comments.CommentMap.AddComments(node, comments, ast.LEADING) + self.comments.CommentMap.AddComments(node, whileComments, ast.WHILE) } - // Move the trailing comments to the while statement - self.commentMap.MoveComments(node.Body, node, ast.TRAILING) - return node } func (self *_parser) parseIfStatement() ast.Statement { + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } self.expect(token.IF) - - comments := self.findComments(true) + var ifComments []*ast.Comment + if self.mode&StoreComments != 0 { + ifComments = self.comments.FetchAll() + } self.expect(token.LEFT_PARENTHESIS) node := &ast.IfStatement{ Test: self.parseExpression(), } - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node, comments, ast.KEY) - } - self.expect(token.RIGHT_PARENTHESIS) - - comments = self.findComments(true) - if self.token == token.LEFT_BRACE { node.Consequent = self.parseBlockStatement() } else { node.Consequent = self.parseStatement() } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Consequent, comments, ast.LEADING) - self.commentMap.AddComments(node.Consequent, self.findComments(true), ast.TRAILING) - } - if self.token == token.ELSE { self.next() - comments = self.findComments(true) - node.Alternate = self.parseStatement() + } - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(node.Alternate, comments, ast.LEADING) - self.commentMap.AddComments(node.Alternate, self.findComments(false), ast.TRAILING) - } + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(node, comments, ast.LEADING) + self.comments.CommentMap.AddComments(node, ifComments, ast.IF) } return node } func (self *_parser) parseSourceElement() ast.Statement { - - statementComment := self.fetchComments() - statement := self.parseStatement() - - if self.mode&StoreComments != 0 { - self.commentMap.AddComments(statement, statementComment, ast.LEADING) - } - + //self.comments.Unset() return statement } -func (self *_parser) parseCommentElement() { - literal := self.literal - idx := self.expect(token.COMMENT) - self.comments = append(self.comments, &ast.Comment{ - Begin: idx, - Text: literal, - Position: ast.LEADING, - }) -} - func (self *_parser) parseSourceElements() []ast.Statement { body := []ast.Statement(nil) @@ -785,20 +783,10 @@ func (self *_parser) parseSourceElements() []ast.Statement { if self.token != token.STRING { break } - - if self.token == token.COMMENT { - self.parseCommentElement() - continue - } - body = append(body, self.parseSourceElement()) } for self.token != token.EOF { - if self.token == token.COMMENT { - self.parseCommentElement() - continue - } body = append(body, self.parseSourceElement()) } @@ -816,10 +804,11 @@ func (self *_parser) parseProgram() *ast.Program { } func (self *_parser) parseBreakStatement() ast.Statement { + var comments []*ast.Comment + if self.mode&StoreComments != 0 { + comments = self.comments.FetchAll() + } idx := self.expect(token.BREAK) - - breakComments := self.findComments(true) - semicolon := self.implicitSemicolon if self.token == token.SEMICOLON { semicolon = true @@ -837,7 +826,8 @@ func (self *_parser) parseBreakStatement() ast.Statement { } if self.mode&StoreComments != 0 { - self.commentMap.AddComments(breakStatement, breakComments, ast.TRAILING) + self.comments.CommentMap.AddComments(breakStatement, comments, ast.LEADING) + self.comments.CommentMap.AddComments(breakStatement, self.comments.FetchAll(), ast.TRAILING) } return breakStatement @@ -850,11 +840,16 @@ func (self *_parser) parseBreakStatement() ast.Statement { return &ast.BadStatement{From: idx, To: identifier.Idx1()} } self.semicolon() - return &ast.BranchStatement{ + breakStatement := &ast.BranchStatement{ Idx: idx, Token: token.BREAK, Label: identifier, } + if self.mode&StoreComments != 0 { + self.comments.CommentMap.AddComments(breakStatement, comments, ast.LEADING) + } + + return breakStatement } self.expect(token.IDENTIFIER) diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/property.go b/vendor/github.com/robertkrimen/otto/property.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/property.go rename to vendor/github.com/robertkrimen/otto/property.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/registry/README.markdown b/vendor/github.com/robertkrimen/otto/registry/README.markdown similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/registry/README.markdown rename to vendor/github.com/robertkrimen/otto/registry/README.markdown diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/registry/registry.go b/vendor/github.com/robertkrimen/otto/registry/registry.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/registry/registry.go rename to vendor/github.com/robertkrimen/otto/registry/registry.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/result.go b/vendor/github.com/robertkrimen/otto/result.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/result.go rename to vendor/github.com/robertkrimen/otto/result.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/runtime.go b/vendor/github.com/robertkrimen/otto/runtime.go similarity index 53% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/runtime.go rename to vendor/github.com/robertkrimen/otto/runtime.go index a998f7acc6..5762bd0c31 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/runtime.go +++ b/vendor/github.com/robertkrimen/otto/runtime.go @@ -4,7 +4,10 @@ import ( "errors" "fmt" "math" + "path" "reflect" + "runtime" + "strconv" "sync" "github.com/robertkrimen/otto/ast" @@ -56,6 +59,8 @@ type _runtime struct { eval *_object // The builtin eval, for determine indirect versus direct invocation debugger func(*Otto) random func() float64 + stackLimit int + traceLimit int labels []string // FIXME lck sync.Mutex @@ -63,6 +68,14 @@ type _runtime struct { func (self *_runtime) enterScope(scope *_scope) { scope.outer = self.scope + if self.scope != nil { + if self.stackLimit != 0 && self.scope.depth+1 >= self.stackLimit { + panic(self.panicRangeError("Maximum call stack size exceeded")) + } + + scope.depth = self.scope.depth + 1 + } + self.scope = scope } @@ -114,7 +127,7 @@ func (self *_runtime) tryCatchEvaluate(inner func() Value) (tryValue Value, exce switch caught := caught.(type) { case _error: exception = true - tryValue = toValue_object(self.newError(caught.name, caught.messageValue())) + tryValue = toValue_object(self.newError(caught.name, caught.messageValue(), 0)) case Value: exception = true tryValue = caught @@ -178,13 +191,12 @@ func testObjectCoercible(value Value) (isObject bool, mustCoerce bool) { case valueReference, valueEmpty, valueNull, valueUndefined: return false, false case valueNumber, valueString, valueBoolean: - isObject = false - mustCoerce = true + return false, true case valueObject: - isObject = true - mustCoerce = false + return true, false + default: + panic("this should never happen") } - return } func (self *_runtime) safeToValue(value interface{}) (Value, error) { @@ -197,7 +209,9 @@ func (self *_runtime) safeToValue(value interface{}) (Value, error) { // convertNumeric converts numeric parameter val from js to that of type t if it is safe to do so, otherwise it panics. // This allows literals (int64), bitwise values (int32) and the general form (float64) of javascript numerics to be passed as parameters to go functions easily. -func convertNumeric(val reflect.Value, t reflect.Type) reflect.Value { +func (self *_runtime) convertNumeric(v Value, t reflect.Type) reflect.Value { + val := reflect.ValueOf(v.export()) + if val.Kind() == t.Kind() { return val } @@ -214,20 +228,20 @@ func convertNumeric(val reflect.Value, t reflect.Type) reflect.Value { return reflect.ValueOf(f64) case reflect.Float32: if reflect.Zero(t).OverflowFloat(f64) { - panic("converting float64 to float32 would overflow") + panic(self.panicRangeError("converting float64 to float32 would overflow")) } return val.Convert(t) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: i64 := int64(f64) if float64(i64) != f64 { - panic(fmt.Sprintf("converting %v to %v would cause loss of precision", val.Type(), t)) + panic(self.panicRangeError(fmt.Sprintf("converting %v to %v would cause loss of precision", val.Type(), t))) } // The float represents an integer val = reflect.ValueOf(i64) default: - panic(fmt.Sprintf("cannot convert %v to %v", val.Type(), t)) + panic(self.panicTypeError(fmt.Sprintf("cannot convert %v to %v", val.Type(), t))) } } @@ -237,15 +251,15 @@ func convertNumeric(val reflect.Value, t reflect.Type) reflect.Value { switch t.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if reflect.Zero(t).OverflowInt(i64) { - panic(fmt.Sprintf("converting %v to %v would overflow", val.Type(), t)) + panic(self.panicRangeError(fmt.Sprintf("converting %v to %v would overflow", val.Type(), t))) } return val.Convert(t) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: if i64 < 0 { - panic(fmt.Sprintf("converting %v to %v would underflow", val.Type(), t)) + panic(self.panicRangeError(fmt.Sprintf("converting %v to %v would underflow", val.Type(), t))) } if reflect.Zero(t).OverflowUint(uint64(i64)) { - panic(fmt.Sprintf("converting %v to %v would overflow", val.Type(), t)) + panic(self.panicRangeError(fmt.Sprintf("converting %v to %v would overflow", val.Type(), t))) } return val.Convert(t) } @@ -255,86 +269,214 @@ func convertNumeric(val reflect.Value, t reflect.Type) reflect.Value { switch t.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if u64 > math.MaxInt64 || reflect.Zero(t).OverflowInt(int64(u64)) { - panic(fmt.Sprintf("converting %v to %v would overflow", val.Type(), t)) + panic(self.panicRangeError(fmt.Sprintf("converting %v to %v would overflow", val.Type(), t))) } return val.Convert(t) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: if reflect.Zero(t).OverflowUint(u64) { - panic(fmt.Sprintf("converting %v to %v would overflow", val.Type(), t)) + panic(self.panicRangeError(fmt.Sprintf("converting %v to %v would overflow", val.Type(), t))) } return val.Convert(t) } } - panic(fmt.Sprintf("unsupported type %v for numeric conversion", val.Type())) + panic(self.panicTypeError(fmt.Sprintf("unsupported type %v for numeric conversion", val.Type()))) } -// callParamConvert converts request val to type t if possible. +var typeOfValue = reflect.TypeOf(Value{}) + +// convertCallParameter converts request val to type t if possible. // If the conversion fails due to overflow or type miss-match then it panics. // If no conversion is known then the original value is returned. -func callParamConvert(val reflect.Value, t reflect.Type) reflect.Value { - if val.Kind() == reflect.Interface { - val = reflect.ValueOf(val.Interface()) +func (self *_runtime) convertCallParameter(v Value, t reflect.Type) reflect.Value { + if t == typeOfValue { + return reflect.ValueOf(v) } - switch t.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64: - if val.Kind() == t.Kind() { - // Types already match - return val - } - return convertNumeric(val, t) - case reflect.Slice: - if val.Kind() != reflect.Slice { - // Conversion from none slice type to slice not possible - panic(fmt.Sprintf("cannot use %v as type %v", val, t)) + if v.kind == valueObject { + if gso, ok := v._object().value.(*_goStructObject); ok { + if gso.value.Type().AssignableTo(t) { + return gso.value + } } - default: - // No supported conversion - return val } - elemType := t.Elem() - switch elemType.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.Slice: - // Attempt to convert to slice of the type t - s := reflect.MakeSlice(reflect.SliceOf(elemType), val.Len(), val.Len()) - for i := 0; i < val.Len(); i++ { - s.Index(i).Set(callParamConvert(val.Index(i), elemType)) + if t.Kind() == reflect.Interface { + iv := reflect.ValueOf(v.export()) + if iv.Type().AssignableTo(t) { + return iv } + } + + tk := t.Kind() + + if tk == reflect.Ptr { + switch v.kind { + case valueEmpty, valueNull, valueUndefined: + return reflect.Zero(t) + default: + var vv reflect.Value + if err := catchPanic(func() { vv = self.convertCallParameter(v, t.Elem()) }); err == nil { + if vv.CanAddr() { + return vv.Addr() + } - return s + pv := reflect.New(vv.Type()) + pv.Elem().Set(vv) + return pv + } + } } - // Not a slice type we can convert - return val -} + switch tk { + case reflect.Bool: + return reflect.ValueOf(v.bool()) + case reflect.String: + switch v.kind { + case valueString: + return reflect.ValueOf(v.value) + case valueNumber: + return reflect.ValueOf(fmt.Sprintf("%v", v.value)) + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64: + switch v.kind { + case valueNumber: + return self.convertNumeric(v, t) + } + case reflect.Slice: + if o := v._object(); o != nil { + if lv := o.get("length"); lv.IsNumber() { + l := lv.number().int64 + + s := reflect.MakeSlice(t, int(l), int(l)) + + tt := t.Elem() + + if o.class == "Array" { + for i := int64(0); i < l; i++ { + p, ok := o.property[strconv.FormatInt(i, 10)] + if !ok { + continue + } -// callSliceRequired returns true if CallSlice is required instead of Call. -func callSliceRequired(param reflect.Type, val reflect.Value) bool { - vt := val.Type() - for param.Kind() == reflect.Slice { - if val.Kind() == reflect.Interface { - val = reflect.ValueOf(val.Interface()) - vt = val.Type() + e, ok := p.value.(Value) + if !ok { + continue + } + + ev := self.convertCallParameter(e, tt) + + s.Index(int(i)).Set(ev) + } + } else if o.class == "GoArray" { + + var gslice bool + switch o.value.(type) { + case *_goSliceObject: + gslice = true + case *_goArrayObject: + gslice = false + } + + for i := int64(0); i < l; i++ { + var p *_property + if gslice { + p = goSliceGetOwnProperty(o, strconv.FormatInt(i, 10)) + } else { + p = goArrayGetOwnProperty(o, strconv.FormatInt(i, 10)) + } + if p == nil { + continue + } + + e, ok := p.value.(Value) + if !ok { + continue + } + + ev := self.convertCallParameter(e, tt) + + s.Index(int(i)).Set(ev) + } + } + + return s + } } + case reflect.Map: + if o := v._object(); o != nil && t.Key().Kind() == reflect.String { + m := reflect.MakeMap(t) + + o.enumerate(false, func(k string) bool { + m.SetMapIndex(reflect.ValueOf(k), self.convertCallParameter(o.get(k), t.Elem())) + return true + }) + + return m + } + case reflect.Func: + if t.NumOut() > 1 { + panic(self.panicTypeError("converting JavaScript values to Go functions with more than one return value is currently not supported")) + } + + if o := v._object(); o != nil && o.class == "Function" { + return reflect.MakeFunc(t, func(args []reflect.Value) []reflect.Value { + l := make([]interface{}, len(args)) + for i, a := range args { + if a.CanInterface() { + l[i] = a.Interface() + } + } + + rv, err := v.Call(nullValue, l...) + if err != nil { + panic(err) + } - if vt.Kind() != reflect.Slice { - return false + if t.NumOut() == 0 { + return nil + } + + return []reflect.Value{self.convertCallParameter(rv, t.Out(0))} + }) } + } - vt = vt.Elem() - if val.Kind() != reflect.Invalid { - if val.Len() > 0 { - val = val.Index(0) - } else { - val = reflect.Value{} + if tk == reflect.String { + if o := v._object(); o != nil && o.hasProperty("toString") { + if fn := o.get("toString"); fn.IsFunction() { + sv, err := fn.Call(v) + if err != nil { + panic(err) + } + + var r reflect.Value + if err := catchPanic(func() { r = self.convertCallParameter(sv, t) }); err == nil { + return r + } } } - param = param.Elem() + + return reflect.ValueOf(v.String()) } - return true + s := "OTTO DOES NOT UNDERSTAND THIS TYPE" + switch v.kind { + case valueBoolean: + s = "boolean" + case valueNull: + s = "null" + case valueNumber: + s = "number" + case valueString: + s = "string" + case valueUndefined: + s = "undefined" + case valueObject: + s = v.Class() + } + + panic(self.panicTypeError("can't convert from %q to %q", s, t.String())) } func (self *_runtime) toValue(value interface{}) Value { @@ -342,9 +484,27 @@ func (self *_runtime) toValue(value interface{}) Value { case Value: return value case func(FunctionCall) Value: - return toValue_object(self.newNativeFunction("", value)) + var name, file string + var line int + pc := reflect.ValueOf(value).Pointer() + fn := runtime.FuncForPC(pc) + if fn != nil { + name = fn.Name() + file, line = fn.FileLine(pc) + file = path.Base(file) + } + return toValue_object(self.newNativeFunction(name, file, line, value)) case _nativeFunction: - return toValue_object(self.newNativeFunction("", value)) + var name, file string + var line int + pc := reflect.ValueOf(value).Pointer() + fn := runtime.FuncForPC(pc) + if fn != nil { + name = fn.Name() + file, line = fn.FileLine(pc) + file = path.Base(file) + } + return toValue_object(self.newNativeFunction(name, file, line, value)) case Object, *Object, _object, *_object: // Nothing happens. // FIXME We should really figure out what can come here. @@ -352,6 +512,7 @@ func (self *_runtime) toValue(value interface{}) Value { default: { value := reflect.ValueOf(value) + switch value.Kind() { case reflect.Ptr: switch reflect.Indirect(value).Kind() { @@ -360,40 +521,75 @@ func (self *_runtime) toValue(value interface{}) Value { case reflect.Array: return toValue_object(self.newGoArray(value)) } + case reflect.Struct: + return toValue_object(self.newGoStructObject(value)) + case reflect.Map: + return toValue_object(self.newGoMapObject(value)) + case reflect.Slice: + return toValue_object(self.newGoSlice(value)) + case reflect.Array: + return toValue_object(self.newGoArray(value)) case reflect.Func: - // TODO Maybe cache this? - return toValue_object(self.newNativeFunction("", func(call FunctionCall) Value { - argsCount := len(call.ArgumentList) - in := make([]reflect.Value, argsCount) - t := value.Type() - callSlice := false - paramsCount := t.NumIn() - lastParam := paramsCount - 1 - lastArg := argsCount - 1 - isVariadic := t.IsVariadic() - for i, value := range call.ArgumentList { - var paramType reflect.Type - if isVariadic && i == lastArg && argsCount == paramsCount { - // Variadic functions last parameter and parameter numbers match incoming args - paramType = t.In(lastArg) - val := reflect.ValueOf(value.export()) - callSlice = callSliceRequired(paramType, val) - if callSlice { - in[i] = callParamConvert(reflect.ValueOf(value.export()), paramType) - continue + var name, file string + var line int + if v := reflect.ValueOf(value); v.Kind() == reflect.Ptr { + pc := v.Pointer() + fn := runtime.FuncForPC(pc) + if fn != nil { + name = fn.Name() + file, line = fn.FileLine(pc) + file = path.Base(file) + } + } + + typ := value.Type() + + return toValue_object(self.newNativeFunction(name, file, line, func(c FunctionCall) Value { + nargs := typ.NumIn() + + if len(c.ArgumentList) != nargs { + if typ.IsVariadic() { + if len(c.ArgumentList) < nargs-1 { + panic(self.panicRangeError(fmt.Sprintf("expected at least %d arguments; got %d", nargs-1, len(c.ArgumentList)))) } + } else { + panic(self.panicRangeError(fmt.Sprintf("expected %d argument(s); got %d", nargs, len(c.ArgumentList)))) } + } + + in := make([]reflect.Value, len(c.ArgumentList)) + + callSlice := false + + for i, a := range c.ArgumentList { + var t reflect.Type - if i >= lastParam { - if isVariadic { - paramType = t.In(lastParam).Elem() - } else { - paramType = t.In(lastParam) + n := i + if n >= nargs-1 && typ.IsVariadic() { + if n > nargs-1 { + n = nargs - 1 } + + t = typ.In(n).Elem() } else { - paramType = t.In(i) + t = typ.In(n) } - in[i] = callParamConvert(reflect.ValueOf(value.export()), paramType) + + // if this is a variadic Go function, and the caller has supplied + // exactly the number of JavaScript arguments required, and this + // is the last JavaScript argument, try treating the it as the + // actual set of variadic Go arguments. if that succeeds, break + // out of the loop. + if typ.IsVariadic() && len(c.ArgumentList) == nargs && i == nargs-1 { + var v reflect.Value + if err := catchPanic(func() { v = self.convertCallParameter(a, typ.In(n)) }); err == nil { + in[i] = v + callSlice = true + break + } + } + + in[i] = self.convertCallParameter(a, t) } var out []reflect.Value @@ -403,33 +599,24 @@ func (self *_runtime) toValue(value interface{}) Value { out = value.Call(in) } - l := len(out) - switch l { + switch len(out) { case 0: return Value{} case 1: return self.toValue(out[0].Interface()) - } + default: + s := make([]interface{}, len(out)) + for i, v := range out { + s[i] = self.toValue(v.Interface()) + } - // Return an array of the values to emulate multi value return. - // In the future this can be used along side destructuring assignment. - s := make([]interface{}, l) - for i, v := range out { - s[i] = self.toValue(v.Interface()) + return self.toValue(s) } - return self.toValue(s) })) - case reflect.Struct: - return toValue_object(self.newGoStructObject(value)) - case reflect.Map: - return toValue_object(self.newGoMapObject(value)) - case reflect.Slice: - return toValue_object(self.newGoSlice(value)) - case reflect.Array: - return toValue_object(self.newGoArray(value)) } } } + return toValue(value) } @@ -445,32 +632,35 @@ func (runtime *_runtime) newGoArray(value reflect.Value) *_object { return self } -func (runtime *_runtime) parse(filename string, src interface{}) (*ast.Program, error) { - return parser.ParseFile(nil, filename, src, 0) +func (runtime *_runtime) parse(filename string, src, sm interface{}) (*ast.Program, error) { + return parser.ParseFileWithSourceMap(nil, filename, src, sm, 0) } -func (runtime *_runtime) cmpl_parse(filename string, src interface{}) (*_nodeProgram, error) { - program, err := parser.ParseFile(nil, filename, src, 0) +func (runtime *_runtime) cmpl_parse(filename string, src, sm interface{}) (*_nodeProgram, error) { + program, err := parser.ParseFileWithSourceMap(nil, filename, src, sm, 0) if err != nil { return nil, err } + return cmpl_parse(program), nil } -func (self *_runtime) parseSource(src interface{}) (*_nodeProgram, *ast.Program, error) { +func (self *_runtime) parseSource(src, sm interface{}) (*_nodeProgram, *ast.Program, error) { switch src := src.(type) { case *ast.Program: return nil, src, nil case *Script: return src.program, nil, nil } - program, err := self.parse("", src) + + program, err := self.parse("", src, sm) + return nil, program, err } -func (self *_runtime) cmpl_runOrEval(src interface{}, eval bool) (Value, error) { +func (self *_runtime) cmpl_runOrEval(src, sm interface{}, eval bool) (Value, error) { result := Value{} - cmpl_program, program, err := self.parseSource(src) + cmpl_program, program, err := self.parseSource(src, sm) if err != nil { return result, err } @@ -489,12 +679,12 @@ func (self *_runtime) cmpl_runOrEval(src interface{}, eval bool) (Value, error) return result, err } -func (self *_runtime) cmpl_run(src interface{}) (Value, error) { - return self.cmpl_runOrEval(src, false) +func (self *_runtime) cmpl_run(src, sm interface{}) (Value, error) { + return self.cmpl_runOrEval(src, sm, false) } -func (self *_runtime) cmpl_eval(src interface{}) (Value, error) { - return self.cmpl_runOrEval(src, true) +func (self *_runtime) cmpl_eval(src, sm interface{}) (Value, error) { + return self.cmpl_runOrEval(src, sm, true) } func (self *_runtime) parseThrow(err error) { @@ -514,14 +704,8 @@ func (self *_runtime) parseThrow(err error) { panic(self.panicSyntaxError(err.Error())) } -func (self *_runtime) parseOrThrow(source string) *ast.Program { - program, err := self.parse("", source) - self.parseThrow(err) // Will panic/throw appropriately - return program -} - -func (self *_runtime) cmpl_parseOrThrow(source string) *_nodeProgram { - program, err := self.cmpl_parse("", source) +func (self *_runtime) cmpl_parseOrThrow(src, sm interface{}) *_nodeProgram { + program, err := self.cmpl_parse("", src, sm) self.parseThrow(err) // Will panic/throw appropriately return program } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/scope.go b/vendor/github.com/robertkrimen/otto/scope.go similarity index 97% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/scope.go rename to vendor/github.com/robertkrimen/otto/scope.go index b80808434f..465e6b98c7 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/scope.go +++ b/vendor/github.com/robertkrimen/otto/scope.go @@ -21,6 +21,7 @@ type _scope struct { this *_object eval bool // Replace this with kind? outer *_scope + depth int frame _frame } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/script.go b/vendor/github.com/robertkrimen/otto/script.go similarity index 81% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/script.go rename to vendor/github.com/robertkrimen/otto/script.go index ed8aebbf49..2ae890ecd1 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/script.go +++ b/vendor/github.com/robertkrimen/otto/script.go @@ -4,8 +4,6 @@ import ( "bytes" "encoding/gob" "errors" - - "github.com/robertkrimen/otto/parser" ) var ErrVersion = errors.New("version mismatch") @@ -29,28 +27,27 @@ type Script struct { // vm.Run(script) // func (self *Otto) Compile(filename string, src interface{}) (*Script, error) { - { - src, err := parser.ReadSource(filename, src) - if err != nil { - return nil, err - } - - program, err := self.runtime.parse(filename, src) - if err != nil { - return nil, err - } + return self.CompileWithSourceMap(filename, src, nil) +} - cmpl_program := cmpl_parse(program) +// CompileWithSourceMap does the same thing as Compile, but with the obvious +// difference of applying a source map. +func (self *Otto) CompileWithSourceMap(filename string, src, sm interface{}) (*Script, error) { + program, err := self.runtime.parse(filename, src, sm) + if err != nil { + return nil, err + } - script := &Script{ - version: scriptVersion, - program: cmpl_program, - filename: filename, - src: string(src), - } + cmpl_program := cmpl_parse(program) - return script, nil + script := &Script{ + version: scriptVersion, + program: cmpl_program, + filename: filename, + src: program.File.Source(), } + + return script, nil } func (self *Script) String() string { diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/stash.go b/vendor/github.com/robertkrimen/otto/stash.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/stash.go rename to vendor/github.com/robertkrimen/otto/stash.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/token/Makefile b/vendor/github.com/robertkrimen/otto/token/Makefile similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/token/Makefile rename to vendor/github.com/robertkrimen/otto/token/Makefile diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/token/README.markdown b/vendor/github.com/robertkrimen/otto/token/README.markdown similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/token/README.markdown rename to vendor/github.com/robertkrimen/otto/token/README.markdown diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/token/token.go b/vendor/github.com/robertkrimen/otto/token/token.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/token/token.go rename to vendor/github.com/robertkrimen/otto/token/token.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/token/token_const.go b/vendor/github.com/robertkrimen/otto/token/token_const.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/token/token_const.go rename to vendor/github.com/robertkrimen/otto/token/token_const.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/token/tokenfmt b/vendor/github.com/robertkrimen/otto/token/tokenfmt old mode 100644 new mode 100755 similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/token/tokenfmt rename to vendor/github.com/robertkrimen/otto/token/tokenfmt diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_arguments.go b/vendor/github.com/robertkrimen/otto/type_arguments.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_arguments.go rename to vendor/github.com/robertkrimen/otto/type_arguments.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_array.go b/vendor/github.com/robertkrimen/otto/type_array.go similarity index 99% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_array.go rename to vendor/github.com/robertkrimen/otto/type_array.go index 236376a8e4..c8a974b02f 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_array.go +++ b/vendor/github.com/robertkrimen/otto/type_array.go @@ -73,7 +73,7 @@ func arrayDefineOwnProperty(self *_object, name string, descriptor _property, th return false } for newLength < length { - length -= 1 + length-- if !self.delete(strconv.FormatInt(int64(length), 10), false) { descriptor.value = toValue_uint32(length + 1) if !newWritable { diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_boolean.go b/vendor/github.com/robertkrimen/otto/type_boolean.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_boolean.go rename to vendor/github.com/robertkrimen/otto/type_boolean.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_date.go b/vendor/github.com/robertkrimen/otto/type_date.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_date.go rename to vendor/github.com/robertkrimen/otto/type_date.go diff --git a/vendor/github.com/robertkrimen/otto/type_error.go b/vendor/github.com/robertkrimen/otto/type_error.go new file mode 100644 index 0000000000..84e5d79b19 --- /dev/null +++ b/vendor/github.com/robertkrimen/otto/type_error.go @@ -0,0 +1,24 @@ +package otto + +func (rt *_runtime) newErrorObject(name string, message Value, stackFramesToPop int) *_object { + self := rt.newClassObject("Error") + if message.IsDefined() { + msg := message.string() + self.defineProperty("message", toValue_string(msg), 0111, false) + self.value = newError(rt, name, stackFramesToPop, msg) + } else { + self.value = newError(rt, name, stackFramesToPop) + } + + self.defineOwnProperty("stack", _property{ + value: _propertyGetSet{ + rt.newNativeFunction("get", "internal", 0, func(FunctionCall) Value { + return toValue_string(self.value.(_error).formatWithStack()) + }), + &_nilGetSetObject, + }, + mode: modeConfigureMask & modeOnMask, + }, false) + + return self +} diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_function.go b/vendor/github.com/robertkrimen/otto/type_function.go similarity index 91% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_function.go rename to vendor/github.com/robertkrimen/otto/type_function.go index 8581afd390..5637dc6051 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_function.go +++ b/vendor/github.com/robertkrimen/otto/type_function.go @@ -31,13 +31,18 @@ type _nativeFunction func(FunctionCall) Value type _nativeFunctionObject struct { name string + file string + line int call _nativeFunction // [[Call]] construct _constructFunction // [[Construct]] } -func (runtime *_runtime) newNativeFunctionObject(name string, native _nativeFunction, length int) *_object { +func (runtime *_runtime) newNativeFunctionObject(name, file string, line int, native _nativeFunction, length int) *_object { self := runtime.newClassObject("Function") self.value = _nativeFunctionObject{ + name: name, + file: file, + line: line, call: native, construct: defaultConstruct, } @@ -125,11 +130,27 @@ func (self *_object) call(this Value, argumentList []Value, eval bool, frame _fr switch fn := self.value.(type) { case _nativeFunctionObject: - // TODO Enter a scope, name from the native object... // Since eval is a native function, we only have to check for it here if eval { eval = self == self.runtime.eval // If eval is true, then it IS a direct eval } + + // Enter a scope, name from the native object... + rt := self.runtime + if rt.scope != nil && !eval { + rt.enterFunctionScope(rt.scope.lexical, this) + rt.scope.frame = _frame{ + native: true, + nativeFile: fn.file, + nativeLine: fn.line, + callee: fn.name, + file: nil, + } + defer func() { + rt.leaveScope() + }() + } + return fn.call(FunctionCall{ runtime: self.runtime, eval: eval, @@ -149,7 +170,7 @@ func (self *_object) call(this Value, argumentList []Value, eval bool, frame _fr stash := rt.enterFunctionScope(fn.stash, this) rt.scope.frame = _frame{ callee: fn.node.name, - file: fn.node.file, + file: fn.node.file, } defer func() { rt.leaveScope() @@ -267,5 +288,5 @@ func (self FunctionCall) toObject(value Value) *_object { // CallerLocation will return file location information (file:line:pos) where this function is being called. func (self FunctionCall) CallerLocation() string { // see error.go for location() - return self.runtime.scope.frame.location() + return self.runtime.scope.outer.frame.location() } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_array.go b/vendor/github.com/robertkrimen/otto/type_go_array.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_array.go rename to vendor/github.com/robertkrimen/otto/type_go_array.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_map.go b/vendor/github.com/robertkrimen/otto/type_go_map.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_map.go rename to vendor/github.com/robertkrimen/otto/type_go_map.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_slice.go b/vendor/github.com/robertkrimen/otto/type_go_slice.go similarity index 92% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_slice.go rename to vendor/github.com/robertkrimen/otto/type_go_slice.go index 7143531a81..78c69e6849 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_slice.go +++ b/vendor/github.com/robertkrimen/otto/type_go_slice.go @@ -67,6 +67,14 @@ func goSliceGetOwnProperty(self *_object, name string) *_property { } } + // Other methods + if method := self.value.(*_goSliceObject).value.MethodByName(name); (method != reflect.Value{}) { + return &_property{ + value: self.runtime.toValue(method.Interface()), + mode: 0110, + } + } + return objectGetOwnProperty(self, name) } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_struct.go b/vendor/github.com/robertkrimen/otto/type_go_struct.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_go_struct.go rename to vendor/github.com/robertkrimen/otto/type_go_struct.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_number.go b/vendor/github.com/robertkrimen/otto/type_number.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_number.go rename to vendor/github.com/robertkrimen/otto/type_number.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_reference.go b/vendor/github.com/robertkrimen/otto/type_reference.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_reference.go rename to vendor/github.com/robertkrimen/otto/type_reference.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_regexp.go b/vendor/github.com/robertkrimen/otto/type_regexp.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_regexp.go rename to vendor/github.com/robertkrimen/otto/type_regexp.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_string.go b/vendor/github.com/robertkrimen/otto/type_string.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/type_string.go rename to vendor/github.com/robertkrimen/otto/type_string.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/value.go b/vendor/github.com/robertkrimen/otto/value.go similarity index 97% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/value.go rename to vendor/github.com/robertkrimen/otto/value.go index a1c341f4d1..90c1406040 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/value.go +++ b/vendor/github.com/robertkrimen/otto/value.go @@ -30,8 +30,8 @@ type Value struct { value interface{} } -func (vl Value) safe() bool { - return vl.kind < valueEmpty +func (value Value) safe() bool { + return value.kind < valueEmpty } var ( @@ -271,11 +271,11 @@ func toValue_reflectValuePanic(value interface{}, kind reflect.Kind) { // FIXME? switch kind { case reflect.Struct: - panic(newError(nil, "TypeError", "invalid value (struct): missing runtime: %v (%T)", value, value)) + panic(newError(nil, "TypeError", 0, "invalid value (struct): missing runtime: %v (%T)", value, value)) case reflect.Map: - panic(newError(nil, "TypeError", "invalid value (map): missing runtime: %v (%T)", value, value)) + panic(newError(nil, "TypeError", 0, "invalid value (map): missing runtime: %v (%T)", value, value)) case reflect.Slice: - panic(newError(nil, "TypeError", "invalid value (slice): missing runtime: %v (%T)", value, value)) + panic(newError(nil, "TypeError", 0, "invalid value (slice): missing runtime: %v (%T)", value, value)) } } @@ -375,7 +375,7 @@ func toValue(value interface{}) Value { return toValue(reflect.ValueOf(value)) } // FIXME? - panic(newError(nil, "TypeError", "invalid value: %v (%T)", value, value)) + panic(newError(nil, "TypeError", 0, "invalid value: %v (%T)", value, value)) } // String will return the value as a string. @@ -689,17 +689,25 @@ func (self Value) export() interface{} { continue } value := object.get(name).export() + t = reflect.TypeOf(value) + + var k reflect.Kind + if t != nil { + k = t.Kind() + } + if state == 0 { - kind = t.Kind() + kind = k state = 1 - } else if state == 1 && kind != t.Kind() { + } else if state == 1 && kind != k { state = 2 } + result = append(result, value) } - if state != 1 || kind == reflect.Interface { + if state != 1 || kind == reflect.Interface || t == nil { // No common type return result } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/value_boolean.go b/vendor/github.com/robertkrimen/otto/value_boolean.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/value_boolean.go rename to vendor/github.com/robertkrimen/otto/value_boolean.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/value_number.go b/vendor/github.com/robertkrimen/otto/value_number.go similarity index 95% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/value_number.go rename to vendor/github.com/robertkrimen/otto/value_number.go index 54996c7296..870bf115ba 100644 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/value_number.go +++ b/vendor/github.com/robertkrimen/otto/value_number.go @@ -168,32 +168,32 @@ type _number struct { // FIXME // http://www.goinggo.net/2013/08/gustavos-ieee-754-brain-teaser.html // http://bazaar.launchpad.net/~niemeyer/strepr/trunk/view/6/strepr.go#L160 -func (vl Value) number() (number _number) { - switch vl := vl.value.(type) { +func (value Value) number() (number _number) { + switch value := value.value.(type) { case int8: - number.int64 = int64(vl) + number.int64 = int64(value) return case int16: - number.int64 = int64(vl) + number.int64 = int64(value) return case uint8: - number.int64 = int64(vl) + number.int64 = int64(value) return case uint16: - number.int64 = int64(vl) + number.int64 = int64(value) return case uint32: - number.int64 = int64(vl) + number.int64 = int64(value) return case int: - number.int64 = int64(vl) + number.int64 = int64(value) return case int64: - number.int64 = vl + number.int64 = value return } - float := vl.float64() + float := value.float64() if float == 0 { return } diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/value_primitive.go b/vendor/github.com/robertkrimen/otto/value_primitive.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/value_primitive.go rename to vendor/github.com/robertkrimen/otto/value_primitive.go diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/value_string.go b/vendor/github.com/robertkrimen/otto/value_string.go similarity index 100% rename from Godeps/_workspace/src/github.com/robertkrimen/otto/value_string.go rename to vendor/github.com/robertkrimen/otto/value_string.go diff --git a/Godeps/_workspace/src/github.com/rs/cors/.travis.yml b/vendor/github.com/rs/cors/.travis.yml similarity index 100% rename from Godeps/_workspace/src/github.com/rs/cors/.travis.yml rename to vendor/github.com/rs/cors/.travis.yml diff --git a/Godeps/_workspace/src/github.com/rs/cors/LICENSE b/vendor/github.com/rs/cors/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/rs/cors/LICENSE rename to vendor/github.com/rs/cors/LICENSE diff --git a/Godeps/_workspace/src/github.com/rs/cors/README.md b/vendor/github.com/rs/cors/README.md similarity index 63% rename from Godeps/_workspace/src/github.com/rs/cors/README.md rename to vendor/github.com/rs/cors/README.md index 6f70c30aca..4bf56724e6 100644 --- a/Godeps/_workspace/src/github.com/rs/cors/README.md +++ b/vendor/github.com/rs/cors/README.md @@ -1,4 +1,4 @@ -# Go CORS handler [![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/rs/cors) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/rs/cors/master/LICENSE) [![build](https://img.shields.io/travis/rs/cors.svg?style=flat)](https://travis-ci.org/rs/cors) +# Go CORS handler [![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/rs/cors) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/rs/cors/master/LICENSE) [![build](https://img.shields.io/travis/rs/cors.svg?style=flat)](https://travis-ci.org/rs/cors) [![Coverage](http://gocover.io/_badge/github.com/rs/cors)](http://gocover.io/github.com/rs/cors) CORS is a `net/http` handler implementing [Cross Origin Resource Sharing W3 specification](http://www.w3.org/TR/cors/) in Golang. @@ -16,7 +16,8 @@ import ( ) func main() { - h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + mux := http.NewServeMux() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.Write([]byte("{\"hello\": \"world\"}")) }) @@ -24,7 +25,7 @@ func main() { // cors.Default() setup the middleware with default options being // all origins accepted with simple methods (GET, POST). See // documentation below for more options. - handler = cors.Default().Handler(h) + handler := cors.Default().Handler(mux) http.ListenAndServe(":8080", handler) } ``` @@ -70,15 +71,29 @@ c := cors.New(cors.Options{ handler = c.Handler(handler) ``` -* **AllowedOrigins** `[]string`: A list of origins a cross-domain request can be executed from. If the special `*` value is present in the list, all origins will be allowed. The default value is `*`. -* **AllowedMethods** `[]string`: A list of methods the client is allowed to use with cross-domain requests. -* **AllowedHeaders** `[]string`: A list of non simple headers the client is allowed to use with cross-domain requests. Default value is simple methods (`GET` and `POST`) +* **AllowedOrigins** `[]string`: A list of origins a cross-domain request can be executed from. If the special `*` value is present in the list, all origins will be allowed. An origin may contain a wildcard (`*`) to replace 0 or more characters (i.e.: `http://*.domain.com`). Usage of wildcards implies a small performance penality. Only one wildcard can be used per origin. The default value is `*`. +* **AllowOriginFunc** `func (origin string) bool`: A custom function to validate the origin. It take the origin as argument and returns true if allowed or false otherwise. If this option is set, the content of `AllowedOrigins` is ignored +* **AllowedMethods** `[]string`: A list of methods the client is allowed to use with cross-domain requests. Default value is simple methods (`GET` and `POST`). +* **AllowedHeaders** `[]string`: A list of non simple headers the client is allowed to use with cross-domain requests. * **ExposedHeaders** `[]string`: Indicates which headers are safe to expose to the API of a CORS API specification * **AllowCredentials** `bool`: Indicates whether the request can include user credentials like cookies, HTTP authentication or client side SSL certificates. The default is `false`. * **MaxAge** `int`: Indicates how long (in seconds) the results of a preflight request can be cached. The default is `0` which stands for no max age. +* **OptionsPassthrough** `bool`: Instructs preflight to let other potential next handlers to process the `OPTIONS` method. Turn this on if your application handles `OPTIONS`. +* **Debug** `bool`: Debugging flag adds additional output to debug server side CORS issues. See [API documentation](http://godoc.org/github.com/rs/cors) for more info. +## Benchmarks + + BenchmarkWithout 20000000 64.6 ns/op 8 B/op 1 allocs/op + BenchmarkDefault 3000000 469 ns/op 114 B/op 2 allocs/op + BenchmarkAllowedOrigin 3000000 608 ns/op 114 B/op 2 allocs/op + BenchmarkPreflight 20000000 73.2 ns/op 0 B/op 0 allocs/op + BenchmarkPreflightHeader 20000000 73.6 ns/op 0 B/op 0 allocs/op + BenchmarkParseHeaderList 2000000 847 ns/op 184 B/op 6 allocs/op + BenchmarkParse…Single 5000000 290 ns/op 32 B/op 3 allocs/op + BenchmarkParse…Normalized 2000000 776 ns/op 160 B/op 6 allocs/op + ## Licenses All source code is licensed under the [MIT License](https://raw.github.com/rs/cors/master/LICENSE). diff --git a/vendor/github.com/rs/cors/cors.go b/vendor/github.com/rs/cors/cors.go new file mode 100644 index 0000000000..4bb22d8fce --- /dev/null +++ b/vendor/github.com/rs/cors/cors.go @@ -0,0 +1,412 @@ +/* +Package cors is net/http handler to handle CORS related requests +as defined by http://www.w3.org/TR/cors/ + +You can configure it by passing an option struct to cors.New: + + c := cors.New(cors.Options{ + AllowedOrigins: []string{"foo.com"}, + AllowedMethods: []string{"GET", "POST", "DELETE"}, + AllowCredentials: true, + }) + +Then insert the handler in the chain: + + handler = c.Handler(handler) + +See Options documentation for more options. + +The resulting handler is a standard net/http handler. +*/ +package cors + +import ( + "log" + "net/http" + "os" + "strconv" + "strings" + + "github.com/rs/xhandler" + "golang.org/x/net/context" +) + +// Options is a configuration container to setup the CORS middleware. +type Options struct { + // AllowedOrigins is a list of origins a cross-domain request can be executed from. + // If the special "*" value is present in the list, all origins will be allowed. + // An origin may contain a wildcard (*) to replace 0 or more characters + // (i.e.: http://*.domain.com). Usage of wildcards implies a small performance penality. + // Only one wildcard can be used per origin. + // Default value is ["*"] + AllowedOrigins []string + // AllowOriginFunc is a custom function to validate the origin. It take the origin + // as argument and returns true if allowed or false otherwise. If this option is + // set, the content of AllowedOrigins is ignored. + AllowOriginFunc func(origin string) bool + // AllowedMethods is a list of methods the client is allowed to use with + // cross-domain requests. Default value is simple methods (GET and POST) + AllowedMethods []string + // AllowedHeaders is list of non simple headers the client is allowed to use with + // cross-domain requests. + // If the special "*" value is present in the list, all headers will be allowed. + // Default value is [] but "Origin" is always appended to the list. + AllowedHeaders []string + // ExposedHeaders indicates which headers are safe to expose to the API of a CORS + // API specification + ExposedHeaders []string + // AllowCredentials indicates whether the request can include user credentials like + // cookies, HTTP authentication or client side SSL certificates. + AllowCredentials bool + // MaxAge indicates how long (in seconds) the results of a preflight request + // can be cached + MaxAge int + // OptionsPassthrough instructs preflight to let other potential next handlers to + // process the OPTIONS method. Turn this on if your application handles OPTIONS. + OptionsPassthrough bool + // Debugging flag adds additional output to debug server side CORS issues + Debug bool +} + +// Cors http handler +type Cors struct { + // Debug logger + Log *log.Logger + // Set to true when allowed origins contains a "*" + allowedOriginsAll bool + // Normalized list of plain allowed origins + allowedOrigins []string + // List of allowed origins containing wildcards + allowedWOrigins []wildcard + // Optional origin validator function + allowOriginFunc func(origin string) bool + // Set to true when allowed headers contains a "*" + allowedHeadersAll bool + // Normalized list of allowed headers + allowedHeaders []string + // Normalized list of allowed methods + allowedMethods []string + // Normalized list of exposed headers + exposedHeaders []string + allowCredentials bool + maxAge int + optionPassthrough bool +} + +// New creates a new Cors handler with the provided options. +func New(options Options) *Cors { + c := &Cors{ + exposedHeaders: convert(options.ExposedHeaders, http.CanonicalHeaderKey), + allowOriginFunc: options.AllowOriginFunc, + allowCredentials: options.AllowCredentials, + maxAge: options.MaxAge, + optionPassthrough: options.OptionsPassthrough, + } + if options.Debug { + c.Log = log.New(os.Stdout, "[cors] ", log.LstdFlags) + } + + // Normalize options + // Note: for origins and methods matching, the spec requires a case-sensitive matching. + // As it may error prone, we chose to ignore the spec here. + + // Allowed Origins + if len(options.AllowedOrigins) == 0 { + // Default is all origins + c.allowedOriginsAll = true + } else { + c.allowedOrigins = []string{} + c.allowedWOrigins = []wildcard{} + for _, origin := range options.AllowedOrigins { + // Normalize + origin = strings.ToLower(origin) + if origin == "*" { + // If "*" is present in the list, turn the whole list into a match all + c.allowedOriginsAll = true + c.allowedOrigins = nil + c.allowedWOrigins = nil + break + } else if i := strings.IndexByte(origin, '*'); i >= 0 { + // Split the origin in two: start and end string without the * + w := wildcard{origin[0:i], origin[i+1 : len(origin)]} + c.allowedWOrigins = append(c.allowedWOrigins, w) + } else { + c.allowedOrigins = append(c.allowedOrigins, origin) + } + } + } + + // Allowed Headers + if len(options.AllowedHeaders) == 0 { + // Use sensible defaults + c.allowedHeaders = []string{"Origin", "Accept", "Content-Type"} + } else { + // Origin is always appended as some browsers will always request for this header at preflight + c.allowedHeaders = convert(append(options.AllowedHeaders, "Origin"), http.CanonicalHeaderKey) + for _, h := range options.AllowedHeaders { + if h == "*" { + c.allowedHeadersAll = true + c.allowedHeaders = nil + break + } + } + } + + // Allowed Methods + if len(options.AllowedMethods) == 0 { + // Default is spec's "simple" methods + c.allowedMethods = []string{"GET", "POST"} + } else { + c.allowedMethods = convert(options.AllowedMethods, strings.ToUpper) + } + + return c +} + +// Default creates a new Cors handler with default options +func Default() *Cors { + return New(Options{}) +} + +// Handler apply the CORS specification on the request, and add relevant CORS headers +// as necessary. +func (c *Cors) Handler(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method == "OPTIONS" { + c.logf("Handler: Preflight request") + c.handlePreflight(w, r) + // Preflight requests are standalone and should stop the chain as some other + // middleware may not handle OPTIONS requests correctly. One typical example + // is authentication middleware ; OPTIONS requests won't carry authentication + // headers (see #1) + if c.optionPassthrough { + h.ServeHTTP(w, r) + } else { + w.WriteHeader(http.StatusOK) + } + } else { + c.logf("Handler: Actual request") + c.handleActualRequest(w, r) + h.ServeHTTP(w, r) + } + }) +} + +// HandlerC is net/context aware handler +func (c *Cors) HandlerC(h xhandler.HandlerC) xhandler.HandlerC { + return xhandler.HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { + if r.Method == "OPTIONS" { + c.logf("Handler: Preflight request") + c.handlePreflight(w, r) + // Preflight requests are standalone and should stop the chain as some other + // middleware may not handle OPTIONS requests correctly. One typical example + // is authentication middleware ; OPTIONS requests won't carry authentication + // headers (see #1) + if c.optionPassthrough { + h.ServeHTTPC(ctx, w, r) + } else { + w.WriteHeader(http.StatusOK) + } + } else { + c.logf("Handler: Actual request") + c.handleActualRequest(w, r) + h.ServeHTTPC(ctx, w, r) + } + }) +} + +// HandlerFunc provides Martini compatible handler +func (c *Cors) HandlerFunc(w http.ResponseWriter, r *http.Request) { + if r.Method == "OPTIONS" { + c.logf("HandlerFunc: Preflight request") + c.handlePreflight(w, r) + } else { + c.logf("HandlerFunc: Actual request") + c.handleActualRequest(w, r) + } +} + +// Negroni compatible interface +func (c *Cors) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { + if r.Method == "OPTIONS" { + c.logf("ServeHTTP: Preflight request") + c.handlePreflight(w, r) + // Preflight requests are standalone and should stop the chain as some other + // middleware may not handle OPTIONS requests correctly. One typical example + // is authentication middleware ; OPTIONS requests won't carry authentication + // headers (see #1) + if c.optionPassthrough { + next(w, r) + } else { + w.WriteHeader(http.StatusOK) + } + } else { + c.logf("ServeHTTP: Actual request") + c.handleActualRequest(w, r) + next(w, r) + } +} + +// handlePreflight handles pre-flight CORS requests +func (c *Cors) handlePreflight(w http.ResponseWriter, r *http.Request) { + headers := w.Header() + origin := r.Header.Get("Origin") + + if r.Method != "OPTIONS" { + c.logf(" Preflight aborted: %s!=OPTIONS", r.Method) + return + } + // Always set Vary headers + // see https://github.com/rs/cors/issues/10, + // https://github.com/rs/cors/commit/dbdca4d95feaa7511a46e6f1efb3b3aa505bc43f#commitcomment-12352001 + headers.Add("Vary", "Origin") + headers.Add("Vary", "Access-Control-Request-Method") + headers.Add("Vary", "Access-Control-Request-Headers") + + if origin == "" { + c.logf(" Preflight aborted: empty origin") + return + } + if !c.isOriginAllowed(origin) { + c.logf(" Preflight aborted: origin '%s' not allowed", origin) + return + } + + reqMethod := r.Header.Get("Access-Control-Request-Method") + if !c.isMethodAllowed(reqMethod) { + c.logf(" Preflight aborted: method '%s' not allowed", reqMethod) + return + } + reqHeaders := parseHeaderList(r.Header.Get("Access-Control-Request-Headers")) + if !c.areHeadersAllowed(reqHeaders) { + c.logf(" Preflight aborted: headers '%v' not allowed", reqHeaders) + return + } + headers.Set("Access-Control-Allow-Origin", origin) + // Spec says: Since the list of methods can be unbounded, simply returning the method indicated + // by Access-Control-Request-Method (if supported) can be enough + headers.Set("Access-Control-Allow-Methods", strings.ToUpper(reqMethod)) + if len(reqHeaders) > 0 { + + // Spec says: Since the list of headers can be unbounded, simply returning supported headers + // from Access-Control-Request-Headers can be enough + headers.Set("Access-Control-Allow-Headers", strings.Join(reqHeaders, ", ")) + } + if c.allowCredentials { + headers.Set("Access-Control-Allow-Credentials", "true") + } + if c.maxAge > 0 { + headers.Set("Access-Control-Max-Age", strconv.Itoa(c.maxAge)) + } + c.logf(" Preflight response headers: %v", headers) +} + +// handleActualRequest handles simple cross-origin requests, actual request or redirects +func (c *Cors) handleActualRequest(w http.ResponseWriter, r *http.Request) { + headers := w.Header() + origin := r.Header.Get("Origin") + + if r.Method == "OPTIONS" { + c.logf(" Actual request no headers added: method == %s", r.Method) + return + } + // Always set Vary, see https://github.com/rs/cors/issues/10 + headers.Add("Vary", "Origin") + if origin == "" { + c.logf(" Actual request no headers added: missing origin") + return + } + if !c.isOriginAllowed(origin) { + c.logf(" Actual request no headers added: origin '%s' not allowed", origin) + return + } + + // Note that spec does define a way to specifically disallow a simple method like GET or + // POST. Access-Control-Allow-Methods is only used for pre-flight requests and the + // spec doesn't instruct to check the allowed methods for simple cross-origin requests. + // We think it's a nice feature to be able to have control on those methods though. + if !c.isMethodAllowed(r.Method) { + c.logf(" Actual request no headers added: method '%s' not allowed", r.Method) + + return + } + headers.Set("Access-Control-Allow-Origin", origin) + if len(c.exposedHeaders) > 0 { + headers.Set("Access-Control-Expose-Headers", strings.Join(c.exposedHeaders, ", ")) + } + if c.allowCredentials { + headers.Set("Access-Control-Allow-Credentials", "true") + } + c.logf(" Actual response added headers: %v", headers) +} + +// convenience method. checks if debugging is turned on before printing +func (c *Cors) logf(format string, a ...interface{}) { + if c.Log != nil { + c.Log.Printf(format, a...) + } +} + +// isOriginAllowed checks if a given origin is allowed to perform cross-domain requests +// on the endpoint +func (c *Cors) isOriginAllowed(origin string) bool { + if c.allowOriginFunc != nil { + return c.allowOriginFunc(origin) + } + if c.allowedOriginsAll { + return true + } + origin = strings.ToLower(origin) + for _, o := range c.allowedOrigins { + if o == origin { + return true + } + } + for _, w := range c.allowedWOrigins { + if w.match(origin) { + return true + } + } + return false +} + +// isMethodAllowed checks if a given method can be used as part of a cross-domain request +// on the endpoing +func (c *Cors) isMethodAllowed(method string) bool { + if len(c.allowedMethods) == 0 { + // If no method allowed, always return false, even for preflight request + return false + } + method = strings.ToUpper(method) + if method == "OPTIONS" { + // Always allow preflight requests + return true + } + for _, m := range c.allowedMethods { + if m == method { + return true + } + } + return false +} + +// areHeadersAllowed checks if a given list of headers are allowed to used within +// a cross-domain request. +func (c *Cors) areHeadersAllowed(requestedHeaders []string) bool { + if c.allowedHeadersAll || len(requestedHeaders) == 0 { + return true + } + for _, header := range requestedHeaders { + header = http.CanonicalHeaderKey(header) + found := false + for _, h := range c.allowedHeaders { + if h == header { + found = true + } + } + if !found { + return false + } + } + return true +} diff --git a/vendor/github.com/rs/cors/utils.go b/vendor/github.com/rs/cors/utils.go new file mode 100644 index 0000000000..c7a0aa0601 --- /dev/null +++ b/vendor/github.com/rs/cors/utils.go @@ -0,0 +1,70 @@ +package cors + +import "strings" + +const toLower = 'a' - 'A' + +type converter func(string) string + +type wildcard struct { + prefix string + suffix string +} + +func (w wildcard) match(s string) bool { + return len(s) >= len(w.prefix+w.suffix) && strings.HasPrefix(s, w.prefix) && strings.HasSuffix(s, w.suffix) +} + +// convert converts a list of string using the passed converter function +func convert(s []string, c converter) []string { + out := []string{} + for _, i := range s { + out = append(out, c(i)) + } + return out +} + +// parseHeaderList tokenize + normalize a string containing a list of headers +func parseHeaderList(headerList string) []string { + l := len(headerList) + h := make([]byte, 0, l) + upper := true + // Estimate the number headers in order to allocate the right splice size + t := 0 + for i := 0; i < l; i++ { + if headerList[i] == ',' { + t++ + } + } + headers := make([]string, 0, t) + for i := 0; i < l; i++ { + b := headerList[i] + if b >= 'a' && b <= 'z' { + if upper { + h = append(h, b-toLower) + } else { + h = append(h, b) + } + } else if b >= 'A' && b <= 'Z' { + if !upper { + h = append(h, b+toLower) + } else { + h = append(h, b) + } + } else if b == '-' || b == '_' || (b >= '0' && b <= '9') { + h = append(h, b) + } + + if b == ' ' || b == ',' || i == l-1 { + if len(h) > 0 { + // Flush the found header + headers = append(headers, string(h)) + h = h[:0] + upper = true + } + } else { + upper = b == '-' || b == '_' + } + } + return headers +} diff --git a/vendor/github.com/rs/xhandler/.travis.yml b/vendor/github.com/rs/xhandler/.travis.yml new file mode 100644 index 0000000000..b65c7a9f1e --- /dev/null +++ b/vendor/github.com/rs/xhandler/.travis.yml @@ -0,0 +1,7 @@ +language: go +go: +- 1.5 +- tip +matrix: + allow_failures: + - go: tip diff --git a/vendor/github.com/rs/xhandler/LICENSE b/vendor/github.com/rs/xhandler/LICENSE new file mode 100644 index 0000000000..47c5e9d2d2 --- /dev/null +++ b/vendor/github.com/rs/xhandler/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Olivier Poitrey + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/rs/xhandler/README.md b/vendor/github.com/rs/xhandler/README.md new file mode 100644 index 0000000000..91c594bd25 --- /dev/null +++ b/vendor/github.com/rs/xhandler/README.md @@ -0,0 +1,134 @@ +# XHandler + +[![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/rs/xhandler) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/rs/xhandler/master/LICENSE) [![Build Status](https://travis-ci.org/rs/xhandler.svg?branch=master)](https://travis-ci.org/rs/xhandler) [![Coverage](http://gocover.io/_badge/github.com/rs/xhandler)](http://gocover.io/github.com/rs/xhandler) + +XHandler is a bridge between [net/context](https://godoc.org/golang.org/x/net/context) and `http.Handler`. + +It lets you enforce `net/context` in your handlers without sacrificing compatibility with existing `http.Handlers` nor imposing a specific router. + +Thanks to `net/context` deadline management, `xhandler` is able to enforce a per request deadline and will cancel the context when the client closes the connection unexpectedly. + +You may create your own `net/context` aware handler pretty much the same way as you would do with http.Handler. + +Read more about xhandler on [Dailymotion engineering blog](http://engineering.dailymotion.com/our-way-to-go/). + +## Installing + + go get -u github.com/rs/xhandler + +## Usage + +```go +package main + +import ( + "log" + "net/http" + "time" + + "github.com/rs/cors" + "github.com/rs/xhandler" + "golang.org/x/net/context" +) + +type myMiddleware struct { + next xhandler.HandlerC +} + +func (h myMiddleware) ServeHTTPC(ctx context.Context, w http.ResponseWriter, r *http.Request) { + ctx = context.WithValue(ctx, "test", "World") + h.next.ServeHTTPC(ctx, w, r) +} + +func main() { + c := xhandler.Chain{} + + // Add close notifier handler so context is cancelled when the client closes + // the connection + c.UseC(xhandler.CloseHandler) + + // Add timeout handler + c.UseC(xhandler.TimeoutHandler(2 * time.Second)) + + // Middleware putting something in the context + c.UseC(func(next xhandler.HandlerC) xhandler.HandlerC { + return myMiddleware{next: next} + }) + + // Mix it with a non-context-aware middleware handler + c.Use(cors.Default().Handler) + + // Final handler (using handlerFuncC), reading from the context + xh := xhandler.HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { + value := ctx.Value("test").(string) + w.Write([]byte("Hello " + value)) + }) + + // Bridge context aware handlers with http.Handler using xhandler.Handle() + http.Handle("/test", c.Handler(xh)) + + if err := http.ListenAndServe(":8080", nil); err != nil { + log.Fatal(err) + } +} +``` + +### Using xmux + +Xhandler comes with an optional context aware [muxer](https://github.com/rs/xmux) forked from [httprouter](https://github.com/julienschmidt/httprouter): + +```go +package main + +import ( + "fmt" + "log" + "net/http" + "time" + + "github.com/rs/xhandler" + "github.com/rs/xmux" + "golang.org/x/net/context" +) + +func main() { + c := xhandler.Chain{} + + // Append a context-aware middleware handler + c.UseC(xhandler.CloseHandler) + + // Another context-aware middleware handler + c.UseC(xhandler.TimeoutHandler(2 * time.Second)) + + mux := xmux.New() + + // Use c.Handler to terminate the chain with your final handler + mux.GET("/welcome/:name", xhandler.HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, req *http.Request) { + fmt.Fprintf(w, "Welcome %s!", xmux.Params(ctx).Get("name")) + })) + + if err := http.ListenAndServe(":8080", c.Handler(mux)); err != nil { + log.Fatal(err) + } +} +``` + +See [xmux](https://github.com/rs/xmux) for more examples. + +## Context Aware Middleware + +Here is a list of `net/context` aware middleware handlers implementing `xhandler.HandlerC` interface. + +Feel free to put up a PR linking your middleware if you have built one: + +| Middleware | Author | Description | +| ---------- | ------ | ----------- | +| [xmux](https://github.com/rs/xmux) | [Olivier Poitrey](https://github.com/rs) | HTTP request muxer | +| [xlog](https://github.com/rs/xlog) | [Olivier Poitrey](https://github.com/rs) | HTTP handler logger | +| [xstats](https://github.com/rs/xstats) | [Olivier Poitrey](https://github.com/rs) | A generic client for service instrumentation | +| [xaccess](https://github.com/rs/xaccess) | [Olivier Poitrey](https://github.com/rs) | HTTP handler access logger with [xlog](https://github.com/rs/xlog) and [xstats](https://github.com/rs/xstats) | +| [cors](https://github.com/rs/cors) | [Olivier Poitrey](https://github.com/rs) | [Cross Origin Resource Sharing](http://www.w3.org/TR/cors/) (CORS) support | + +## Licenses + +All source code is licensed under the [MIT License](https://raw.github.com/rs/xhandler/master/LICENSE). diff --git a/vendor/github.com/rs/xhandler/chain.go b/vendor/github.com/rs/xhandler/chain.go new file mode 100644 index 0000000000..3e4bd359c5 --- /dev/null +++ b/vendor/github.com/rs/xhandler/chain.go @@ -0,0 +1,121 @@ +package xhandler + +import ( + "net/http" + + "golang.org/x/net/context" +) + +// Chain is a helper for chaining middleware handlers together for easier +// management. +type Chain []func(next HandlerC) HandlerC + +// Add appends a variable number of additional middleware handlers +// to the middleware chain. Middleware handlers can either be +// context-aware or non-context aware handlers with the appropriate +// function signatures. +func (c *Chain) Add(f ...interface{}) { + for _, h := range f { + switch v := h.(type) { + case func(http.Handler) http.Handler: + c.Use(v) + case func(HandlerC) HandlerC: + c.UseC(v) + default: + panic("Adding invalid handler to the middleware chain") + } + } +} + +// With creates a new middleware chain from an existing chain, +// extending it with additional middleware. Middleware handlers +// can either be context-aware or non-context aware handlers +// with the appropriate function signatures. +func (c *Chain) With(f ...interface{}) *Chain { + n := make(Chain, len(*c)) + copy(n, *c) + n.Add(f...) + return &n +} + +// UseC appends a context-aware handler to the middleware chain. +func (c *Chain) UseC(f func(next HandlerC) HandlerC) { + *c = append(*c, f) +} + +// Use appends a standard http.Handler to the middleware chain without +// losing track of the context when inserted between two context aware handlers. +// +// Caveat: the f function will be called on each request so you are better off putting +// any initialization sequence outside of this function. +func (c *Chain) Use(f func(next http.Handler) http.Handler) { + xf := func(next HandlerC) HandlerC { + return HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { + n := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + next.ServeHTTPC(ctx, w, r) + }) + f(n).ServeHTTP(w, r) + }) + } + *c = append(*c, xf) +} + +// Handler wraps the provided final handler with all the middleware appended to +// the chain and returns a new standard http.Handler instance. +// The context.Background() context is injected automatically. +func (c Chain) Handler(xh HandlerC) http.Handler { + ctx := context.Background() + return c.HandlerCtx(ctx, xh) +} + +// HandlerFC is a helper to provide a function (HandlerFuncC) to Handler(). +// +// HandlerFC is equivalent to: +// c.Handler(xhandler.HandlerFuncC(xhc)) +func (c Chain) HandlerFC(xhf HandlerFuncC) http.Handler { + ctx := context.Background() + return c.HandlerCtx(ctx, HandlerFuncC(xhf)) +} + +// HandlerH is a helper to provide a standard http handler (http.HandlerFunc) +// to Handler(). Your final handler won't have access to the context though. +func (c Chain) HandlerH(h http.Handler) http.Handler { + ctx := context.Background() + return c.HandlerCtx(ctx, HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { + h.ServeHTTP(w, r) + })) +} + +// HandlerF is a helper to provide a standard http handler function +// (http.HandlerFunc) to Handler(). Your final handler won't have access +// to the context though. +func (c Chain) HandlerF(hf http.HandlerFunc) http.Handler { + ctx := context.Background() + return c.HandlerCtx(ctx, HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { + hf(w, r) + })) +} + +// HandlerCtx wraps the provided final handler with all the middleware appended to +// the chain and returns a new standard http.Handler instance. +func (c Chain) HandlerCtx(ctx context.Context, xh HandlerC) http.Handler { + return New(ctx, c.HandlerC(xh)) +} + +// HandlerC wraps the provided final handler with all the middleware appended to +// the chain and returns a HandlerC instance. +func (c Chain) HandlerC(xh HandlerC) HandlerC { + for i := len(c) - 1; i >= 0; i-- { + xh = c[i](xh) + } + return xh +} + +// HandlerCF wraps the provided final handler func with all the middleware appended to +// the chain and returns a HandlerC instance. +// +// HandlerCF is equivalent to: +// c.HandlerC(xhandler.HandlerFuncC(xhc)) +func (c Chain) HandlerCF(xhc HandlerFuncC) HandlerC { + return c.HandlerC(HandlerFuncC(xhc)) +} diff --git a/vendor/github.com/rs/xhandler/middleware.go b/vendor/github.com/rs/xhandler/middleware.go new file mode 100644 index 0000000000..7ad8fba625 --- /dev/null +++ b/vendor/github.com/rs/xhandler/middleware.go @@ -0,0 +1,59 @@ +package xhandler + +import ( + "net/http" + "time" + + "golang.org/x/net/context" +) + +// CloseHandler returns a Handler, cancelling the context when the client +// connection closes unexpectedly. +func CloseHandler(next HandlerC) HandlerC { + return HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { + // Cancel the context if the client closes the connection + if wcn, ok := w.(http.CloseNotifier); ok { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + + notify := wcn.CloseNotify() + go func() { + select { + case <-notify: + cancel() + case <-ctx.Done(): + } + }() + } + + next.ServeHTTPC(ctx, w, r) + }) +} + +// TimeoutHandler returns a Handler which adds a timeout to the context. +// +// Child handlers have the responsability of obeying the context deadline and to return +// an appropriate error (or not) response in case of timeout. +func TimeoutHandler(timeout time.Duration) func(next HandlerC) HandlerC { + return func(next HandlerC) HandlerC { + return HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { + ctx, _ = context.WithTimeout(ctx, timeout) + next.ServeHTTPC(ctx, w, r) + }) + } +} + +// If is a special handler that will skip insert the condNext handler only if a condition +// applies at runtime. +func If(cond func(ctx context.Context, w http.ResponseWriter, r *http.Request) bool, condNext func(next HandlerC) HandlerC) func(next HandlerC) HandlerC { + return func(next HandlerC) HandlerC { + return HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { + if cond(ctx, w, r) { + condNext(next).ServeHTTPC(ctx, w, r) + } else { + next.ServeHTTPC(ctx, w, r) + } + }) + } +} diff --git a/vendor/github.com/rs/xhandler/xhandler.go b/vendor/github.com/rs/xhandler/xhandler.go new file mode 100644 index 0000000000..bc832cb1fa --- /dev/null +++ b/vendor/github.com/rs/xhandler/xhandler.go @@ -0,0 +1,42 @@ +// Package xhandler provides a bridge between http.Handler and net/context. +// +// xhandler enforces net/context in your handlers without sacrificing +// compatibility with existing http.Handlers nor imposing a specific router. +// +// Thanks to net/context deadline management, xhandler is able to enforce +// a per request deadline and will cancel the context in when the client close +// the connection unexpectedly. +// +// You may create net/context aware middlewares pretty much the same way as +// you would with http.Handler. +package xhandler // import "github.com/rs/xhandler" + +import ( + "net/http" + + "golang.org/x/net/context" +) + +// HandlerC is a net/context aware http.Handler +type HandlerC interface { + ServeHTTPC(context.Context, http.ResponseWriter, *http.Request) +} + +// HandlerFuncC type is an adapter to allow the use of ordinary functions +// as an xhandler.Handler. If f is a function with the appropriate signature, +// xhandler.HandlerFuncC(f) is a xhandler.Handler object that calls f. +type HandlerFuncC func(context.Context, http.ResponseWriter, *http.Request) + +// ServeHTTPC calls f(ctx, w, r). +func (f HandlerFuncC) ServeHTTPC(ctx context.Context, w http.ResponseWriter, r *http.Request) { + f(ctx, w, r) +} + +// New creates a conventional http.Handler injecting the provided root +// context to sub handlers. This handler is used as a bridge between conventional +// http.Handler and context aware handlers. +func New(ctx context.Context, h HandlerC) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + h.ServeHTTPC(ctx, w, r) + }) +} diff --git a/vendor/github.com/syndtr/goleveldb/.travis.yml b/vendor/github.com/syndtr/goleveldb/.travis.yml new file mode 100644 index 0000000000..82de37735d --- /dev/null +++ b/vendor/github.com/syndtr/goleveldb/.travis.yml @@ -0,0 +1,12 @@ +language: go + +go: + - 1.4 + - 1.5 + - 1.6 + - 1.7 + - tip + +script: + - go test -timeout 1h ./... + - go test -timeout 30m -race -run "TestDB_(Concurrent|GoleveldbIssue74)" ./leveldb diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/LICENSE b/vendor/github.com/syndtr/goleveldb/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/LICENSE rename to vendor/github.com/syndtr/goleveldb/LICENSE diff --git a/vendor/github.com/syndtr/goleveldb/README.md b/vendor/github.com/syndtr/goleveldb/README.md new file mode 100644 index 0000000000..259286f550 --- /dev/null +++ b/vendor/github.com/syndtr/goleveldb/README.md @@ -0,0 +1,105 @@ +This is an implementation of the [LevelDB key/value database](http:code.google.com/p/leveldb) in the [Go programming language](http:golang.org). + +[![Build Status](https://travis-ci.org/syndtr/goleveldb.png?branch=master)](https://travis-ci.org/syndtr/goleveldb) + +Installation +----------- + + go get github.com/syndtr/goleveldb/leveldb + +Requirements +----------- + +* Need at least `go1.4` or newer. + +Usage +----------- + +Create or open a database: +```go +db, err := leveldb.OpenFile("path/to/db", nil) +... +defer db.Close() +... +``` +Read or modify the database content: +```go +// Remember that the contents of the returned slice should not be modified. +data, err := db.Get([]byte("key"), nil) +... +err = db.Put([]byte("key"), []byte("value"), nil) +... +err = db.Delete([]byte("key"), nil) +... +``` + +Iterate over database content: +```go +iter := db.NewIterator(nil, nil) +for iter.Next() { + // Remember that the contents of the returned slice should not be modified, and + // only valid until the next call to Next. + key := iter.Key() + value := iter.Value() + ... +} +iter.Release() +err = iter.Error() +... +``` +Seek-then-Iterate: +```go +iter := db.NewIterator(nil, nil) +for ok := iter.Seek(key); ok; ok = iter.Next() { + // Use key/value. + ... +} +iter.Release() +err = iter.Error() +... +``` +Iterate over subset of database content: +```go +iter := db.NewIterator(&util.Range{Start: []byte("foo"), Limit: []byte("xoo")}, nil) +for iter.Next() { + // Use key/value. + ... +} +iter.Release() +err = iter.Error() +... +``` +Iterate over subset of database content with a particular prefix: +```go +iter := db.NewIterator(util.BytesPrefix([]byte("foo-")), nil) +for iter.Next() { + // Use key/value. + ... +} +iter.Release() +err = iter.Error() +... +``` +Batch writes: +```go +batch := new(leveldb.Batch) +batch.Put([]byte("foo"), []byte("value")) +batch.Put([]byte("bar"), []byte("another value")) +batch.Delete([]byte("baz")) +err = db.Write(batch, nil) +... +``` +Use bloom filter: +```go +o := &opt.Options{ + Filter: filter.NewBloomFilter(10), +} +db, err := leveldb.OpenFile("path/to/db", o) +... +defer db.Close() +... +``` +Documentation +----------- + +You can read package documentation [here](http:godoc.org/github.com/syndtr/goleveldb). diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/batch.go b/vendor/github.com/syndtr/goleveldb/leveldb/batch.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/batch.go rename to vendor/github.com/syndtr/goleveldb/leveldb/batch.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/cache/cache.go b/vendor/github.com/syndtr/goleveldb/leveldb/cache/cache.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/cache/cache.go rename to vendor/github.com/syndtr/goleveldb/leveldb/cache/cache.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/cache/lru.go b/vendor/github.com/syndtr/goleveldb/leveldb/cache/lru.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/cache/lru.go rename to vendor/github.com/syndtr/goleveldb/leveldb/cache/lru.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer.go b/vendor/github.com/syndtr/goleveldb/leveldb/comparer.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer.go rename to vendor/github.com/syndtr/goleveldb/leveldb/comparer.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go b/vendor/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go rename to vendor/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go b/vendor/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go rename to vendor/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go b/vendor/github.com/syndtr/goleveldb/leveldb/db.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go rename to vendor/github.com/syndtr/goleveldb/leveldb/db.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go rename to vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_iter.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_iter.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_iter.go rename to vendor/github.com/syndtr/goleveldb/leveldb/db_iter.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_snapshot.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_snapshot.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_snapshot.go rename to vendor/github.com/syndtr/goleveldb/leveldb/db_snapshot.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_state.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_state.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_state.go rename to vendor/github.com/syndtr/goleveldb/leveldb/db_state.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_transaction.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_transaction.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_transaction.go rename to vendor/github.com/syndtr/goleveldb/leveldb/db_transaction.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_util.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_util.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_util.go rename to vendor/github.com/syndtr/goleveldb/leveldb/db_util.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_write.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_write.go rename to vendor/github.com/syndtr/goleveldb/leveldb/db_write.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/doc.go b/vendor/github.com/syndtr/goleveldb/leveldb/doc.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/doc.go rename to vendor/github.com/syndtr/goleveldb/leveldb/doc.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/errors.go b/vendor/github.com/syndtr/goleveldb/leveldb/errors.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/errors.go rename to vendor/github.com/syndtr/goleveldb/leveldb/errors.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/errors/errors.go b/vendor/github.com/syndtr/goleveldb/leveldb/errors/errors.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/errors/errors.go rename to vendor/github.com/syndtr/goleveldb/leveldb/errors/errors.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter.go b/vendor/github.com/syndtr/goleveldb/leveldb/filter.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter.go rename to vendor/github.com/syndtr/goleveldb/leveldb/filter.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter/bloom.go b/vendor/github.com/syndtr/goleveldb/leveldb/filter/bloom.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter/bloom.go rename to vendor/github.com/syndtr/goleveldb/leveldb/filter/bloom.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter/filter.go b/vendor/github.com/syndtr/goleveldb/leveldb/filter/filter.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/filter/filter.go rename to vendor/github.com/syndtr/goleveldb/leveldb/filter/filter.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator/array_iter.go b/vendor/github.com/syndtr/goleveldb/leveldb/iterator/array_iter.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator/array_iter.go rename to vendor/github.com/syndtr/goleveldb/leveldb/iterator/array_iter.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator/indexed_iter.go b/vendor/github.com/syndtr/goleveldb/leveldb/iterator/indexed_iter.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator/indexed_iter.go rename to vendor/github.com/syndtr/goleveldb/leveldb/iterator/indexed_iter.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator/iter.go b/vendor/github.com/syndtr/goleveldb/leveldb/iterator/iter.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator/iter.go rename to vendor/github.com/syndtr/goleveldb/leveldb/iterator/iter.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator/merged_iter.go b/vendor/github.com/syndtr/goleveldb/leveldb/iterator/merged_iter.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/iterator/merged_iter.go rename to vendor/github.com/syndtr/goleveldb/leveldb/iterator/merged_iter.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/journal/journal.go b/vendor/github.com/syndtr/goleveldb/leveldb/journal/journal.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/journal/journal.go rename to vendor/github.com/syndtr/goleveldb/leveldb/journal/journal.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/key.go b/vendor/github.com/syndtr/goleveldb/leveldb/key.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/key.go rename to vendor/github.com/syndtr/goleveldb/leveldb/key.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go b/vendor/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go rename to vendor/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/opt/options.go b/vendor/github.com/syndtr/goleveldb/leveldb/opt/options.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/opt/options.go rename to vendor/github.com/syndtr/goleveldb/leveldb/opt/options.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/options.go b/vendor/github.com/syndtr/goleveldb/leveldb/options.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/options.go rename to vendor/github.com/syndtr/goleveldb/leveldb/options.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session.go b/vendor/github.com/syndtr/goleveldb/leveldb/session.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session.go rename to vendor/github.com/syndtr/goleveldb/leveldb/session.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session_compaction.go b/vendor/github.com/syndtr/goleveldb/leveldb/session_compaction.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session_compaction.go rename to vendor/github.com/syndtr/goleveldb/leveldb/session_compaction.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session_record.go b/vendor/github.com/syndtr/goleveldb/leveldb/session_record.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session_record.go rename to vendor/github.com/syndtr/goleveldb/leveldb/session_record.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session_util.go b/vendor/github.com/syndtr/goleveldb/leveldb/session_util.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session_util.go rename to vendor/github.com/syndtr/goleveldb/leveldb/session_util.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go rename to vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_nacl.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_nacl.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_nacl.go rename to vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_nacl.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_plan9.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_plan9.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_plan9.go rename to vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_plan9.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_solaris.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_solaris.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_solaris.go rename to vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_solaris.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go rename to vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_windows.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage_windows.go rename to vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_windows.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go rename to vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/storage.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/storage.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/storage.go rename to vendor/github.com/syndtr/goleveldb/leveldb/storage/storage.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table.go b/vendor/github.com/syndtr/goleveldb/leveldb/table.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table.go rename to vendor/github.com/syndtr/goleveldb/leveldb/table.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table/reader.go b/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table/reader.go rename to vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table/table.go b/vendor/github.com/syndtr/goleveldb/leveldb/table/table.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table/table.go rename to vendor/github.com/syndtr/goleveldb/leveldb/table/table.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table/writer.go b/vendor/github.com/syndtr/goleveldb/leveldb/table/writer.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/table/writer.go rename to vendor/github.com/syndtr/goleveldb/leveldb/table/writer.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util.go b/vendor/github.com/syndtr/goleveldb/leveldb/util.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util.go rename to vendor/github.com/syndtr/goleveldb/leveldb/util.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer.go b/vendor/github.com/syndtr/goleveldb/leveldb/util/buffer.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer.go rename to vendor/github.com/syndtr/goleveldb/leveldb/util/buffer.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go b/vendor/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go rename to vendor/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/crc32.go b/vendor/github.com/syndtr/goleveldb/leveldb/util/crc32.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/crc32.go rename to vendor/github.com/syndtr/goleveldb/leveldb/util/crc32.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/hash.go b/vendor/github.com/syndtr/goleveldb/leveldb/util/hash.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/hash.go rename to vendor/github.com/syndtr/goleveldb/leveldb/util/hash.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/range.go b/vendor/github.com/syndtr/goleveldb/leveldb/util/range.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/range.go rename to vendor/github.com/syndtr/goleveldb/leveldb/util/range.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/util.go b/vendor/github.com/syndtr/goleveldb/leveldb/util/util.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/util.go rename to vendor/github.com/syndtr/goleveldb/leveldb/util/util.go diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/version.go b/vendor/github.com/syndtr/goleveldb/leveldb/version.go similarity index 100% rename from Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/version.go rename to vendor/github.com/syndtr/goleveldb/leveldb/version.go diff --git a/vendor/golang.org/x/crypto/.gitattributes b/vendor/golang.org/x/crypto/.gitattributes new file mode 100644 index 0000000000..d2f212e5da --- /dev/null +++ b/vendor/golang.org/x/crypto/.gitattributes @@ -0,0 +1,10 @@ +# Treat all files in this repo as binary, with no git magic updating +# line endings. Windows users contributing to Go will need to use a +# modern version of git and editors capable of LF line endings. +# +# We'll prevent accidental CRLF line endings from entering the repo +# via the git-review gofmt checks. +# +# See golang.org/issue/9281 + +* -text diff --git a/vendor/golang.org/x/crypto/.gitignore b/vendor/golang.org/x/crypto/.gitignore new file mode 100644 index 0000000000..8339fd61d3 --- /dev/null +++ b/vendor/golang.org/x/crypto/.gitignore @@ -0,0 +1,2 @@ +# Add no patterns to .hgignore except for files generated by the build. +last-change diff --git a/vendor/golang.org/x/crypto/AUTHORS b/vendor/golang.org/x/crypto/AUTHORS new file mode 100644 index 0000000000..15167cd746 --- /dev/null +++ b/vendor/golang.org/x/crypto/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/crypto/CONTRIBUTING.md b/vendor/golang.org/x/crypto/CONTRIBUTING.md new file mode 100644 index 0000000000..88dff59bc7 --- /dev/null +++ b/vendor/golang.org/x/crypto/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing to Go + +Go is an open source project. + +It is the work of hundreds of contributors. We appreciate your help! + + +## Filing issues + +When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: + +1. What version of Go are you using (`go version`)? +2. What operating system and processor architecture are you using? +3. What did you do? +4. What did you expect to see? +5. What did you see instead? + +General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. +The gophers there will answer or ask you to file an issue if you've tripped over a bug. + +## Contributing code + +Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) +before sending patches. + +**We do not accept GitHub pull requests** +(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). + +Unless otherwise noted, the Go source files are distributed under +the BSD-style license found in the LICENSE file. + diff --git a/vendor/golang.org/x/crypto/CONTRIBUTORS b/vendor/golang.org/x/crypto/CONTRIBUTORS new file mode 100644 index 0000000000..1c4577e968 --- /dev/null +++ b/vendor/golang.org/x/crypto/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/Godeps/_workspace/src/golang.org/x/net/LICENSE b/vendor/golang.org/x/crypto/LICENSE similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/LICENSE rename to vendor/golang.org/x/crypto/LICENSE diff --git a/Godeps/_workspace/src/golang.org/x/crypto/PATENTS b/vendor/golang.org/x/crypto/PATENTS similarity index 100% rename from Godeps/_workspace/src/golang.org/x/crypto/PATENTS rename to vendor/golang.org/x/crypto/PATENTS diff --git a/vendor/golang.org/x/crypto/README b/vendor/golang.org/x/crypto/README new file mode 100644 index 0000000000..f1e0cbf94e --- /dev/null +++ b/vendor/golang.org/x/crypto/README @@ -0,0 +1,3 @@ +This repository holds supplementary Go cryptography libraries. + +To submit changes to this repository, see http://golang.org/doc/contribute.html. diff --git a/vendor/golang.org/x/crypto/codereview.cfg b/vendor/golang.org/x/crypto/codereview.cfg new file mode 100644 index 0000000000..3f8b14b64e --- /dev/null +++ b/vendor/golang.org/x/crypto/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/Godeps/_workspace/src/golang.org/x/crypto/pbkdf2/pbkdf2.go b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go similarity index 97% rename from Godeps/_workspace/src/golang.org/x/crypto/pbkdf2/pbkdf2.go rename to vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go index c02b4d5a70..593f653008 100644 --- a/Godeps/_workspace/src/golang.org/x/crypto/pbkdf2/pbkdf2.go +++ b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go @@ -16,7 +16,7 @@ Hash Functions SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 for HMAC. To choose, you can pass the `New` functions from the different SHA packages to pbkdf2.Key. */ -package pbkdf2 +package pbkdf2 // import "golang.org/x/crypto/pbkdf2" import ( "crypto/hmac" diff --git a/Godeps/_workspace/src/golang.org/x/crypto/ripemd160/ripemd160.go b/vendor/golang.org/x/crypto/ripemd160/ripemd160.go similarity index 97% rename from Godeps/_workspace/src/golang.org/x/crypto/ripemd160/ripemd160.go rename to vendor/golang.org/x/crypto/ripemd160/ripemd160.go index da690f0b92..6c6e84236a 100644 --- a/Godeps/_workspace/src/golang.org/x/crypto/ripemd160/ripemd160.go +++ b/vendor/golang.org/x/crypto/ripemd160/ripemd160.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package ripemd160 implements the RIPEMD-160 hash algorithm. -package ripemd160 +package ripemd160 // import "golang.org/x/crypto/ripemd160" // RIPEMD-160 is designed by by Hans Dobbertin, Antoon Bosselaers, and Bart // Preneel with specifications available at: diff --git a/Godeps/_workspace/src/golang.org/x/crypto/ripemd160/ripemd160block.go b/vendor/golang.org/x/crypto/ripemd160/ripemd160block.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/crypto/ripemd160/ripemd160block.go rename to vendor/golang.org/x/crypto/ripemd160/ripemd160block.go diff --git a/Godeps/_workspace/src/golang.org/x/crypto/scrypt/scrypt.go b/vendor/golang.org/x/crypto/scrypt/scrypt.go similarity index 97% rename from Godeps/_workspace/src/golang.org/x/crypto/scrypt/scrypt.go rename to vendor/golang.org/x/crypto/scrypt/scrypt.go index 30737b0a62..7455395cff 100644 --- a/Godeps/_workspace/src/golang.org/x/crypto/scrypt/scrypt.go +++ b/vendor/golang.org/x/crypto/scrypt/scrypt.go @@ -5,7 +5,7 @@ // Package scrypt implements the scrypt key derivation function as defined in // Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard // Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf). -package scrypt +package scrypt // import "golang.org/x/crypto/scrypt" import ( "crypto/sha256" @@ -218,7 +218,7 @@ func smix(b []byte, r, N int, v, xy []uint32) { // For example, you can get a derived key for e.g. AES-256 (which needs a // 32-byte key) by doing: // -// dk := scrypt.Key([]byte("some password"), salt, 16384, 8, 1, 32) +// dk, err := scrypt.Key([]byte("some password"), salt, 16384, 8, 1, 32) // // The recommended parameters for interactive logins as of 2009 are N=16384, // r=8, p=1. They should be increased as memory latency and CPU parallelism diff --git a/vendor/golang.org/x/net/.gitattributes b/vendor/golang.org/x/net/.gitattributes new file mode 100644 index 0000000000..d2f212e5da --- /dev/null +++ b/vendor/golang.org/x/net/.gitattributes @@ -0,0 +1,10 @@ +# Treat all files in this repo as binary, with no git magic updating +# line endings. Windows users contributing to Go will need to use a +# modern version of git and editors capable of LF line endings. +# +# We'll prevent accidental CRLF line endings from entering the repo +# via the git-review gofmt checks. +# +# See golang.org/issue/9281 + +* -text diff --git a/vendor/golang.org/x/net/.gitignore b/vendor/golang.org/x/net/.gitignore new file mode 100644 index 0000000000..8339fd61d3 --- /dev/null +++ b/vendor/golang.org/x/net/.gitignore @@ -0,0 +1,2 @@ +# Add no patterns to .hgignore except for files generated by the build. +last-change diff --git a/vendor/golang.org/x/net/AUTHORS b/vendor/golang.org/x/net/AUTHORS new file mode 100644 index 0000000000..15167cd746 --- /dev/null +++ b/vendor/golang.org/x/net/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/net/CONTRIBUTING.md b/vendor/golang.org/x/net/CONTRIBUTING.md new file mode 100644 index 0000000000..88dff59bc7 --- /dev/null +++ b/vendor/golang.org/x/net/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing to Go + +Go is an open source project. + +It is the work of hundreds of contributors. We appreciate your help! + + +## Filing issues + +When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: + +1. What version of Go are you using (`go version`)? +2. What operating system and processor architecture are you using? +3. What did you do? +4. What did you expect to see? +5. What did you see instead? + +General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. +The gophers there will answer or ask you to file an issue if you've tripped over a bug. + +## Contributing code + +Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) +before sending patches. + +**We do not accept GitHub pull requests** +(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). + +Unless otherwise noted, the Go source files are distributed under +the BSD-style license found in the LICENSE file. + diff --git a/vendor/golang.org/x/net/CONTRIBUTORS b/vendor/golang.org/x/net/CONTRIBUTORS new file mode 100644 index 0000000000..1c4577e968 --- /dev/null +++ b/vendor/golang.org/x/net/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/Godeps/_workspace/src/golang.org/x/sys/LICENSE b/vendor/golang.org/x/net/LICENSE similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/LICENSE rename to vendor/golang.org/x/net/LICENSE diff --git a/Godeps/_workspace/src/golang.org/x/net/PATENTS b/vendor/golang.org/x/net/PATENTS similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/PATENTS rename to vendor/golang.org/x/net/PATENTS diff --git a/vendor/golang.org/x/net/README b/vendor/golang.org/x/net/README new file mode 100644 index 0000000000..6b13d8e505 --- /dev/null +++ b/vendor/golang.org/x/net/README @@ -0,0 +1,3 @@ +This repository holds supplementary Go networking libraries. + +To submit changes to this repository, see http://golang.org/doc/contribute.html. diff --git a/vendor/golang.org/x/net/codereview.cfg b/vendor/golang.org/x/net/codereview.cfg new file mode 100644 index 0000000000..3f8b14b64e --- /dev/null +++ b/vendor/golang.org/x/net/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/atom/atom.go b/vendor/golang.org/x/net/html/atom/atom.go similarity index 97% rename from Godeps/_workspace/src/golang.org/x/net/html/atom/atom.go rename to vendor/golang.org/x/net/html/atom/atom.go index 227404bdaf..cd0a8ac154 100644 --- a/Godeps/_workspace/src/golang.org/x/net/html/atom/atom.go +++ b/vendor/golang.org/x/net/html/atom/atom.go @@ -15,7 +15,7 @@ // whether atom.H1 < atom.H2 may also change. The codes are not guaranteed to // be dense. The only guarantees are that e.g. looking up "div" will yield // atom.Div, calling atom.Div.String will return "div", and atom.Div != 0. -package atom +package atom // import "golang.org/x/net/html/atom" // Atom is an integer code for a string. The zero value maps to "". type Atom uint32 diff --git a/Godeps/_workspace/src/golang.org/x/net/html/atom/gen.go b/vendor/golang.org/x/net/html/atom/gen.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/atom/gen.go rename to vendor/golang.org/x/net/html/atom/gen.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/atom/table.go b/vendor/golang.org/x/net/html/atom/table.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/atom/table.go rename to vendor/golang.org/x/net/html/atom/table.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/charset/charset.go b/vendor/golang.org/x/net/html/charset/charset.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/net/html/charset/charset.go rename to vendor/golang.org/x/net/html/charset/charset.go index 449607253c..13bed1599f 100644 --- a/Godeps/_workspace/src/golang.org/x/net/html/charset/charset.go +++ b/vendor/golang.org/x/net/html/charset/charset.go @@ -6,7 +6,7 @@ // // The mapping from encoding labels to encodings is defined at // https://encoding.spec.whatwg.org/. -package charset +package charset // import "golang.org/x/net/html/charset" import ( "bytes" diff --git a/Godeps/_workspace/src/golang.org/x/net/html/const.go b/vendor/golang.org/x/net/html/const.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/const.go rename to vendor/golang.org/x/net/html/const.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/doc.go b/vendor/golang.org/x/net/html/doc.go similarity index 98% rename from Godeps/_workspace/src/golang.org/x/net/html/doc.go rename to vendor/golang.org/x/net/html/doc.go index b453fe1e4c..94f496874a 100644 --- a/Godeps/_workspace/src/golang.org/x/net/html/doc.go +++ b/vendor/golang.org/x/net/html/doc.go @@ -93,7 +93,7 @@ The relevant specifications include: https://html.spec.whatwg.org/multipage/syntax.html and https://html.spec.whatwg.org/multipage/syntax.html#tokenization */ -package html +package html // import "golang.org/x/net/html" // The tokenization algorithm implemented by this package is not a line-by-line // transliteration of the relatively verbose state-machine in the WHATWG diff --git a/Godeps/_workspace/src/golang.org/x/net/html/doctype.go b/vendor/golang.org/x/net/html/doctype.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/doctype.go rename to vendor/golang.org/x/net/html/doctype.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/entity.go b/vendor/golang.org/x/net/html/entity.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/entity.go rename to vendor/golang.org/x/net/html/entity.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/escape.go b/vendor/golang.org/x/net/html/escape.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/escape.go rename to vendor/golang.org/x/net/html/escape.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/foreign.go rename to vendor/golang.org/x/net/html/foreign.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/node.go b/vendor/golang.org/x/net/html/node.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/node.go rename to vendor/golang.org/x/net/html/node.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/parse.go rename to vendor/golang.org/x/net/html/parse.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/render.go b/vendor/golang.org/x/net/html/render.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/render.go rename to vendor/golang.org/x/net/html/render.go diff --git a/Godeps/_workspace/src/golang.org/x/net/html/token.go b/vendor/golang.org/x/net/html/token.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/html/token.go rename to vendor/golang.org/x/net/html/token.go diff --git a/Godeps/_workspace/src/golang.org/x/net/websocket/client.go b/vendor/golang.org/x/net/websocket/client.go similarity index 90% rename from Godeps/_workspace/src/golang.org/x/net/websocket/client.go rename to vendor/golang.org/x/net/websocket/client.go index 20d1e1e38e..69a4ac7eef 100644 --- a/Godeps/_workspace/src/golang.org/x/net/websocket/client.go +++ b/vendor/golang.org/x/net/websocket/client.go @@ -6,7 +6,6 @@ package websocket import ( "bufio" - "crypto/tls" "io" "net" "net/http" @@ -87,20 +86,14 @@ func DialConfig(config *Config) (ws *Conn, err error) { if config.Origin == nil { return nil, &DialError{config, ErrBadWebSocketOrigin} } - switch config.Location.Scheme { - case "ws": - client, err = net.Dial("tcp", parseAuthority(config.Location)) - - case "wss": - client, err = tls.Dial("tcp", parseAuthority(config.Location), config.TlsConfig) - - default: - err = ErrBadScheme + dialer := config.Dialer + if dialer == nil { + dialer = &net.Dialer{} } + client, err = dialWithDialer(dialer, config) if err != nil { goto Error } - ws, err = NewClient(config, client) if err != nil { client.Close() diff --git a/vendor/golang.org/x/net/websocket/dial.go b/vendor/golang.org/x/net/websocket/dial.go new file mode 100644 index 0000000000..2dab943a48 --- /dev/null +++ b/vendor/golang.org/x/net/websocket/dial.go @@ -0,0 +1,24 @@ +// Copyright 2015 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 websocket + +import ( + "crypto/tls" + "net" +) + +func dialWithDialer(dialer *net.Dialer, config *Config) (conn net.Conn, err error) { + switch config.Location.Scheme { + case "ws": + conn, err = dialer.Dial("tcp", parseAuthority(config.Location)) + + case "wss": + conn, err = tls.DialWithDialer(dialer, "tcp", parseAuthority(config.Location), config.TlsConfig) + + default: + err = ErrBadScheme + } + return +} diff --git a/Godeps/_workspace/src/golang.org/x/net/websocket/hybi.go b/vendor/golang.org/x/net/websocket/hybi.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/websocket/hybi.go rename to vendor/golang.org/x/net/websocket/hybi.go diff --git a/Godeps/_workspace/src/golang.org/x/net/websocket/server.go b/vendor/golang.org/x/net/websocket/server.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/net/websocket/server.go rename to vendor/golang.org/x/net/websocket/server.go diff --git a/Godeps/_workspace/src/golang.org/x/net/websocket/websocket.go b/vendor/golang.org/x/net/websocket/websocket.go similarity index 88% rename from Godeps/_workspace/src/golang.org/x/net/websocket/websocket.go rename to vendor/golang.org/x/net/websocket/websocket.go index 9f9b9a52da..a7731d9c97 100644 --- a/Godeps/_workspace/src/golang.org/x/net/websocket/websocket.go +++ b/vendor/golang.org/x/net/websocket/websocket.go @@ -4,7 +4,7 @@ // Package websocket implements a client and server for the WebSocket protocol // as specified in RFC 6455. -package websocket +package websocket // import "golang.org/x/net/websocket" import ( "bufio" @@ -32,6 +32,8 @@ const ( PingFrame = 9 PongFrame = 10 UnknownFrame = 255 + + DefaultMaxPayloadBytes = 32 << 20 // 32MB ) // ProtocolError represents WebSocket protocol errors. @@ -58,6 +60,10 @@ var ( ErrNotSupported = &ProtocolError{"not supported"} ) +// ErrFrameTooLarge is returned by Codec's Receive method if payload size +// exceeds limit set by Conn.MaxPayloadBytes +var ErrFrameTooLarge = errors.New("websocket: frame payload size exceeds limit") + // Addr is an implementation of net.Addr for WebSocket. type Addr struct { *url.URL @@ -86,6 +92,9 @@ type Config struct { // Additional header fields to be sent in WebSocket opening handshake. Header http.Header + // Dialer used when opening websocket connections. + Dialer *net.Dialer + handshakeData map[string]string } @@ -163,6 +172,10 @@ type Conn struct { frameHandler PayloadType byte defaultCloseStatus int + + // MaxPayloadBytes limits the size of frame payload received over Conn + // by Codec's Receive method. If zero, DefaultMaxPayloadBytes is used. + MaxPayloadBytes int } // Read implements the io.Reader interface: @@ -299,7 +312,12 @@ func (cd Codec) Send(ws *Conn, v interface{}) (err error) { return err } -// Receive receives single frame from ws, unmarshaled by cd.Unmarshal and stores in v. +// Receive receives single frame from ws, unmarshaled by cd.Unmarshal and stores +// in v. The whole frame payload is read to an in-memory buffer; max size of +// payload is defined by ws.MaxPayloadBytes. If frame payload size exceeds +// limit, ErrFrameTooLarge is returned; in this case frame is not read off wire +// completely. The next call to Receive would read and discard leftover data of +// previous oversized frame before processing next frame. func (cd Codec) Receive(ws *Conn, v interface{}) (err error) { ws.rio.Lock() defer ws.rio.Unlock() @@ -322,6 +340,19 @@ again: if frame == nil { goto again } + maxPayloadBytes := ws.MaxPayloadBytes + if maxPayloadBytes == 0 { + maxPayloadBytes = DefaultMaxPayloadBytes + } + if hf, ok := frame.(*hybiFrameReader); ok && hf.header.Length > int64(maxPayloadBytes) { + // payload size exceeds limit, no need to call Unmarshal + // + // set frameReader to current oversized frame so that + // the next call to this function can drain leftover + // data before processing the next frame + ws.frameReader = frame + return ErrFrameTooLarge + } payloadType := frame.PayloadType() data, err := ioutil.ReadAll(frame) if err != nil { diff --git a/vendor/golang.org/x/sys/.gitattributes b/vendor/golang.org/x/sys/.gitattributes new file mode 100644 index 0000000000..d2f212e5da --- /dev/null +++ b/vendor/golang.org/x/sys/.gitattributes @@ -0,0 +1,10 @@ +# Treat all files in this repo as binary, with no git magic updating +# line endings. Windows users contributing to Go will need to use a +# modern version of git and editors capable of LF line endings. +# +# We'll prevent accidental CRLF line endings from entering the repo +# via the git-review gofmt checks. +# +# See golang.org/issue/9281 + +* -text diff --git a/vendor/golang.org/x/sys/.gitignore b/vendor/golang.org/x/sys/.gitignore new file mode 100644 index 0000000000..8339fd61d3 --- /dev/null +++ b/vendor/golang.org/x/sys/.gitignore @@ -0,0 +1,2 @@ +# Add no patterns to .hgignore except for files generated by the build. +last-change diff --git a/vendor/golang.org/x/sys/AUTHORS b/vendor/golang.org/x/sys/AUTHORS new file mode 100644 index 0000000000..15167cd746 --- /dev/null +++ b/vendor/golang.org/x/sys/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/sys/CONTRIBUTING.md b/vendor/golang.org/x/sys/CONTRIBUTING.md new file mode 100644 index 0000000000..88dff59bc7 --- /dev/null +++ b/vendor/golang.org/x/sys/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing to Go + +Go is an open source project. + +It is the work of hundreds of contributors. We appreciate your help! + + +## Filing issues + +When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: + +1. What version of Go are you using (`go version`)? +2. What operating system and processor architecture are you using? +3. What did you do? +4. What did you expect to see? +5. What did you see instead? + +General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. +The gophers there will answer or ask you to file an issue if you've tripped over a bug. + +## Contributing code + +Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) +before sending patches. + +**We do not accept GitHub pull requests** +(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). + +Unless otherwise noted, the Go source files are distributed under +the BSD-style license found in the LICENSE file. + diff --git a/vendor/golang.org/x/sys/CONTRIBUTORS b/vendor/golang.org/x/sys/CONTRIBUTORS new file mode 100644 index 0000000000..1c4577e968 --- /dev/null +++ b/vendor/golang.org/x/sys/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/Godeps/_workspace/src/golang.org/x/text/LICENSE b/vendor/golang.org/x/sys/LICENSE similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/LICENSE rename to vendor/golang.org/x/sys/LICENSE diff --git a/Godeps/_workspace/src/golang.org/x/sys/PATENTS b/vendor/golang.org/x/sys/PATENTS similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/PATENTS rename to vendor/golang.org/x/sys/PATENTS diff --git a/vendor/golang.org/x/sys/README b/vendor/golang.org/x/sys/README new file mode 100644 index 0000000000..bd422b40c2 --- /dev/null +++ b/vendor/golang.org/x/sys/README @@ -0,0 +1,3 @@ +This repository holds supplemental Go packages for low-level interactions with the operating system. + +To submit changes to this repository, see http://golang.org/doc/contribute.html. diff --git a/vendor/golang.org/x/sys/codereview.cfg b/vendor/golang.org/x/sys/codereview.cfg new file mode 100644 index 0000000000..3f8b14b64e --- /dev/null +++ b/vendor/golang.org/x/sys/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/.gitignore b/vendor/golang.org/x/sys/unix/.gitignore similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/.gitignore rename to vendor/golang.org/x/sys/unix/.gitignore diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm.s b/vendor/golang.org/x/sys/unix/asm.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm.s rename to vendor/golang.org/x/sys/unix/asm.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_386.s b/vendor/golang.org/x/sys/unix/asm_darwin_386.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_386.s rename to vendor/golang.org/x/sys/unix/asm_darwin_386.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_amd64.s b/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_amd64.s rename to vendor/golang.org/x/sys/unix/asm_darwin_amd64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_arm.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_arm.s rename to vendor/golang.org/x/sys/unix/asm_darwin_arm.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_arm64.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_arm64.s rename to vendor/golang.org/x/sys/unix/asm_darwin_arm64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_dragonfly_amd64.s rename to vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_386.s b/vendor/golang.org/x/sys/unix/asm_freebsd_386.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_386.s rename to vendor/golang.org/x/sys/unix/asm_freebsd_386.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_amd64.s rename to vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_arm.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_arm.s rename to vendor/golang.org/x/sys/unix/asm_freebsd_arm.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_386.s rename to vendor/golang.org/x/sys/unix/asm_linux_386.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_amd64.s rename to vendor/golang.org/x/sys/unix/asm_linux_amd64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_arm.s rename to vendor/golang.org/x/sys/unix/asm_linux_arm.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_arm64.s rename to vendor/golang.org/x/sys/unix/asm_linux_arm64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_mips64x.s b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_mips64x.s rename to vendor/golang.org/x/sys/unix/asm_linux_mips64x.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_ppc64x.s rename to vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_s390x.s b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_s390x.s rename to vendor/golang.org/x/sys/unix/asm_linux_s390x.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_386.s b/vendor/golang.org/x/sys/unix/asm_netbsd_386.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_386.s rename to vendor/golang.org/x/sys/unix/asm_netbsd_386.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_amd64.s rename to vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_arm.s rename to vendor/golang.org/x/sys/unix/asm_netbsd_arm.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_openbsd_386.s b/vendor/golang.org/x/sys/unix/asm_openbsd_386.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_openbsd_386.s rename to vendor/golang.org/x/sys/unix/asm_openbsd_386.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_openbsd_amd64.s rename to vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/asm_solaris_amd64.s rename to vendor/golang.org/x/sys/unix/asm_solaris_amd64.s diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/bluetooth_linux.go b/vendor/golang.org/x/sys/unix/bluetooth_linux.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/bluetooth_linux.go rename to vendor/golang.org/x/sys/unix/bluetooth_linux.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/constants.go rename to vendor/golang.org/x/sys/unix/constants.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/env_unix.go rename to vendor/golang.org/x/sys/unix/env_unix.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/env_unset.go b/vendor/golang.org/x/sys/unix/env_unset.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/env_unset.go rename to vendor/golang.org/x/sys/unix/env_unset.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/flock.go b/vendor/golang.org/x/sys/unix/flock.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/flock.go rename to vendor/golang.org/x/sys/unix/flock.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/flock_linux_32bit.go b/vendor/golang.org/x/sys/unix/flock_linux_32bit.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/flock_linux_32bit.go rename to vendor/golang.org/x/sys/unix/flock_linux_32bit.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/gccgo.go rename to vendor/golang.org/x/sys/unix/gccgo.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/gccgo_c.c rename to vendor/golang.org/x/sys/unix/gccgo_c.c diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/gccgo_linux_amd64.go rename to vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go new file mode 100644 index 0000000000..56332692c4 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go @@ -0,0 +1,20 @@ +// Copyright 2016 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. + +// +build gccgo,linux,sparc64 + +package unix + +import "syscall" + +//extern sysconf +func realSysconf(name int) int64 + +func sysconf(name int) (n int64, err syscall.Errno) { + r := realSysconf(name) + if r < 0 { + return 0, syscall.GetErrno() + } + return r, 0 +} diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh similarity index 97% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mkall.sh rename to vendor/golang.org/x/sys/unix/mkall.sh index 3e224c57e2..2a1473f161 100755 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -223,6 +223,13 @@ linux_s390x) # package generates its version of the types file. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; +linux_sparc64) + GOOSARCH_in=syscall_linux_sparc64.go + unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h + mkerrors="$mkerrors -m64" + mksysnum="./mksysnum_linux.pl $unistd_h" + mktypes="GOARCH=$GOARCH go tool cgo -godefs" + ;; netbsd_386) mkerrors="$mkerrors -m32" mksyscall="./mksyscall.pl -l32 -netbsd" diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh similarity index 98% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mkerrors.sh rename to vendor/golang.org/x/sys/unix/mkerrors.sh index c40d788c4a..33b7922bdd 100755 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -127,6 +127,7 @@ includes_Linux=' #include #include #include +#include #include #include @@ -141,6 +142,12 @@ includes_Linux=' #ifndef PTRACE_SETREGS #define PTRACE_SETREGS 0xd #endif + +#ifdef SOL_BLUETOOTH +// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h +// but it is already in bluetooth_linux.go +#undef SOL_BLUETOOTH +#endif ' includes_NetBSD=' diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mkpost.go b/vendor/golang.org/x/sys/unix/mkpost.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mkpost.go rename to vendor/golang.org/x/sys/unix/mkpost.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksyscall.pl b/vendor/golang.org/x/sys/unix/mksyscall.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksyscall.pl rename to vendor/golang.org/x/sys/unix/mksyscall.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksyscall_solaris.pl b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksyscall_solaris.pl rename to vendor/golang.org/x/sys/unix/mksyscall_solaris.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksysctl_openbsd.pl b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksysctl_openbsd.pl rename to vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_darwin.pl b/vendor/golang.org/x/sys/unix/mksysnum_darwin.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_darwin.pl rename to vendor/golang.org/x/sys/unix/mksysnum_darwin.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_dragonfly.pl b/vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_dragonfly.pl rename to vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_freebsd.pl b/vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_freebsd.pl rename to vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_linux.pl b/vendor/golang.org/x/sys/unix/mksysnum_linux.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_linux.pl rename to vendor/golang.org/x/sys/unix/mksysnum_linux.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_netbsd.pl b/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_netbsd.pl rename to vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_openbsd.pl b/vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_openbsd.pl rename to vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/race.go b/vendor/golang.org/x/sys/unix/race.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/race.go rename to vendor/golang.org/x/sys/unix/race.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/race0.go b/vendor/golang.org/x/sys/unix/race0.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/race0.go rename to vendor/golang.org/x/sys/unix/race0.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/sockcmsg_linux.go b/vendor/golang.org/x/sys/unix/sockcmsg_linux.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/sockcmsg_linux.go rename to vendor/golang.org/x/sys/unix/sockcmsg_linux.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/sockcmsg_unix.go rename to vendor/golang.org/x/sys/unix/sockcmsg_unix.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/str.go b/vendor/golang.org/x/sys/unix/str.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/str.go rename to vendor/golang.org/x/sys/unix/str.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go similarity index 98% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall.go rename to vendor/golang.org/x/sys/unix/syscall.go index 571e6993c3..a0bcf842ca 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall.go +++ b/vendor/golang.org/x/sys/unix/syscall.go @@ -19,7 +19,7 @@ // These calls return err == nil to indicate success; otherwise // err represents an operating system error describing the failure and // holds a value of type syscall.Errno. -package unix +package unix // import "golang.org/x/sys/unix" import "unsafe" diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_bsd.go rename to vendor/golang.org/x/sys/unix/syscall_bsd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin.go rename to vendor/golang.org/x/sys/unix/syscall_darwin.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_386.go b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_386.go rename to vendor/golang.org/x/sys/unix/syscall_darwin_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_amd64.go rename to vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_arm.go rename to vendor/golang.org/x/sys/unix/syscall_darwin_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_arm64.go rename to vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_dragonfly.go rename to vendor/golang.org/x/sys/unix/syscall_dragonfly.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_dragonfly_amd64.go rename to vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd.go rename to vendor/golang.org/x/sys/unix/syscall_freebsd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_386.go rename to vendor/golang.org/x/sys/unix/syscall_freebsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_amd64.go rename to vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_arm.go rename to vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go similarity index 98% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux.go rename to vendor/golang.org/x/sys/unix/syscall_linux.go index 6d10c9cffa..cfac4a4409 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -69,10 +69,10 @@ func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error return ppoll(&fds[0], len(fds), timeout, sigmask) } -//sys readlinkat(dirfd int, path string, buf []byte) (n int, err error) +//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) func Readlink(path string, buf []byte) (n int, err error) { - return readlinkat(AT_FDCWD, path, buf) + return Readlinkat(AT_FDCWD, path, buf) } func Rename(oldpath string, newpath string) (err error) { @@ -80,24 +80,20 @@ func Rename(oldpath string, newpath string) (err error) { } func Rmdir(path string) error { - return unlinkat(AT_FDCWD, path, AT_REMOVEDIR) + return Unlinkat(AT_FDCWD, path, AT_REMOVEDIR) } -//sys symlinkat(oldpath string, newdirfd int, newpath string) (err error) +//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) func Symlink(oldpath string, newpath string) (err error) { - return symlinkat(oldpath, AT_FDCWD, newpath) + return Symlinkat(oldpath, AT_FDCWD, newpath) } func Unlink(path string) error { - return unlinkat(AT_FDCWD, path, 0) + return Unlinkat(AT_FDCWD, path, 0) } -//sys unlinkat(dirfd int, path string, flags int) (err error) - -func Unlinkat(dirfd int, path string, flags int) error { - return unlinkat(dirfd, path, flags) -} +//sys Unlinkat(dirfd int, path string, flags int) (err error) //sys utimes(path string, times *[2]Timeval) (err error) @@ -143,8 +139,7 @@ func UtimesNano(path string, ts []Timespec) error { // in 2.6.22, Released, 8 July 2007) then fall back to utimes var tv [2]Timeval for i := 0; i < 2; i++ { - tv[i].Sec = ts[i].Sec - tv[i].Usec = ts[i].Nsec / 1000 + tv[i] = NsecToTimeval(TimespecToNsec(ts[i])) } return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_386.go rename to vendor/golang.org/x/sys/unix/syscall_linux_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_amd64.go rename to vendor/golang.org/x/sys/unix/syscall_linux_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_arm.go rename to vendor/golang.org/x/sys/unix/syscall_linux_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_arm64.go rename to vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index 4b6ff2a80d..4a136396cd 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -6,8 +6,6 @@ package unix -const _SYS_dup = SYS_DUP3 - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go similarity index 94% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_mips64x.go rename to vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 440f54ee9c..8119fde376 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -7,13 +7,6 @@ package unix -// Linux introduced getdents64 syscall for N64 ABI only in 3.10 -// (May 21 2013, rev dec33abaafc89bcbd78f85fad0513170415a26d5), -// to support older kernels, we have to use getdents for mips64. -// Also note that struct dirent is different for these two. -// Lookup linux_dirent{,64} in kernel source code for details. -const _SYS_getdents = SYS_GETDENTS - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstatfs(fd int, buf *Statfs_t) (err error) diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_ppc64x.go rename to vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_linux_s390x.go rename to vendor/golang.org/x/sys/unix/syscall_linux_s390x.go diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go new file mode 100644 index 0000000000..20b7454d77 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -0,0 +1,169 @@ +// Copyright 2009 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. + +// +build sparc64,linux + +package unix + +import ( + "sync/atomic" + "syscall" +) + +//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) +//sys Dup2(oldfd int, newfd int) (err error) +//sys Fchown(fd int, uid int, gid int) (err error) +//sys Fstat(fd int, stat *Stat_t) (err error) +//sys Fstatfs(fd int, buf *Statfs_t) (err error) +//sys Ftruncate(fd int, length int64) (err error) +//sysnb Getegid() (egid int) +//sysnb Geteuid() (euid int) +//sysnb Getgid() (gid int) +//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) +//sysnb Getuid() (uid int) +//sysnb InotifyInit() (fd int, err error) +//sys Lchown(path string, uid int, gid int) (err error) +//sys Listen(s int, n int) (err error) +//sys Lstat(path string, stat *Stat_t) (err error) +//sys Pause() (err error) +//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 +//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK +//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) +//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) +//sys Setfsgid(gid int) (err error) +//sys Setfsuid(uid int) (err error) +//sysnb Setregid(rgid int, egid int) (err error) +//sysnb Setresgid(rgid int, egid int, sgid int) (err error) +//sysnb Setresuid(ruid int, euid int, suid int) (err error) +//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) +//sysnb Setreuid(ruid int, euid int) (err error) +//sys Shutdown(fd int, how int) (err error) +//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) +//sys Stat(path string, stat *Stat_t) (err error) +//sys Statfs(path string, buf *Statfs_t) (err error) +//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) +//sys Truncate(path string, length int64) (err error) +//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) +//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) +//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) +//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) +//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) +//sysnb setgroups(n int, list *_Gid_t) (err error) +//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) +//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) +//sysnb socket(domain int, typ int, proto int) (fd int, err error) +//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) +//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) +//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) +//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) +//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) +//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) +//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) +//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) + +func sysconf(name int) (n int64, err syscall.Errno) + +// pageSize caches the value of Getpagesize, since it can't change +// once the system is booted. +var pageSize int64 // accessed atomically + +func Getpagesize() int { + n := atomic.LoadInt64(&pageSize) + if n == 0 { + n, _ = sysconf(_SC_PAGESIZE) + atomic.StoreInt64(&pageSize, n) + } + return int(n) +} + +func Ioperm(from int, num int, on int) (err error) { + return ENOSYS +} + +func Iopl(level int) (err error) { + return ENOSYS +} + +//sysnb Gettimeofday(tv *Timeval) (err error) + +func Time(t *Time_t) (tt Time_t, err error) { + var tv Timeval + err = Gettimeofday(&tv) + if err != nil { + return 0, err + } + if t != nil { + *t = Time_t(tv.Sec) + } + return Time_t(tv.Sec), nil +} + +//sys Utime(path string, buf *Utimbuf) (err error) + +func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } + +func NsecToTimespec(nsec int64) (ts Timespec) { + ts.Sec = nsec / 1e9 + ts.Nsec = nsec % 1e9 + return +} + +func NsecToTimeval(nsec int64) (tv Timeval) { + nsec += 999 // round up to microsecond + tv.Sec = nsec / 1e9 + tv.Usec = int32(nsec % 1e9 / 1e3) + return +} + +func (r *PtraceRegs) PC() uint64 { return r.Tpc } + +func (r *PtraceRegs) SetPC(pc uint64) { r.Tpc = pc } + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint64(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint64(length) +} + +//sysnb pipe(p *[2]_C_int) (err error) + +func Pipe(p []int) (err error) { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err = pipe(&pp) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return +} + +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) (err error) { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err = pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return +} + +//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) + +func Poll(fds []PollFd, timeout int) (n int, err error) { + if len(fds) == 0 { + return poll(nil, 0, timeout) + } + return poll(&fds[0], len(fds), timeout) +} diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd.go rename to vendor/golang.org/x/sys/unix/syscall_netbsd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_386.go rename to vendor/golang.org/x/sys/unix/syscall_netbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_amd64.go rename to vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_arm.go rename to vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_no_getwd.go b/vendor/golang.org/x/sys/unix/syscall_no_getwd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_no_getwd.go rename to vendor/golang.org/x/sys/unix/syscall_no_getwd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_openbsd.go rename to vendor/golang.org/x/sys/unix/syscall_openbsd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_openbsd_386.go rename to vendor/golang.org/x/sys/unix/syscall_openbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_openbsd_amd64.go rename to vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go similarity index 96% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_solaris.go rename to vendor/golang.org/x/sys/unix/syscall_solaris.go index eb489b159f..acb74b1d15 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -72,18 +72,20 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, return origlen - len(buf), count, names } -func pipe() (r uintptr, w uintptr, err uintptr) +//sysnb pipe(p *[2]_C_int) (n int, err error) func Pipe(p []int) (err error) { if len(p) != 2 { return EINVAL } - r0, w0, e1 := pipe() - if e1 != 0 { - err = syscall.Errno(e1) + var pp [2]_C_int + n, err := pipe(&pp) + if n != 0 { + return err } - p[0], p[1] = int(r0), int(w0) - return + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return nil } func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { @@ -269,24 +271,34 @@ func (w WaitStatus) StopSignal() syscall.Signal { func (w WaitStatus) TrapCause() int { return -1 } -func wait4(pid uintptr, wstatus *WaitStatus, options uintptr, rusage *Rusage) (wpid uintptr, err uintptr) +//sys wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, err error) -func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { - r0, e1 := wait4(uintptr(pid), wstatus, uintptr(options), rusage) - if e1 != 0 { - err = syscall.Errno(e1) +func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (int, error) { + var status _C_int + rpid, err := wait4(int32(pid), &status, options, rusage) + wpid := int(rpid) + if wpid == -1 { + return wpid, err + } + if wstatus != nil { + *wstatus = WaitStatus(status) } - return int(r0), err + return wpid, nil } -func gethostname() (name string, err uintptr) +//sys gethostname(buf []byte) (n int, err error) func Gethostname() (name string, err error) { - name, e1 := gethostname() - if e1 != 0 { - err = syscall.Errno(e1) + var buf [MaxHostNameLen]byte + n, err := gethostname(buf[:]) + if n != 0 { + return "", err } - return name, err + n = clen(buf[:]) + if n < 1 { + return "", EFAULT + } + return string(buf[:n]), nil } //sys utimes(path string, times *[2]Timeval) (err error) diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_solaris_amd64.go rename to vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/syscall_unix.go rename to vendor/golang.org/x/sys/unix/syscall_unix.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/types_darwin.go b/vendor/golang.org/x/sys/unix/types_darwin.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/types_darwin.go rename to vendor/golang.org/x/sys/unix/types_darwin.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/types_dragonfly.go b/vendor/golang.org/x/sys/unix/types_dragonfly.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/types_dragonfly.go rename to vendor/golang.org/x/sys/unix/types_dragonfly.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/types_freebsd.go b/vendor/golang.org/x/sys/unix/types_freebsd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/types_freebsd.go rename to vendor/golang.org/x/sys/unix/types_freebsd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/types_linux.go b/vendor/golang.org/x/sys/unix/types_linux.go similarity index 98% rename from Godeps/_workspace/src/golang.org/x/sys/unix/types_linux.go rename to vendor/golang.org/x/sys/unix/types_linux.go index 7dea79a8ef..de80e2c8c0 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/types_linux.go +++ b/vendor/golang.org/x/sys/unix/types_linux.go @@ -105,6 +105,9 @@ typedef struct pt_regs PtraceRegs; typedef struct user PtraceRegs; #elif defined(__s390x__) typedef struct _user_regs_struct PtraceRegs; +#elif defined(__sparc__) +#include +typedef struct pt_regs PtraceRegs; #else typedef struct user_regs_struct PtraceRegs; #endif @@ -126,7 +129,7 @@ struct my_epoll_event { // padding is not specified in linux/eventpoll.h but added to conform to the // alignment requirements of EABI int32_t padFd; -#elif defined(__powerpc64__) || defined(__s390x__) +#elif defined(__powerpc64__) || defined(__s390x__) || defined(__sparc__) int32_t _padFd; #endif int32_t fd; @@ -445,6 +448,10 @@ const ( type Sigset_t C.sigset_t +// sysconf information + +const _SC_PAGESIZE = C._SC_PAGESIZE + // Terminal handling type Termios C.termios_t diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/types_netbsd.go b/vendor/golang.org/x/sys/unix/types_netbsd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/types_netbsd.go rename to vendor/golang.org/x/sys/unix/types_netbsd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/types_openbsd.go b/vendor/golang.org/x/sys/unix/types_openbsd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/types_openbsd.go rename to vendor/golang.org/x/sys/unix/types_openbsd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/types_solaris.go b/vendor/golang.org/x/sys/unix/types_solaris.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/types_solaris.go rename to vendor/golang.org/x/sys/unix/types_solaris.go index 6ad50eaba6..c5d5c8f16a 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/types_solaris.go +++ b/vendor/golang.org/x/sys/unix/types_solaris.go @@ -22,6 +22,7 @@ package unix #define __USE_LEGACY_PROTOTYPES__ // iovec #include #include +#include #include #include #include @@ -81,6 +82,7 @@ const ( sizeofLong = C.sizeof_long sizeofLongLong = C.sizeof_longlong PathMax = C.PATH_MAX + MaxHostNameLen = C.MAXHOSTNAMELEN ) // Basic types diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_darwin_386.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_darwin_386.go rename to vendor/golang.org/x/sys/unix/zerrors_darwin_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_darwin_amd64.go rename to vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_darwin_arm.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_darwin_arm.go rename to vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_darwin_arm64.go rename to vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go rename to vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_freebsd_386.go rename to vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_freebsd_amd64.go rename to vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_freebsd_arm.go rename to vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_386.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_amd64.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_arm.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_arm64.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_mips64.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_mips64le.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_ppc64.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_ppc64le.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_linux_s390x.go rename to vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go new file mode 100644 index 0000000000..766d1e6128 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -0,0 +1,2077 @@ +// mkerrors.sh -m64 +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + +// +build sparc64,linux + +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs -- -m64 _const.go + +package unix + +import "syscall" + +const ( + AF_ALG = 0x26 + AF_APPLETALK = 0x5 + AF_ASH = 0x12 + AF_ATMPVC = 0x8 + AF_ATMSVC = 0x14 + AF_AX25 = 0x3 + AF_BLUETOOTH = 0x1f + AF_BRIDGE = 0x7 + AF_CAIF = 0x25 + AF_CAN = 0x1d + AF_DECnet = 0xc + AF_ECONET = 0x13 + AF_FILE = 0x1 + AF_IB = 0x1b + AF_IEEE802154 = 0x24 + AF_INET = 0x2 + AF_INET6 = 0xa + AF_IPX = 0x4 + AF_IRDA = 0x17 + AF_ISDN = 0x22 + AF_IUCV = 0x20 + AF_KCM = 0x29 + AF_KEY = 0xf + AF_LLC = 0x1a + AF_LOCAL = 0x1 + AF_MAX = 0x2a + AF_MPLS = 0x1c + AF_NETBEUI = 0xd + AF_NETLINK = 0x10 + AF_NETROM = 0x6 + AF_NFC = 0x27 + AF_PACKET = 0x11 + AF_PHONET = 0x23 + AF_PPPOX = 0x18 + AF_RDS = 0x15 + AF_ROSE = 0xb + AF_ROUTE = 0x10 + AF_RXRPC = 0x21 + AF_SECURITY = 0xe + AF_SNA = 0x16 + AF_TIPC = 0x1e + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + AF_VSOCK = 0x28 + AF_WANPIPE = 0x19 + AF_X25 = 0x9 + ARPHRD_6LOWPAN = 0x339 + ARPHRD_ADAPT = 0x108 + ARPHRD_APPLETLK = 0x8 + ARPHRD_ARCNET = 0x7 + ARPHRD_ASH = 0x30d + ARPHRD_ATM = 0x13 + ARPHRD_AX25 = 0x3 + ARPHRD_BIF = 0x307 + ARPHRD_CAIF = 0x336 + ARPHRD_CAN = 0x118 + ARPHRD_CHAOS = 0x5 + ARPHRD_CISCO = 0x201 + ARPHRD_CSLIP = 0x101 + ARPHRD_CSLIP6 = 0x103 + ARPHRD_DDCMP = 0x205 + ARPHRD_DLCI = 0xf + ARPHRD_ECONET = 0x30e + ARPHRD_EETHER = 0x2 + ARPHRD_ETHER = 0x1 + ARPHRD_EUI64 = 0x1b + ARPHRD_FCAL = 0x311 + ARPHRD_FCFABRIC = 0x313 + ARPHRD_FCPL = 0x312 + ARPHRD_FCPP = 0x310 + ARPHRD_FDDI = 0x306 + ARPHRD_FRAD = 0x302 + ARPHRD_HDLC = 0x201 + ARPHRD_HIPPI = 0x30c + ARPHRD_HWX25 = 0x110 + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + ARPHRD_IEEE80211 = 0x321 + ARPHRD_IEEE80211_PRISM = 0x322 + ARPHRD_IEEE80211_RADIOTAP = 0x323 + ARPHRD_IEEE802154 = 0x324 + ARPHRD_IEEE802154_MONITOR = 0x325 + ARPHRD_IEEE802_TR = 0x320 + ARPHRD_INFINIBAND = 0x20 + ARPHRD_IP6GRE = 0x337 + ARPHRD_IPDDP = 0x309 + ARPHRD_IPGRE = 0x30a + ARPHRD_IRDA = 0x30f + ARPHRD_LAPB = 0x204 + ARPHRD_LOCALTLK = 0x305 + ARPHRD_LOOPBACK = 0x304 + ARPHRD_METRICOM = 0x17 + ARPHRD_NETLINK = 0x338 + ARPHRD_NETROM = 0x0 + ARPHRD_NONE = 0xfffe + ARPHRD_PHONET = 0x334 + ARPHRD_PHONET_PIPE = 0x335 + ARPHRD_PIMREG = 0x30b + ARPHRD_PPP = 0x200 + ARPHRD_PRONET = 0x4 + ARPHRD_RAWHDLC = 0x206 + ARPHRD_ROSE = 0x10e + ARPHRD_RSRVD = 0x104 + ARPHRD_SIT = 0x308 + ARPHRD_SKIP = 0x303 + ARPHRD_SLIP = 0x100 + ARPHRD_SLIP6 = 0x102 + ARPHRD_TUNNEL = 0x300 + ARPHRD_TUNNEL6 = 0x301 + ARPHRD_VOID = 0xffff + ARPHRD_X25 = 0x10f + ASI_LEON_DFLUSH = 0x11 + ASI_LEON_IFLUSH = 0x10 + ASI_LEON_MMUFLUSH = 0x18 + B0 = 0x0 + B1000000 = 0x100c + B110 = 0x3 + B115200 = 0x1002 + B1152000 = 0x100d + B1200 = 0x9 + B134 = 0x4 + B150 = 0x5 + B1500000 = 0x100e + B153600 = 0x1006 + B1800 = 0xa + B19200 = 0xe + B200 = 0x6 + B2000000 = 0x100f + B230400 = 0x1003 + B2400 = 0xb + B300 = 0x7 + B307200 = 0x1007 + B38400 = 0xf + B460800 = 0x1004 + B4800 = 0xc + B50 = 0x1 + B500000 = 0x100a + B57600 = 0x1001 + B576000 = 0x100b + B600 = 0x8 + B614400 = 0x1008 + B75 = 0x2 + B76800 = 0x1005 + B921600 = 0x1009 + B9600 = 0xd + BOTHER = 0x1000 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LL_OFF = -0x200000 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXINSNS = 0x1000 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MOD = 0x90 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_NET_OFF = -0x100000 + BPF_OR = 0x40 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BPF_XOR = 0xa0 + BRKINT = 0x2 + BS0 = 0x0 + BS1 = 0x2000 + BSDLY = 0x2000 + CBAUD = 0x100f + CBAUDEX = 0x1000 + CFLUSH = 0xf + CIBAUD = 0x100f0000 + CLOCAL = 0x800 + CLOCK_BOOTTIME = 0x7 + CLOCK_BOOTTIME_ALARM = 0x9 + CLOCK_DEFAULT = 0x0 + CLOCK_EXT = 0x1 + CLOCK_INT = 0x2 + CLOCK_MONOTONIC = 0x1 + CLOCK_MONOTONIC_COARSE = 0x6 + CLOCK_MONOTONIC_RAW = 0x4 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_REALTIME_ALARM = 0x8 + CLOCK_REALTIME_COARSE = 0x5 + CLOCK_TAI = 0xb + CLOCK_THREAD_CPUTIME_ID = 0x3 + CLOCK_TXFROMRX = 0x4 + CLOCK_TXINT = 0x3 + CLONE_CHILD_CLEARTID = 0x200000 + CLONE_CHILD_SETTID = 0x1000000 + CLONE_DETACHED = 0x400000 + CLONE_FILES = 0x400 + CLONE_FS = 0x200 + CLONE_IO = 0x80000000 + CLONE_NEWCGROUP = 0x2000000 + CLONE_NEWIPC = 0x8000000 + CLONE_NEWNET = 0x40000000 + CLONE_NEWNS = 0x20000 + CLONE_NEWPID = 0x20000000 + CLONE_NEWUSER = 0x10000000 + CLONE_NEWUTS = 0x4000000 + CLONE_PARENT = 0x8000 + CLONE_PARENT_SETTID = 0x100000 + CLONE_PTRACE = 0x2000 + CLONE_SETTLS = 0x80000 + CLONE_SIGHAND = 0x800 + CLONE_SYSVSEM = 0x40000 + CLONE_THREAD = 0x10000 + CLONE_UNTRACED = 0x800000 + CLONE_VFORK = 0x4000 + CLONE_VM = 0x100 + CMSPAR = 0x40000000 + CR0 = 0x0 + CR1 = 0x200 + CR2 = 0x400 + CR3 = 0x600 + CRDLY = 0x600 + CREAD = 0x80 + CRTSCTS = 0x80000000 + CS5 = 0x0 + CS6 = 0x10 + CS7 = 0x20 + CS8 = 0x30 + CSIGNAL = 0xff + CSIZE = 0x30 + CSTART = 0x11 + CSTATUS = 0x0 + CSTOP = 0x13 + CSTOPB = 0x40 + CSUSP = 0x1a + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x200 + ECHOE = 0x10 + ECHOK = 0x20 + ECHOKE = 0x800 + ECHONL = 0x40 + ECHOPRT = 0x400 + EMT_TAGOVF = 0x1 + ENCODING_DEFAULT = 0x0 + ENCODING_FM_MARK = 0x3 + ENCODING_FM_SPACE = 0x4 + ENCODING_MANCHESTER = 0x5 + ENCODING_NRZ = 0x1 + ENCODING_NRZI = 0x2 + EPOLLERR = 0x8 + EPOLLET = 0x80000000 + EPOLLEXCLUSIVE = 0x10000000 + EPOLLHUP = 0x10 + EPOLLIN = 0x1 + EPOLLMSG = 0x400 + EPOLLONESHOT = 0x40000000 + EPOLLOUT = 0x4 + EPOLLPRI = 0x2 + EPOLLRDBAND = 0x80 + EPOLLRDHUP = 0x2000 + EPOLLRDNORM = 0x40 + EPOLLWAKEUP = 0x20000000 + EPOLLWRBAND = 0x200 + EPOLLWRNORM = 0x100 + EPOLL_CLOEXEC = 0x400000 + EPOLL_CTL_ADD = 0x1 + EPOLL_CTL_DEL = 0x2 + EPOLL_CTL_MOD = 0x3 + ETH_P_1588 = 0x88f7 + ETH_P_8021AD = 0x88a8 + ETH_P_8021AH = 0x88e7 + ETH_P_8021Q = 0x8100 + ETH_P_80221 = 0x8917 + ETH_P_802_2 = 0x4 + ETH_P_802_3 = 0x1 + ETH_P_802_3_MIN = 0x600 + ETH_P_802_EX1 = 0x88b5 + ETH_P_AARP = 0x80f3 + ETH_P_AF_IUCV = 0xfbfb + ETH_P_ALL = 0x3 + ETH_P_AOE = 0x88a2 + ETH_P_ARCNET = 0x1a + ETH_P_ARP = 0x806 + ETH_P_ATALK = 0x809b + ETH_P_ATMFATE = 0x8884 + ETH_P_ATMMPOA = 0x884c + ETH_P_AX25 = 0x2 + ETH_P_BATMAN = 0x4305 + ETH_P_BPQ = 0x8ff + ETH_P_CAIF = 0xf7 + ETH_P_CAN = 0xc + ETH_P_CANFD = 0xd + ETH_P_CONTROL = 0x16 + ETH_P_CUST = 0x6006 + ETH_P_DDCMP = 0x6 + ETH_P_DEC = 0x6000 + ETH_P_DIAG = 0x6005 + ETH_P_DNA_DL = 0x6001 + ETH_P_DNA_RC = 0x6002 + ETH_P_DNA_RT = 0x6003 + ETH_P_DSA = 0x1b + ETH_P_ECONET = 0x18 + ETH_P_EDSA = 0xdada + ETH_P_FCOE = 0x8906 + ETH_P_FIP = 0x8914 + ETH_P_HDLC = 0x19 + ETH_P_HSR = 0x892f + ETH_P_IEEE802154 = 0xf6 + ETH_P_IEEEPUP = 0xa00 + ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IP = 0x800 + ETH_P_IPV6 = 0x86dd + ETH_P_IPX = 0x8137 + ETH_P_IRDA = 0x17 + ETH_P_LAT = 0x6004 + ETH_P_LINK_CTL = 0x886c + ETH_P_LOCALTALK = 0x9 + ETH_P_LOOP = 0x60 + ETH_P_LOOPBACK = 0x9000 + ETH_P_MACSEC = 0x88e5 + ETH_P_MOBITEX = 0x15 + ETH_P_MPLS_MC = 0x8848 + ETH_P_MPLS_UC = 0x8847 + ETH_P_MVRP = 0x88f5 + ETH_P_PAE = 0x888e + ETH_P_PAUSE = 0x8808 + ETH_P_PHONET = 0xf5 + ETH_P_PPPTALK = 0x10 + ETH_P_PPP_DISC = 0x8863 + ETH_P_PPP_MP = 0x8 + ETH_P_PPP_SES = 0x8864 + ETH_P_PRP = 0x88fb + ETH_P_PUP = 0x200 + ETH_P_PUPAT = 0x201 + ETH_P_QINQ1 = 0x9100 + ETH_P_QINQ2 = 0x9200 + ETH_P_QINQ3 = 0x9300 + ETH_P_RARP = 0x8035 + ETH_P_SCA = 0x6007 + ETH_P_SLOW = 0x8809 + ETH_P_SNAP = 0x5 + ETH_P_TDLS = 0x890d + ETH_P_TEB = 0x6558 + ETH_P_TIPC = 0x88ca + ETH_P_TRAILER = 0x1c + ETH_P_TR_802_2 = 0x11 + ETH_P_TSN = 0x22f0 + ETH_P_WAN_PPP = 0x7 + ETH_P_WCCP = 0x883e + ETH_P_X25 = 0x805 + ETH_P_XDSA = 0xf8 + EXTA = 0xe + EXTB = 0xf + EXTPROC = 0x10000 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FF0 = 0x0 + FF1 = 0x8000 + FFDLY = 0x8000 + FLUSHO = 0x2000 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0x406 + F_EXLCK = 0x4 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLEASE = 0x401 + F_GETLK = 0x7 + F_GETLK64 = 0x7 + F_GETOWN = 0x5 + F_GETOWN_EX = 0x10 + F_GETPIPE_SZ = 0x408 + F_GETSIG = 0xb + F_LOCK = 0x1 + F_NOTIFY = 0x402 + F_OFD_GETLK = 0x24 + F_OFD_SETLK = 0x25 + F_OFD_SETLKW = 0x26 + F_OK = 0x0 + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLEASE = 0x400 + F_SETLK = 0x8 + F_SETLK64 = 0x8 + F_SETLKW = 0x9 + F_SETLKW64 = 0x9 + F_SETOWN = 0x6 + F_SETOWN_EX = 0xf + F_SETPIPE_SZ = 0x407 + F_SETSIG = 0xa + F_SHLCK = 0x8 + F_TEST = 0x3 + F_TLOCK = 0x2 + F_ULOCK = 0x0 + F_UNLCK = 0x3 + F_WRLCK = 0x2 + HUPCL = 0x400 + IBSHIFT = 0x10 + ICANON = 0x2 + ICMPV6_FILTER = 0x1 + ICRNL = 0x100 + IEXTEN = 0x8000 + IFA_F_DADFAILED = 0x8 + IFA_F_DEPRECATED = 0x20 + IFA_F_HOMEADDRESS = 0x10 + IFA_F_MANAGETEMPADDR = 0x100 + IFA_F_MCAUTOJOIN = 0x400 + IFA_F_NODAD = 0x2 + IFA_F_NOPREFIXROUTE = 0x200 + IFA_F_OPTIMISTIC = 0x4 + IFA_F_PERMANENT = 0x80 + IFA_F_SECONDARY = 0x1 + IFA_F_STABLE_PRIVACY = 0x800 + IFA_F_TEMPORARY = 0x1 + IFA_F_TENTATIVE = 0x40 + IFA_MAX = 0x8 + IFF_ALLMULTI = 0x200 + IFF_ATTACH_QUEUE = 0x200 + IFF_AUTOMEDIA = 0x4000 + IFF_BROADCAST = 0x2 + IFF_DEBUG = 0x4 + IFF_DETACH_QUEUE = 0x400 + IFF_DORMANT = 0x20000 + IFF_DYNAMIC = 0x8000 + IFF_ECHO = 0x40000 + IFF_LOOPBACK = 0x8 + IFF_LOWER_UP = 0x10000 + IFF_MASTER = 0x400 + IFF_MULTICAST = 0x1000 + IFF_MULTI_QUEUE = 0x100 + IFF_NOARP = 0x80 + IFF_NOFILTER = 0x1000 + IFF_NOTRAILERS = 0x20 + IFF_NO_PI = 0x1000 + IFF_ONE_QUEUE = 0x2000 + IFF_PERSIST = 0x800 + IFF_POINTOPOINT = 0x10 + IFF_PORTSEL = 0x2000 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SLAVE = 0x800 + IFF_TAP = 0x2 + IFF_TUN = 0x1 + IFF_TUN_EXCL = 0x8000 + IFF_UP = 0x1 + IFF_VNET_HDR = 0x4000 + IFF_VOLATILE = 0x70c5a + IFNAMSIZ = 0x10 + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_ACCESS = 0x1 + IN_ALL_EVENTS = 0xfff + IN_ATTRIB = 0x4 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLOEXEC = 0x400000 + IN_CLOSE = 0x18 + IN_CLOSE_NOWRITE = 0x10 + IN_CLOSE_WRITE = 0x8 + IN_CREATE = 0x100 + IN_DELETE = 0x200 + IN_DELETE_SELF = 0x400 + IN_DONT_FOLLOW = 0x2000000 + IN_EXCL_UNLINK = 0x4000000 + IN_IGNORED = 0x8000 + IN_ISDIR = 0x40000000 + IN_LOOPBACKNET = 0x7f + IN_MASK_ADD = 0x20000000 + IN_MODIFY = 0x2 + IN_MOVE = 0xc0 + IN_MOVED_FROM = 0x40 + IN_MOVED_TO = 0x80 + IN_MOVE_SELF = 0x800 + IN_NONBLOCK = 0x4000 + IN_ONESHOT = 0x80000000 + IN_ONLYDIR = 0x1000000 + IN_OPEN = 0x20 + IN_Q_OVERFLOW = 0x4000 + IN_UNMOUNT = 0x2000 + IPPROTO_AH = 0x33 + IPPROTO_BEETPH = 0x5e + IPPROTO_COMP = 0x6c + IPPROTO_DCCP = 0x21 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_ESP = 0x32 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPIP = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_MH = 0x87 + IPPROTO_MPLS = 0x89 + IPPROTO_MTP = 0x5c + IPPROTO_NONE = 0x3b + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 + IPV6_2292DSTOPTS = 0x4 + IPV6_2292HOPLIMIT = 0x8 + IPV6_2292HOPOPTS = 0x3 + IPV6_2292PKTINFO = 0x2 + IPV6_2292PKTOPTIONS = 0x6 + IPV6_2292RTHDR = 0x5 + IPV6_ADDRFORM = 0x1 + IPV6_ADD_MEMBERSHIP = 0x14 + IPV6_AUTHHDR = 0xa + IPV6_CHECKSUM = 0x7 + IPV6_DONTFRAG = 0x3e + IPV6_DROP_MEMBERSHIP = 0x15 + IPV6_DSTOPTS = 0x3b + IPV6_HDRINCL = 0x24 + IPV6_HOPLIMIT = 0x34 + IPV6_HOPOPTS = 0x36 + IPV6_IPSEC_POLICY = 0x22 + IPV6_JOIN_ANYCAST = 0x1b + IPV6_JOIN_GROUP = 0x14 + IPV6_LEAVE_ANYCAST = 0x1c + IPV6_LEAVE_GROUP = 0x15 + IPV6_MTU = 0x18 + IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_HOPS = 0x12 + IPV6_MULTICAST_IF = 0x11 + IPV6_MULTICAST_LOOP = 0x13 + IPV6_NEXTHOP = 0x9 + IPV6_PATHMTU = 0x3d + IPV6_PKTINFO = 0x32 + IPV6_PMTUDISC_DO = 0x2 + IPV6_PMTUDISC_DONT = 0x0 + IPV6_PMTUDISC_INTERFACE = 0x4 + IPV6_PMTUDISC_OMIT = 0x5 + IPV6_PMTUDISC_PROBE = 0x3 + IPV6_PMTUDISC_WANT = 0x1 + IPV6_RECVDSTOPTS = 0x3a + IPV6_RECVERR = 0x19 + IPV6_RECVHOPLIMIT = 0x33 + IPV6_RECVHOPOPTS = 0x35 + IPV6_RECVPATHMTU = 0x3c + IPV6_RECVPKTINFO = 0x31 + IPV6_RECVRTHDR = 0x38 + IPV6_RECVTCLASS = 0x42 + IPV6_ROUTER_ALERT = 0x16 + IPV6_RTHDR = 0x39 + IPV6_RTHDRDSTOPTS = 0x37 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_RXDSTOPTS = 0x3b + IPV6_RXHOPOPTS = 0x36 + IPV6_TCLASS = 0x43 + IPV6_UNICAST_HOPS = 0x10 + IPV6_V6ONLY = 0x1a + IPV6_XFRM_POLICY = 0x23 + IP_ADD_MEMBERSHIP = 0x23 + IP_ADD_SOURCE_MEMBERSHIP = 0x27 + IP_BIND_ADDRESS_NO_PORT = 0x18 + IP_BLOCK_SOURCE = 0x26 + IP_CHECKSUM = 0x17 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0x24 + IP_DROP_SOURCE_MEMBERSHIP = 0x28 + IP_FREEBIND = 0xf + IP_HDRINCL = 0x3 + IP_IPSEC_POLICY = 0x10 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0x14 + IP_MF = 0x2000 + IP_MINTTL = 0x15 + IP_MSFILTER = 0x29 + IP_MSS = 0x240 + IP_MTU = 0xe + IP_MTU_DISCOVER = 0xa + IP_MULTICAST_ALL = 0x31 + IP_MULTICAST_IF = 0x20 + IP_MULTICAST_LOOP = 0x22 + IP_MULTICAST_TTL = 0x21 + IP_NODEFRAG = 0x16 + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x4 + IP_ORIGDSTADDR = 0x14 + IP_PASSSEC = 0x12 + IP_PKTINFO = 0x8 + IP_PKTOPTIONS = 0x9 + IP_PMTUDISC = 0xa + IP_PMTUDISC_DO = 0x2 + IP_PMTUDISC_DONT = 0x0 + IP_PMTUDISC_INTERFACE = 0x4 + IP_PMTUDISC_OMIT = 0x5 + IP_PMTUDISC_PROBE = 0x3 + IP_PMTUDISC_WANT = 0x1 + IP_RECVERR = 0xb + IP_RECVOPTS = 0x6 + IP_RECVORIGDSTADDR = 0x14 + IP_RECVRETOPTS = 0x7 + IP_RECVTOS = 0xd + IP_RECVTTL = 0xc + IP_RETOPTS = 0x7 + IP_RF = 0x8000 + IP_ROUTER_ALERT = 0x5 + IP_TOS = 0x1 + IP_TRANSPARENT = 0x13 + IP_TTL = 0x2 + IP_UNBLOCK_SOURCE = 0x25 + IP_UNICAST_IF = 0x32 + IP_XFRM_POLICY = 0x11 + ISIG = 0x1 + ISTRIP = 0x20 + IUCLC = 0x200 + IUTF8 = 0x4000 + IXANY = 0x800 + IXOFF = 0x1000 + IXON = 0x400 + LINUX_REBOOT_CMD_CAD_OFF = 0x0 + LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef + LINUX_REBOOT_CMD_HALT = 0xcdef0123 + LINUX_REBOOT_CMD_KEXEC = 0x45584543 + LINUX_REBOOT_CMD_POWER_OFF = 0x4321fedc + LINUX_REBOOT_CMD_RESTART = 0x1234567 + LINUX_REBOOT_CMD_RESTART2 = 0xa1b2c3d4 + LINUX_REBOOT_CMD_SW_SUSPEND = 0xd000fce2 + LINUX_REBOOT_MAGIC1 = 0xfee1dead + LINUX_REBOOT_MAGIC2 = 0x28121969 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DODUMP = 0x11 + MADV_DOFORK = 0xb + MADV_DONTDUMP = 0x10 + MADV_DONTFORK = 0xa + MADV_DONTNEED = 0x4 + MADV_FREE = 0x8 + MADV_HUGEPAGE = 0xe + MADV_HWPOISON = 0x64 + MADV_MERGEABLE = 0xc + MADV_NOHUGEPAGE = 0xf + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_REMOVE = 0x9 + MADV_SEQUENTIAL = 0x2 + MADV_UNMERGEABLE = 0xd + MADV_WILLNEED = 0x3 + MAP_ANON = 0x20 + MAP_ANONYMOUS = 0x20 + MAP_DENYWRITE = 0x800 + MAP_EXECUTABLE = 0x1000 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_GROWSDOWN = 0x200 + MAP_HUGETLB = 0x40000 + MAP_HUGE_MASK = 0x3f + MAP_HUGE_SHIFT = 0x1a + MAP_LOCKED = 0x100 + MAP_NONBLOCK = 0x10000 + MAP_NORESERVE = 0x40 + MAP_POPULATE = 0x8000 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x20 + MAP_SHARED = 0x1 + MAP_STACK = 0x20000 + MAP_TYPE = 0xf + MCL_CURRENT = 0x2000 + MCL_FUTURE = 0x4000 + MCL_ONFAULT = 0x8000 + MNT_DETACH = 0x2 + MNT_EXPIRE = 0x4 + MNT_FORCE = 0x1 + MSG_BATCH = 0x40000 + MSG_CMSG_CLOEXEC = 0x40000000 + MSG_CONFIRM = 0x800 + MSG_CTRUNC = 0x8 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x40 + MSG_EOR = 0x80 + MSG_ERRQUEUE = 0x2000 + MSG_FASTOPEN = 0x20000000 + MSG_FIN = 0x200 + MSG_MORE = 0x8000 + MSG_NOSIGNAL = 0x4000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_PROXY = 0x10 + MSG_RST = 0x1000 + MSG_SYN = 0x400 + MSG_TRUNC = 0x20 + MSG_TRYHARD = 0x4 + MSG_WAITALL = 0x100 + MSG_WAITFORONE = 0x10000 + MS_ACTIVE = 0x40000000 + MS_ASYNC = 0x1 + MS_BIND = 0x1000 + MS_DIRSYNC = 0x80 + MS_INVALIDATE = 0x2 + MS_I_VERSION = 0x800000 + MS_KERNMOUNT = 0x400000 + MS_LAZYTIME = 0x2000000 + MS_MANDLOCK = 0x40 + MS_MGC_MSK = 0xffff0000 + MS_MGC_VAL = 0xc0ed0000 + MS_MOVE = 0x2000 + MS_NOATIME = 0x400 + MS_NODEV = 0x4 + MS_NODIRATIME = 0x800 + MS_NOEXEC = 0x8 + MS_NOSUID = 0x2 + MS_NOUSER = -0x80000000 + MS_POSIXACL = 0x10000 + MS_PRIVATE = 0x40000 + MS_RDONLY = 0x1 + MS_REC = 0x4000 + MS_RELATIME = 0x200000 + MS_REMOUNT = 0x20 + MS_RMT_MASK = 0x2800051 + MS_SHARED = 0x100000 + MS_SILENT = 0x8000 + MS_SLAVE = 0x80000 + MS_STRICTATIME = 0x1000000 + MS_SYNC = 0x4 + MS_SYNCHRONOUS = 0x10 + MS_UNBINDABLE = 0x20000 + NAME_MAX = 0xff + NETLINK_ADD_MEMBERSHIP = 0x1 + NETLINK_AUDIT = 0x9 + NETLINK_BROADCAST_ERROR = 0x4 + NETLINK_CAP_ACK = 0xa + NETLINK_CONNECTOR = 0xb + NETLINK_CRYPTO = 0x15 + NETLINK_DNRTMSG = 0xe + NETLINK_DROP_MEMBERSHIP = 0x2 + NETLINK_ECRYPTFS = 0x13 + NETLINK_FIB_LOOKUP = 0xa + NETLINK_FIREWALL = 0x3 + NETLINK_GENERIC = 0x10 + NETLINK_INET_DIAG = 0x4 + NETLINK_IP6_FW = 0xd + NETLINK_ISCSI = 0x8 + NETLINK_KOBJECT_UEVENT = 0xf + NETLINK_LISTEN_ALL_NSID = 0x8 + NETLINK_LIST_MEMBERSHIPS = 0x9 + NETLINK_NETFILTER = 0xc + NETLINK_NFLOG = 0x5 + NETLINK_NO_ENOBUFS = 0x5 + NETLINK_PKTINFO = 0x3 + NETLINK_RDMA = 0x14 + NETLINK_ROUTE = 0x0 + NETLINK_RX_RING = 0x6 + NETLINK_SCSITRANSPORT = 0x12 + NETLINK_SELINUX = 0x7 + NETLINK_SOCK_DIAG = 0x4 + NETLINK_TX_RING = 0x7 + NETLINK_UNUSED = 0x1 + NETLINK_USERSOCK = 0x2 + NETLINK_XFRM = 0x6 + NL0 = 0x0 + NL1 = 0x100 + NLA_ALIGNTO = 0x4 + NLA_F_NESTED = 0x8000 + NLA_F_NET_BYTEORDER = 0x4000 + NLA_HDRLEN = 0x4 + NLDLY = 0x100 + NLMSG_ALIGNTO = 0x4 + NLMSG_DONE = 0x3 + NLMSG_ERROR = 0x2 + NLMSG_HDRLEN = 0x10 + NLMSG_MIN_TYPE = 0x10 + NLMSG_NOOP = 0x1 + NLMSG_OVERRUN = 0x4 + NLM_F_ACK = 0x4 + NLM_F_APPEND = 0x800 + NLM_F_ATOMIC = 0x400 + NLM_F_CREATE = 0x400 + NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 + NLM_F_DUMP_INTR = 0x10 + NLM_F_ECHO = 0x8 + NLM_F_EXCL = 0x200 + NLM_F_MATCH = 0x200 + NLM_F_MULTI = 0x2 + NLM_F_REPLACE = 0x100 + NLM_F_REQUEST = 0x1 + NLM_F_ROOT = 0x100 + NOFLSH = 0x80 + OCRNL = 0x8 + OFDEL = 0x80 + OFILL = 0x40 + OLCUC = 0x2 + ONLCR = 0x4 + ONLRET = 0x20 + ONOCR = 0x10 + OPOST = 0x1 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x400000 + O_CREAT = 0x200 + O_DIRECT = 0x100000 + O_DIRECTORY = 0x10000 + O_DSYNC = 0x2000 + O_EXCL = 0x800 + O_FSYNC = 0x802000 + O_LARGEFILE = 0x0 + O_NDELAY = 0x4004 + O_NOATIME = 0x200000 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x20000 + O_NONBLOCK = 0x4000 + O_PATH = 0x1000000 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x802000 + O_SYNC = 0x802000 + O_TMPFILE = 0x2010000 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PACKET_ADD_MEMBERSHIP = 0x1 + PACKET_AUXDATA = 0x8 + PACKET_BROADCAST = 0x1 + PACKET_COPY_THRESH = 0x7 + PACKET_DROP_MEMBERSHIP = 0x2 + PACKET_FANOUT = 0x12 + PACKET_FANOUT_CBPF = 0x6 + PACKET_FANOUT_CPU = 0x2 + PACKET_FANOUT_DATA = 0x16 + PACKET_FANOUT_EBPF = 0x7 + PACKET_FANOUT_FLAG_DEFRAG = 0x8000 + PACKET_FANOUT_FLAG_ROLLOVER = 0x1000 + PACKET_FANOUT_HASH = 0x0 + PACKET_FANOUT_LB = 0x1 + PACKET_FANOUT_QM = 0x5 + PACKET_FANOUT_RND = 0x4 + PACKET_FANOUT_ROLLOVER = 0x3 + PACKET_FASTROUTE = 0x6 + PACKET_HDRLEN = 0xb + PACKET_HOST = 0x0 + PACKET_KERNEL = 0x7 + PACKET_LOOPBACK = 0x5 + PACKET_LOSS = 0xe + PACKET_MR_ALLMULTI = 0x2 + PACKET_MR_MULTICAST = 0x0 + PACKET_MR_PROMISC = 0x1 + PACKET_MR_UNICAST = 0x3 + PACKET_MULTICAST = 0x2 + PACKET_ORIGDEV = 0x9 + PACKET_OTHERHOST = 0x3 + PACKET_OUTGOING = 0x4 + PACKET_QDISC_BYPASS = 0x14 + PACKET_RECV_OUTPUT = 0x3 + PACKET_RESERVE = 0xc + PACKET_ROLLOVER_STATS = 0x15 + PACKET_RX_RING = 0x5 + PACKET_STATISTICS = 0x6 + PACKET_TIMESTAMP = 0x11 + PACKET_TX_HAS_OFF = 0x13 + PACKET_TX_RING = 0xd + PACKET_TX_TIMESTAMP = 0x10 + PACKET_USER = 0x6 + PACKET_VERSION = 0xa + PACKET_VNET_HDR = 0xf + PARENB = 0x100 + PARITY_CRC16_PR0 = 0x2 + PARITY_CRC16_PR0_CCITT = 0x4 + PARITY_CRC16_PR1 = 0x3 + PARITY_CRC16_PR1_CCITT = 0x5 + PARITY_CRC32_PR0_CCITT = 0x6 + PARITY_CRC32_PR1_CCITT = 0x7 + PARITY_DEFAULT = 0x0 + PARITY_NONE = 0x1 + PARMRK = 0x8 + PARODD = 0x200 + PENDIN = 0x4000 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_GROWSDOWN = 0x1000000 + PROT_GROWSUP = 0x2000000 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + PR_CAPBSET_DROP = 0x18 + PR_CAPBSET_READ = 0x17 + PR_CAP_AMBIENT = 0x2f + PR_CAP_AMBIENT_CLEAR_ALL = 0x4 + PR_CAP_AMBIENT_IS_SET = 0x1 + PR_CAP_AMBIENT_LOWER = 0x3 + PR_CAP_AMBIENT_RAISE = 0x2 + PR_ENDIAN_BIG = 0x0 + PR_ENDIAN_LITTLE = 0x1 + PR_ENDIAN_PPC_LITTLE = 0x2 + PR_FPEMU_NOPRINT = 0x1 + PR_FPEMU_SIGFPE = 0x2 + PR_FP_EXC_ASYNC = 0x2 + PR_FP_EXC_DISABLED = 0x0 + PR_FP_EXC_DIV = 0x10000 + PR_FP_EXC_INV = 0x100000 + PR_FP_EXC_NONRECOV = 0x1 + PR_FP_EXC_OVF = 0x20000 + PR_FP_EXC_PRECISE = 0x3 + PR_FP_EXC_RES = 0x80000 + PR_FP_EXC_SW_ENABLE = 0x80 + PR_FP_EXC_UND = 0x40000 + PR_FP_MODE_FR = 0x1 + PR_FP_MODE_FRE = 0x2 + PR_GET_CHILD_SUBREAPER = 0x25 + PR_GET_DUMPABLE = 0x3 + PR_GET_ENDIAN = 0x13 + PR_GET_FPEMU = 0x9 + PR_GET_FPEXC = 0xb + PR_GET_FP_MODE = 0x2e + PR_GET_KEEPCAPS = 0x7 + PR_GET_NAME = 0x10 + PR_GET_NO_NEW_PRIVS = 0x27 + PR_GET_PDEATHSIG = 0x2 + PR_GET_SECCOMP = 0x15 + PR_GET_SECUREBITS = 0x1b + PR_GET_THP_DISABLE = 0x2a + PR_GET_TID_ADDRESS = 0x28 + PR_GET_TIMERSLACK = 0x1e + PR_GET_TIMING = 0xd + PR_GET_TSC = 0x19 + PR_GET_UNALIGN = 0x5 + PR_MCE_KILL = 0x21 + PR_MCE_KILL_CLEAR = 0x0 + PR_MCE_KILL_DEFAULT = 0x2 + PR_MCE_KILL_EARLY = 0x1 + PR_MCE_KILL_GET = 0x22 + PR_MCE_KILL_LATE = 0x0 + PR_MCE_KILL_SET = 0x1 + PR_MPX_DISABLE_MANAGEMENT = 0x2c + PR_MPX_ENABLE_MANAGEMENT = 0x2b + PR_SET_CHILD_SUBREAPER = 0x24 + PR_SET_DUMPABLE = 0x4 + PR_SET_ENDIAN = 0x14 + PR_SET_FPEMU = 0xa + PR_SET_FPEXC = 0xc + PR_SET_FP_MODE = 0x2d + PR_SET_KEEPCAPS = 0x8 + PR_SET_MM = 0x23 + PR_SET_MM_ARG_END = 0x9 + PR_SET_MM_ARG_START = 0x8 + PR_SET_MM_AUXV = 0xc + PR_SET_MM_BRK = 0x7 + PR_SET_MM_END_CODE = 0x2 + PR_SET_MM_END_DATA = 0x4 + PR_SET_MM_ENV_END = 0xb + PR_SET_MM_ENV_START = 0xa + PR_SET_MM_EXE_FILE = 0xd + PR_SET_MM_MAP = 0xe + PR_SET_MM_MAP_SIZE = 0xf + PR_SET_MM_START_BRK = 0x6 + PR_SET_MM_START_CODE = 0x1 + PR_SET_MM_START_DATA = 0x3 + PR_SET_MM_START_STACK = 0x5 + PR_SET_NAME = 0xf + PR_SET_NO_NEW_PRIVS = 0x26 + PR_SET_PDEATHSIG = 0x1 + PR_SET_PTRACER = 0x59616d61 + PR_SET_PTRACER_ANY = -0x1 + PR_SET_SECCOMP = 0x16 + PR_SET_SECUREBITS = 0x1c + PR_SET_THP_DISABLE = 0x29 + PR_SET_TIMERSLACK = 0x1d + PR_SET_TIMING = 0xe + PR_SET_TSC = 0x1a + PR_SET_UNALIGN = 0x6 + PR_TASK_PERF_EVENTS_DISABLE = 0x1f + PR_TASK_PERF_EVENTS_ENABLE = 0x20 + PR_TIMING_STATISTICAL = 0x0 + PR_TIMING_TIMESTAMP = 0x1 + PR_TSC_ENABLE = 0x1 + PR_TSC_SIGSEGV = 0x2 + PR_UNALIGN_NOPRINT = 0x1 + PR_UNALIGN_SIGBUS = 0x2 + PTRACE_ATTACH = 0x10 + PTRACE_CONT = 0x7 + PTRACE_DETACH = 0x11 + PTRACE_EVENT_CLONE = 0x3 + PTRACE_EVENT_EXEC = 0x4 + PTRACE_EVENT_EXIT = 0x6 + PTRACE_EVENT_FORK = 0x1 + PTRACE_EVENT_SECCOMP = 0x7 + PTRACE_EVENT_STOP = 0x80 + PTRACE_EVENT_VFORK = 0x2 + PTRACE_EVENT_VFORK_DONE = 0x5 + PTRACE_GETEVENTMSG = 0x4201 + PTRACE_GETFPAREGS = 0x14 + PTRACE_GETFPREGS = 0xe + PTRACE_GETFPREGS64 = 0x19 + PTRACE_GETREGS = 0xc + PTRACE_GETREGS64 = 0x16 + PTRACE_GETREGSET = 0x4204 + PTRACE_GETSIGINFO = 0x4202 + PTRACE_GETSIGMASK = 0x420a + PTRACE_INTERRUPT = 0x4207 + PTRACE_KILL = 0x8 + PTRACE_LISTEN = 0x4208 + PTRACE_O_EXITKILL = 0x100000 + PTRACE_O_MASK = 0x3000ff + PTRACE_O_SUSPEND_SECCOMP = 0x200000 + PTRACE_O_TRACECLONE = 0x8 + PTRACE_O_TRACEEXEC = 0x10 + PTRACE_O_TRACEEXIT = 0x40 + PTRACE_O_TRACEFORK = 0x2 + PTRACE_O_TRACESECCOMP = 0x80 + PTRACE_O_TRACESYSGOOD = 0x1 + PTRACE_O_TRACEVFORK = 0x4 + PTRACE_O_TRACEVFORKDONE = 0x20 + PTRACE_PEEKDATA = 0x2 + PTRACE_PEEKSIGINFO = 0x4209 + PTRACE_PEEKSIGINFO_SHARED = 0x1 + PTRACE_PEEKTEXT = 0x1 + PTRACE_PEEKUSR = 0x3 + PTRACE_POKEDATA = 0x5 + PTRACE_POKETEXT = 0x4 + PTRACE_POKEUSR = 0x6 + PTRACE_READDATA = 0x10 + PTRACE_READTEXT = 0x12 + PTRACE_SECCOMP_GET_FILTER = 0x420c + PTRACE_SEIZE = 0x4206 + PTRACE_SETFPAREGS = 0x15 + PTRACE_SETFPREGS = 0xf + PTRACE_SETFPREGS64 = 0x1a + PTRACE_SETOPTIONS = 0x4200 + PTRACE_SETREGS = 0xd + PTRACE_SETREGS64 = 0x17 + PTRACE_SETREGSET = 0x4205 + PTRACE_SETSIGINFO = 0x4203 + PTRACE_SETSIGMASK = 0x420b + PTRACE_SINGLESTEP = 0x9 + PTRACE_SPARC_DETACH = 0xb + PTRACE_SYSCALL = 0x18 + PTRACE_TRACEME = 0x0 + PTRACE_WRITEDATA = 0x11 + PTRACE_WRITETEXT = 0x13 + PT_FP = 0x48 + PT_G0 = 0x10 + PT_G1 = 0x14 + PT_G2 = 0x18 + PT_G3 = 0x1c + PT_G4 = 0x20 + PT_G5 = 0x24 + PT_G6 = 0x28 + PT_G7 = 0x2c + PT_I0 = 0x30 + PT_I1 = 0x34 + PT_I2 = 0x38 + PT_I3 = 0x3c + PT_I4 = 0x40 + PT_I5 = 0x44 + PT_I6 = 0x48 + PT_I7 = 0x4c + PT_NPC = 0x8 + PT_PC = 0x4 + PT_PSR = 0x0 + PT_REGS_MAGIC = 0x57ac6c00 + PT_TNPC = 0x90 + PT_TPC = 0x88 + PT_TSTATE = 0x80 + PT_V9_FP = 0x70 + PT_V9_G0 = 0x0 + PT_V9_G1 = 0x8 + PT_V9_G2 = 0x10 + PT_V9_G3 = 0x18 + PT_V9_G4 = 0x20 + PT_V9_G5 = 0x28 + PT_V9_G6 = 0x30 + PT_V9_G7 = 0x38 + PT_V9_I0 = 0x40 + PT_V9_I1 = 0x48 + PT_V9_I2 = 0x50 + PT_V9_I3 = 0x58 + PT_V9_I4 = 0x60 + PT_V9_I5 = 0x68 + PT_V9_I6 = 0x70 + PT_V9_I7 = 0x78 + PT_V9_MAGIC = 0x9c + PT_V9_TNPC = 0x90 + PT_V9_TPC = 0x88 + PT_V9_TSTATE = 0x80 + PT_V9_Y = 0x98 + PT_WIM = 0x10 + PT_Y = 0xc + RLIMIT_AS = 0x9 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_NOFILE = 0x6 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = -0x1 + RTAX_ADVMSS = 0x8 + RTAX_CC_ALGO = 0x10 + RTAX_CWND = 0x7 + RTAX_FEATURES = 0xc + RTAX_FEATURE_ALLFRAG = 0x8 + RTAX_FEATURE_ECN = 0x1 + RTAX_FEATURE_MASK = 0xf + RTAX_FEATURE_SACK = 0x2 + RTAX_FEATURE_TIMESTAMP = 0x4 + RTAX_HOPLIMIT = 0xa + RTAX_INITCWND = 0xb + RTAX_INITRWND = 0xe + RTAX_LOCK = 0x1 + RTAX_MAX = 0x10 + RTAX_MTU = 0x2 + RTAX_QUICKACK = 0xf + RTAX_REORDERING = 0x9 + RTAX_RTO_MIN = 0xd + RTAX_RTT = 0x4 + RTAX_RTTVAR = 0x5 + RTAX_SSTHRESH = 0x6 + RTAX_UNSPEC = 0x0 + RTAX_WINDOW = 0x3 + RTA_ALIGNTO = 0x4 + RTA_MAX = 0x18 + RTCF_DIRECTSRC = 0x4000000 + RTCF_DOREDIRECT = 0x1000000 + RTCF_LOG = 0x2000000 + RTCF_MASQ = 0x400000 + RTCF_NAT = 0x800000 + RTCF_VALVE = 0x200000 + RTF_ADDRCLASSMASK = 0xf8000000 + RTF_ADDRCONF = 0x40000 + RTF_ALLONLINK = 0x20000 + RTF_BROADCAST = 0x10000000 + RTF_CACHE = 0x1000000 + RTF_DEFAULT = 0x10000 + RTF_DYNAMIC = 0x10 + RTF_FLOW = 0x2000000 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_INTERFACE = 0x40000000 + RTF_IRTT = 0x100 + RTF_LINKRT = 0x100000 + RTF_LOCAL = 0x80000000 + RTF_MODIFIED = 0x20 + RTF_MSS = 0x40 + RTF_MTU = 0x40 + RTF_MULTICAST = 0x20000000 + RTF_NAT = 0x8000000 + RTF_NOFORWARD = 0x1000 + RTF_NONEXTHOP = 0x200000 + RTF_NOPMTUDISC = 0x4000 + RTF_POLICY = 0x4000000 + RTF_REINSTATE = 0x8 + RTF_REJECT = 0x200 + RTF_STATIC = 0x400 + RTF_THROW = 0x2000 + RTF_UP = 0x1 + RTF_WINDOW = 0x80 + RTF_XRESOLVE = 0x800 + RTM_BASE = 0x10 + RTM_DELACTION = 0x31 + RTM_DELADDR = 0x15 + RTM_DELADDRLABEL = 0x49 + RTM_DELLINK = 0x11 + RTM_DELMDB = 0x55 + RTM_DELNEIGH = 0x1d + RTM_DELNSID = 0x59 + RTM_DELQDISC = 0x25 + RTM_DELROUTE = 0x19 + RTM_DELRULE = 0x21 + RTM_DELTCLASS = 0x29 + RTM_DELTFILTER = 0x2d + RTM_F_CLONED = 0x200 + RTM_F_EQUALIZE = 0x400 + RTM_F_LOOKUP_TABLE = 0x1000 + RTM_F_NOTIFY = 0x100 + RTM_F_PREFIX = 0x800 + RTM_GETACTION = 0x32 + RTM_GETADDR = 0x16 + RTM_GETADDRLABEL = 0x4a + RTM_GETANYCAST = 0x3e + RTM_GETDCB = 0x4e + RTM_GETLINK = 0x12 + RTM_GETMDB = 0x56 + RTM_GETMULTICAST = 0x3a + RTM_GETNEIGH = 0x1e + RTM_GETNEIGHTBL = 0x42 + RTM_GETNETCONF = 0x52 + RTM_GETNSID = 0x5a + RTM_GETQDISC = 0x26 + RTM_GETROUTE = 0x1a + RTM_GETRULE = 0x22 + RTM_GETSTATS = 0x5e + RTM_GETTCLASS = 0x2a + RTM_GETTFILTER = 0x2e + RTM_MAX = 0x5f + RTM_NEWACTION = 0x30 + RTM_NEWADDR = 0x14 + RTM_NEWADDRLABEL = 0x48 + RTM_NEWLINK = 0x10 + RTM_NEWMDB = 0x54 + RTM_NEWNDUSEROPT = 0x44 + RTM_NEWNEIGH = 0x1c + RTM_NEWNEIGHTBL = 0x40 + RTM_NEWNETCONF = 0x50 + RTM_NEWNSID = 0x58 + RTM_NEWPREFIX = 0x34 + RTM_NEWQDISC = 0x24 + RTM_NEWROUTE = 0x18 + RTM_NEWRULE = 0x20 + RTM_NEWSTATS = 0x5c + RTM_NEWTCLASS = 0x28 + RTM_NEWTFILTER = 0x2c + RTM_NR_FAMILIES = 0x14 + RTM_NR_MSGTYPES = 0x50 + RTM_SETDCB = 0x4f + RTM_SETLINK = 0x13 + RTM_SETNEIGHTBL = 0x43 + RTNH_ALIGNTO = 0x4 + RTNH_COMPARE_MASK = 0x11 + RTNH_F_DEAD = 0x1 + RTNH_F_LINKDOWN = 0x10 + RTNH_F_OFFLOAD = 0x8 + RTNH_F_ONLINK = 0x4 + RTNH_F_PERVASIVE = 0x2 + RTN_MAX = 0xb + RTPROT_BABEL = 0x2a + RTPROT_BIRD = 0xc + RTPROT_BOOT = 0x3 + RTPROT_DHCP = 0x10 + RTPROT_DNROUTED = 0xd + RTPROT_GATED = 0x8 + RTPROT_KERNEL = 0x2 + RTPROT_MROUTED = 0x11 + RTPROT_MRT = 0xa + RTPROT_NTK = 0xf + RTPROT_RA = 0x9 + RTPROT_REDIRECT = 0x1 + RTPROT_STATIC = 0x4 + RTPROT_UNSPEC = 0x0 + RTPROT_XORP = 0xe + RTPROT_ZEBRA = 0xb + RT_CLASS_DEFAULT = 0xfd + RT_CLASS_LOCAL = 0xff + RT_CLASS_MAIN = 0xfe + RT_CLASS_MAX = 0xff + RT_CLASS_UNSPEC = 0x0 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_CREDENTIALS = 0x2 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x1d + SCM_TIMESTAMPING = 0x23 + SCM_TIMESTAMPNS = 0x21 + SCM_WIFI_STATUS = 0x25 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDDLCI = 0x8980 + SIOCADDMULTI = 0x8931 + SIOCADDRT = 0x890b + SIOCATMARK = 0x8905 + SIOCBONDCHANGEACTIVE = 0x8995 + SIOCBONDENSLAVE = 0x8990 + SIOCBONDINFOQUERY = 0x8994 + SIOCBONDRELEASE = 0x8991 + SIOCBONDSETHWADDR = 0x8992 + SIOCBONDSLAVEINFOQUERY = 0x8993 + SIOCBRADDBR = 0x89a0 + SIOCBRADDIF = 0x89a2 + SIOCBRDELBR = 0x89a1 + SIOCBRDELIF = 0x89a3 + SIOCDARP = 0x8953 + SIOCDELDLCI = 0x8981 + SIOCDELMULTI = 0x8932 + SIOCDELRT = 0x890c + SIOCDEVPRIVATE = 0x89f0 + SIOCDIFADDR = 0x8936 + SIOCDRARP = 0x8960 + SIOCETHTOOL = 0x8946 + SIOCGARP = 0x8954 + SIOCGHWTSTAMP = 0x89b1 + SIOCGIFADDR = 0x8915 + SIOCGIFBR = 0x8940 + SIOCGIFBRDADDR = 0x8919 + SIOCGIFCONF = 0x8912 + SIOCGIFCOUNT = 0x8938 + SIOCGIFDSTADDR = 0x8917 + SIOCGIFENCAP = 0x8925 + SIOCGIFFLAGS = 0x8913 + SIOCGIFHWADDR = 0x8927 + SIOCGIFINDEX = 0x8933 + SIOCGIFMAP = 0x8970 + SIOCGIFMEM = 0x891f + SIOCGIFMETRIC = 0x891d + SIOCGIFMTU = 0x8921 + SIOCGIFNAME = 0x8910 + SIOCGIFNETMASK = 0x891b + SIOCGIFPFLAGS = 0x8935 + SIOCGIFSLAVE = 0x8929 + SIOCGIFTXQLEN = 0x8942 + SIOCGIFVLAN = 0x8982 + SIOCGMIIPHY = 0x8947 + SIOCGMIIREG = 0x8948 + SIOCGPGRP = 0x8904 + SIOCGRARP = 0x8961 + SIOCGSTAMP = 0x8906 + SIOCGSTAMPNS = 0x8907 + SIOCINQ = 0x4004667f + SIOCOUTQ = 0x40047473 + SIOCOUTQNSD = 0x894b + SIOCPROTOPRIVATE = 0x89e0 + SIOCRTMSG = 0x890d + SIOCSARP = 0x8955 + SIOCSHWTSTAMP = 0x89b0 + SIOCSIFADDR = 0x8916 + SIOCSIFBR = 0x8941 + SIOCSIFBRDADDR = 0x891a + SIOCSIFDSTADDR = 0x8918 + SIOCSIFENCAP = 0x8926 + SIOCSIFFLAGS = 0x8914 + SIOCSIFHWADDR = 0x8924 + SIOCSIFHWBROADCAST = 0x8937 + SIOCSIFLINK = 0x8911 + SIOCSIFMAP = 0x8971 + SIOCSIFMEM = 0x8920 + SIOCSIFMETRIC = 0x891e + SIOCSIFMTU = 0x8922 + SIOCSIFNAME = 0x8923 + SIOCSIFNETMASK = 0x891c + SIOCSIFPFLAGS = 0x8934 + SIOCSIFSLAVE = 0x8930 + SIOCSIFTXQLEN = 0x8943 + SIOCSIFVLAN = 0x8983 + SIOCSMIIREG = 0x8949 + SIOCSPGRP = 0x8902 + SIOCSRARP = 0x8962 + SIOCWANDEV = 0x894a + SOCK_CLOEXEC = 0x400000 + SOCK_DCCP = 0x6 + SOCK_DGRAM = 0x2 + SOCK_NONBLOCK = 0x4000 + SOCK_PACKET = 0xa + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_AAL = 0x109 + SOL_ALG = 0x117 + SOL_ATM = 0x108 + SOL_CAIF = 0x116 + SOL_DCCP = 0x10d + SOL_DECNET = 0x105 + SOL_ICMPV6 = 0x3a + SOL_IP = 0x0 + SOL_IPV6 = 0x29 + SOL_IRDA = 0x10a + SOL_IUCV = 0x115 + SOL_KCM = 0x119 + SOL_LLC = 0x10c + SOL_NETBEUI = 0x10b + SOL_NETLINK = 0x10e + SOL_NFC = 0x118 + SOL_PACKET = 0x107 + SOL_PNPIPE = 0x113 + SOL_PPPOL2TP = 0x111 + SOL_RAW = 0xff + SOL_RDS = 0x114 + SOL_RXRPC = 0x110 + SOL_SOCKET = 0xffff + SOL_TCP = 0x6 + SOL_TIPC = 0x10f + SOL_X25 = 0x106 + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x8000 + SO_ATTACH_BPF = 0x34 + SO_ATTACH_FILTER = 0x1a + SO_ATTACH_REUSEPORT_CBPF = 0x35 + SO_ATTACH_REUSEPORT_EBPF = 0x36 + SO_BINDTODEVICE = 0xd + SO_BPF_EXTENSIONS = 0x32 + SO_BROADCAST = 0x20 + SO_BSDCOMPAT = 0x400 + SO_BUSY_POLL = 0x30 + SO_CNX_ADVICE = 0x37 + SO_DEBUG = 0x1 + SO_DETACH_BPF = 0x1b + SO_DETACH_FILTER = 0x1b + SO_DOMAIN = 0x1029 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_GET_FILTER = 0x1a + SO_INCOMING_CPU = 0x33 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_LOCK_FILTER = 0x28 + SO_MARK = 0x22 + SO_MAX_PACING_RATE = 0x31 + SO_NOFCS = 0x27 + SO_NO_CHECK = 0xb + SO_OOBINLINE = 0x100 + SO_PASSCRED = 0x2 + SO_PASSSEC = 0x1f + SO_PEEK_OFF = 0x26 + SO_PEERCRED = 0x40 + SO_PEERNAME = 0x1c + SO_PEERSEC = 0x1e + SO_PRIORITY = 0xc + SO_PROTOCOL = 0x1028 + SO_RCVBUF = 0x1002 + SO_RCVBUFFORCE = 0x100b + SO_RCVLOWAT = 0x800 + SO_RCVTIMEO = 0x2000 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_RXQ_OVFL = 0x24 + SO_SECURITY_AUTHENTICATION = 0x5001 + SO_SECURITY_ENCRYPTION_NETWORK = 0x5004 + SO_SECURITY_ENCRYPTION_TRANSPORT = 0x5002 + SO_SELECT_ERR_QUEUE = 0x29 + SO_SNDBUF = 0x1001 + SO_SNDBUFFORCE = 0x100a + SO_SNDLOWAT = 0x1000 + SO_SNDTIMEO = 0x4000 + SO_TIMESTAMP = 0x1d + SO_TIMESTAMPING = 0x23 + SO_TIMESTAMPNS = 0x21 + SO_TYPE = 0x1008 + SO_WIFI_STATUS = 0x25 + S_BLKSIZE = 0x200 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TAB0 = 0x0 + TAB1 = 0x800 + TAB2 = 0x1000 + TAB3 = 0x1800 + TABDLY = 0x1800 + TCFLSH = 0x20005407 + TCGETA = 0x40125401 + TCGETS = 0x40245408 + TCGETS2 = 0x402c540c + TCIFLUSH = 0x0 + TCIOFF = 0x2 + TCIOFLUSH = 0x2 + TCION = 0x3 + TCOFLUSH = 0x1 + TCOOFF = 0x0 + TCOON = 0x1 + TCP_CC_INFO = 0x1a + TCP_CONGESTION = 0xd + TCP_COOKIE_IN_ALWAYS = 0x1 + TCP_COOKIE_MAX = 0x10 + TCP_COOKIE_MIN = 0x8 + TCP_COOKIE_OUT_NEVER = 0x2 + TCP_COOKIE_PAIR_SIZE = 0x20 + TCP_COOKIE_TRANSACTIONS = 0xf + TCP_CORK = 0x3 + TCP_DEFER_ACCEPT = 0x9 + TCP_FASTOPEN = 0x17 + TCP_INFO = 0xb + TCP_KEEPCNT = 0x6 + TCP_KEEPIDLE = 0x4 + TCP_KEEPINTVL = 0x5 + TCP_LINGER2 = 0x8 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0xe + TCP_MD5SIG_MAXKEYLEN = 0x50 + TCP_MSS = 0x200 + TCP_MSS_DEFAULT = 0x218 + TCP_MSS_DESIRED = 0x4c4 + TCP_NODELAY = 0x1 + TCP_NOTSENT_LOWAT = 0x19 + TCP_QUEUE_SEQ = 0x15 + TCP_QUICKACK = 0xc + TCP_REPAIR = 0x13 + TCP_REPAIR_OPTIONS = 0x16 + TCP_REPAIR_QUEUE = 0x14 + TCP_SAVED_SYN = 0x1c + TCP_SAVE_SYN = 0x1b + TCP_SYNCNT = 0x7 + TCP_S_DATA_IN = 0x4 + TCP_S_DATA_OUT = 0x8 + TCP_THIN_DUPACK = 0x11 + TCP_THIN_LINEAR_TIMEOUTS = 0x10 + TCP_TIMESTAMP = 0x18 + TCP_USER_TIMEOUT = 0x12 + TCP_WINDOW_CLAMP = 0xa + TCSAFLUSH = 0x2 + TCSBRK = 0x20005405 + TCSBRKP = 0x5425 + TCSETA = 0x80125402 + TCSETAF = 0x80125404 + TCSETAW = 0x80125403 + TCSETS = 0x80245409 + TCSETS2 = 0x802c540d + TCSETSF = 0x8024540b + TCSETSF2 = 0x802c540f + TCSETSW = 0x8024540a + TCSETSW2 = 0x802c540e + TCXONC = 0x20005406 + TIOCCBRK = 0x2000747a + TIOCCONS = 0x20007424 + TIOCEXCL = 0x2000740d + TIOCGDEV = 0x40045432 + TIOCGETD = 0x40047400 + TIOCGEXCL = 0x40045440 + TIOCGICOUNT = 0x545d + TIOCGLCKTRMIOS = 0x5456 + TIOCGPGRP = 0x40047483 + TIOCGPKT = 0x40045438 + TIOCGPTLCK = 0x40045439 + TIOCGPTN = 0x40047486 + TIOCGRS485 = 0x40205441 + TIOCGSERIAL = 0x541e + TIOCGSID = 0x40047485 + TIOCGSOFTCAR = 0x40047464 + TIOCGWINSZ = 0x40087468 + TIOCINQ = 0x4004667f + TIOCLINUX = 0x541c + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMIWAIT = 0x545c + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_LOOP = 0x8000 + TIOCM_OUT1 = 0x2000 + TIOCM_OUT2 = 0x4000 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007484 + TIOCSERCONFIG = 0x5453 + TIOCSERGETLSR = 0x5459 + TIOCSERGETMULTI = 0x545a + TIOCSERGSTRUCT = 0x5458 + TIOCSERGWILD = 0x5454 + TIOCSERSETMULTI = 0x545b + TIOCSERSWILD = 0x5455 + TIOCSER_TEMT = 0x1 + TIOCSETD = 0x80047401 + TIOCSIG = 0x80047488 + TIOCSLCKTRMIOS = 0x5457 + TIOCSPGRP = 0x80047482 + TIOCSPTLCK = 0x80047487 + TIOCSRS485 = 0xc0205442 + TIOCSSERIAL = 0x541f + TIOCSSOFTCAR = 0x80047465 + TIOCSTART = 0x2000746e + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCVHANGUP = 0x20005437 + TOSTOP = 0x100 + TUNATTACHFILTER = 0x801054d5 + TUNDETACHFILTER = 0x801054d6 + TUNGETFEATURES = 0x400454cf + TUNGETFILTER = 0x401054db + TUNGETIFF = 0x400454d2 + TUNGETSNDBUF = 0x400454d3 + TUNGETVNETBE = 0x400454df + TUNGETVNETHDRSZ = 0x400454d7 + TUNGETVNETLE = 0x400454dd + TUNSETDEBUG = 0x800454c9 + TUNSETGROUP = 0x800454ce + TUNSETIFF = 0x800454ca + TUNSETIFINDEX = 0x800454da + TUNSETLINK = 0x800454cd + TUNSETNOCSUM = 0x800454c8 + TUNSETOFFLOAD = 0x800454d0 + TUNSETOWNER = 0x800454cc + TUNSETPERSIST = 0x800454cb + TUNSETQUEUE = 0x800454d9 + TUNSETSNDBUF = 0x800454d4 + TUNSETTXFILTER = 0x800454d1 + TUNSETVNETBE = 0x800454de + TUNSETVNETHDRSZ = 0x800454d8 + TUNSETVNETLE = 0x800454dc + VDISCARD = 0xd + VDSUSP = 0xb + VEOF = 0x4 + VEOL = 0x5 + VEOL2 = 0x6 + VERASE = 0x2 + VINTR = 0x0 + VKILL = 0x3 + VLNEXT = 0xf + VMIN = 0x4 + VQUIT = 0x1 + VREPRINT = 0xc + VSTART = 0x8 + VSTOP = 0x9 + VSUSP = 0xa + VSWTC = 0x7 + VT0 = 0x0 + VT1 = 0x4000 + VTDLY = 0x4000 + VTIME = 0x5 + VWERASE = 0xe + WALL = 0x40000000 + WCLONE = 0x80000000 + WCONTINUED = 0x8 + WEXITED = 0x4 + WNOHANG = 0x1 + WNOTHREAD = 0x20000000 + WNOWAIT = 0x1000000 + WORDSIZE = 0x40 + WRAP = 0x20000 + WSTOPPED = 0x2 + WUNTRACED = 0x2 + XCASE = 0x4 + XTABS = 0x1800 + __TIOCFLUSH = 0x80047410 +) + +// Errors +const ( + E2BIG = syscall.Errno(0x7) + EACCES = syscall.Errno(0xd) + EADDRINUSE = syscall.Errno(0x30) + EADDRNOTAVAIL = syscall.Errno(0x31) + EADV = syscall.Errno(0x53) + EAFNOSUPPORT = syscall.Errno(0x2f) + EAGAIN = syscall.Errno(0xb) + EALREADY = syscall.Errno(0x25) + EBADE = syscall.Errno(0x66) + EBADF = syscall.Errno(0x9) + EBADFD = syscall.Errno(0x5d) + EBADMSG = syscall.Errno(0x4c) + EBADR = syscall.Errno(0x67) + EBADRQC = syscall.Errno(0x6a) + EBADSLT = syscall.Errno(0x6b) + EBFONT = syscall.Errno(0x6d) + EBUSY = syscall.Errno(0x10) + ECANCELED = syscall.Errno(0x7f) + ECHILD = syscall.Errno(0xa) + ECHRNG = syscall.Errno(0x5e) + ECOMM = syscall.Errno(0x55) + ECONNABORTED = syscall.Errno(0x35) + ECONNREFUSED = syscall.Errno(0x3d) + ECONNRESET = syscall.Errno(0x36) + EDEADLK = syscall.Errno(0x4e) + EDEADLOCK = syscall.Errno(0x6c) + EDESTADDRREQ = syscall.Errno(0x27) + EDOM = syscall.Errno(0x21) + EDOTDOT = syscall.Errno(0x58) + EDQUOT = syscall.Errno(0x45) + EEXIST = syscall.Errno(0x11) + EFAULT = syscall.Errno(0xe) + EFBIG = syscall.Errno(0x1b) + EHOSTDOWN = syscall.Errno(0x40) + EHOSTUNREACH = syscall.Errno(0x41) + EHWPOISON = syscall.Errno(0x87) + EIDRM = syscall.Errno(0x4d) + EILSEQ = syscall.Errno(0x7a) + EINPROGRESS = syscall.Errno(0x24) + EINTR = syscall.Errno(0x4) + EINVAL = syscall.Errno(0x16) + EIO = syscall.Errno(0x5) + EISCONN = syscall.Errno(0x38) + EISDIR = syscall.Errno(0x15) + EISNAM = syscall.Errno(0x78) + EKEYEXPIRED = syscall.Errno(0x81) + EKEYREJECTED = syscall.Errno(0x83) + EKEYREVOKED = syscall.Errno(0x82) + EL2HLT = syscall.Errno(0x65) + EL2NSYNC = syscall.Errno(0x5f) + EL3HLT = syscall.Errno(0x60) + EL3RST = syscall.Errno(0x61) + ELIBACC = syscall.Errno(0x72) + ELIBBAD = syscall.Errno(0x70) + ELIBEXEC = syscall.Errno(0x6e) + ELIBMAX = syscall.Errno(0x7b) + ELIBSCN = syscall.Errno(0x7c) + ELNRNG = syscall.Errno(0x62) + ELOOP = syscall.Errno(0x3e) + EMEDIUMTYPE = syscall.Errno(0x7e) + EMFILE = syscall.Errno(0x18) + EMLINK = syscall.Errno(0x1f) + EMSGSIZE = syscall.Errno(0x28) + EMULTIHOP = syscall.Errno(0x57) + ENAMETOOLONG = syscall.Errno(0x3f) + ENAVAIL = syscall.Errno(0x77) + ENETDOWN = syscall.Errno(0x32) + ENETRESET = syscall.Errno(0x34) + ENETUNREACH = syscall.Errno(0x33) + ENFILE = syscall.Errno(0x17) + ENOANO = syscall.Errno(0x69) + ENOBUFS = syscall.Errno(0x37) + ENOCSI = syscall.Errno(0x64) + ENODATA = syscall.Errno(0x6f) + ENODEV = syscall.Errno(0x13) + ENOENT = syscall.Errno(0x2) + ENOEXEC = syscall.Errno(0x8) + ENOKEY = syscall.Errno(0x80) + ENOLCK = syscall.Errno(0x4f) + ENOLINK = syscall.Errno(0x52) + ENOMEDIUM = syscall.Errno(0x7d) + ENOMEM = syscall.Errno(0xc) + ENOMSG = syscall.Errno(0x4b) + ENONET = syscall.Errno(0x50) + ENOPKG = syscall.Errno(0x71) + ENOPROTOOPT = syscall.Errno(0x2a) + ENOSPC = syscall.Errno(0x1c) + ENOSR = syscall.Errno(0x4a) + ENOSTR = syscall.Errno(0x48) + ENOSYS = syscall.Errno(0x5a) + ENOTBLK = syscall.Errno(0xf) + ENOTCONN = syscall.Errno(0x39) + ENOTDIR = syscall.Errno(0x14) + ENOTEMPTY = syscall.Errno(0x42) + ENOTNAM = syscall.Errno(0x76) + ENOTRECOVERABLE = syscall.Errno(0x85) + ENOTSOCK = syscall.Errno(0x26) + ENOTSUP = syscall.Errno(0x2d) + ENOTTY = syscall.Errno(0x19) + ENOTUNIQ = syscall.Errno(0x73) + ENXIO = syscall.Errno(0x6) + EOPNOTSUPP = syscall.Errno(0x2d) + EOVERFLOW = syscall.Errno(0x5c) + EOWNERDEAD = syscall.Errno(0x84) + EPERM = syscall.Errno(0x1) + EPFNOSUPPORT = syscall.Errno(0x2e) + EPIPE = syscall.Errno(0x20) + EPROCLIM = syscall.Errno(0x43) + EPROTO = syscall.Errno(0x56) + EPROTONOSUPPORT = syscall.Errno(0x2b) + EPROTOTYPE = syscall.Errno(0x29) + ERANGE = syscall.Errno(0x22) + EREMCHG = syscall.Errno(0x59) + EREMOTE = syscall.Errno(0x47) + EREMOTEIO = syscall.Errno(0x79) + ERESTART = syscall.Errno(0x74) + ERFKILL = syscall.Errno(0x86) + EROFS = syscall.Errno(0x1e) + ERREMOTE = syscall.Errno(0x51) + ESHUTDOWN = syscall.Errno(0x3a) + ESOCKTNOSUPPORT = syscall.Errno(0x2c) + ESPIPE = syscall.Errno(0x1d) + ESRCH = syscall.Errno(0x3) + ESRMNT = syscall.Errno(0x54) + ESTALE = syscall.Errno(0x46) + ESTRPIPE = syscall.Errno(0x5b) + ETIME = syscall.Errno(0x49) + ETIMEDOUT = syscall.Errno(0x3c) + ETOOMANYREFS = syscall.Errno(0x3b) + ETXTBSY = syscall.Errno(0x1a) + EUCLEAN = syscall.Errno(0x75) + EUNATCH = syscall.Errno(0x63) + EUSERS = syscall.Errno(0x44) + EWOULDBLOCK = syscall.Errno(0xb) + EXDEV = syscall.Errno(0x12) + EXFULL = syscall.Errno(0x68) +) + +// Signals +const ( + SIGABRT = syscall.Signal(0x6) + SIGALRM = syscall.Signal(0xe) + SIGBUS = syscall.Signal(0xa) + SIGCHLD = syscall.Signal(0x14) + SIGCLD = syscall.Signal(0x14) + SIGCONT = syscall.Signal(0x13) + SIGEMT = syscall.Signal(0x7) + SIGFPE = syscall.Signal(0x8) + SIGHUP = syscall.Signal(0x1) + SIGILL = syscall.Signal(0x4) + SIGINT = syscall.Signal(0x2) + SIGIO = syscall.Signal(0x17) + SIGIOT = syscall.Signal(0x6) + SIGKILL = syscall.Signal(0x9) + SIGLOST = syscall.Signal(0x1d) + SIGPIPE = syscall.Signal(0xd) + SIGPOLL = syscall.Signal(0x17) + SIGPROF = syscall.Signal(0x1b) + SIGPWR = syscall.Signal(0x1d) + SIGQUIT = syscall.Signal(0x3) + SIGSEGV = syscall.Signal(0xb) + SIGSTOP = syscall.Signal(0x11) + SIGSYS = syscall.Signal(0xc) + SIGTERM = syscall.Signal(0xf) + SIGTRAP = syscall.Signal(0x5) + SIGTSTP = syscall.Signal(0x12) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x10) + SIGUSR1 = syscall.Signal(0x1e) + SIGUSR2 = syscall.Signal(0x1f) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol", + 48: "address already in use", + 49: "cannot assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "transport endpoint is already connected", + 57: "transport endpoint is not connected", + 58: "cannot send after transport endpoint shutdown", + 59: "too many references: cannot splice", + 60: "connection timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale file handle", + 71: "object is remote", + 72: "device not a stream", + 73: "timer expired", + 74: "out of streams resources", + 75: "no message of desired type", + 76: "bad message", + 77: "identifier removed", + 78: "resource deadlock avoided", + 79: "no locks available", + 80: "machine is not on the network", + 81: "unknown error 81", + 82: "link has been severed", + 83: "advertise error", + 84: "srmount error", + 85: "communication error on send", + 86: "protocol error", + 87: "multihop attempted", + 88: "RFS specific error", + 89: "remote address changed", + 90: "function not implemented", + 91: "streams pipe error", + 92: "value too large for defined data type", + 93: "file descriptor in bad state", + 94: "channel number out of range", + 95: "level 2 not synchronized", + 96: "level 3 halted", + 97: "level 3 reset", + 98: "link number out of range", + 99: "protocol driver not attached", + 100: "no CSI structure available", + 101: "level 2 halted", + 102: "invalid exchange", + 103: "invalid request descriptor", + 104: "exchange full", + 105: "no anode", + 106: "invalid request code", + 107: "invalid slot", + 108: "file locking deadlock error", + 109: "bad font file format", + 110: "cannot exec a shared library directly", + 111: "no data available", + 112: "accessing a corrupted shared library", + 113: "package not installed", + 114: "can not access a needed shared library", + 115: "name not unique on network", + 116: "interrupted system call should be restarted", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "invalid or incomplete multibyte or wide character", + 123: "attempting to link in too many shared libraries", + 124: ".lib section in a.out corrupted", + 125: "no medium found", + 126: "wrong medium type", + 127: "operation canceled", + 128: "required key not available", + 129: "key has expired", + 130: "key has been revoked", + 131: "key was rejected by service", + 132: "owner died", + 133: "state not recoverable", + 134: "operation not possible due to RF-kill", + 135: "memory page has hardware error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "stopped (signal)", + 18: "stopped", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "resource lost", + 30: "user defined signal 1", + 31: "user defined signal 2", +} diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_netbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_netbsd_386.go rename to vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_netbsd_amd64.go rename to vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_netbsd_arm.go rename to vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_openbsd_386.go rename to vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_openbsd_amd64.go rename to vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zerrors_solaris_amd64.go rename to vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_darwin_386.go rename to vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_darwin_amd64.go rename to vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_darwin_arm.go rename to vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_darwin_arm64.go rename to vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go rename to vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_freebsd_386.go rename to vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go rename to vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_freebsd_arm.go rename to vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_386.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 1f7a756695..80f6a1b0ad 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_amd64.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index b4e24fc0a0..078c8f05af 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_arm.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 20bf33ce5f..76e5f7c0bb 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_arm64.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index c7286db485..72b79470a2 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_mips64.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index b709ed2f53..ba55509ea0 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_mips64le.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index 5cb1c56715..2b1cc8473b 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_ppc64.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index 873bb18f78..25f39db9df 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index bf08835c5c..70702b5166 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_s390x.go rename to vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index dbaa53b984..94b93d3d02 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -64,7 +64,7 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -87,7 +87,7 @@ func readlinkat(dirfd int, path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -109,7 +109,7 @@ func symlinkat(oldpath string, newdirfd int, newpath string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func unlinkat(dirfd int, path string, flags int) (err error) { +func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go new file mode 100644 index 0000000000..774b10ed8f --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -0,0 +1,1834 @@ +// mksyscall.pl syscall_linux.go syscall_linux_sparc64.go +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + +// +build sparc64,linux + +package unix + +import ( + "syscall" + "unsafe" +) + +var _ syscall.Errno + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0) + use(unsafe.Pointer(_p0)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { + r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + use(unsafe.Pointer(_p0)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(arg) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(source) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(target) + if err != nil { + return + } + var _p2 *byte + _p2, err = BytePtrFromString(fstype) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + use(unsafe.Pointer(_p2)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Acct(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Adjtimex(buf *Timex) (state int, err error) { + r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) + state = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Close(fd int) (err error) { + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(oldfd int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup3(oldfd int, newfd int, flags int) (err error) { + _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollCreate1(flag int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { + _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Exit(code int) { + Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { + _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntl(fd int, cmd int, arg int) (val int, err error) { + r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fdatasync(fd int) (err error) { + _, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Flock(fd int, how int) (err error) { + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getdents(fd int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (ppid int) { + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + ppid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrusage(who int, rusage *Rusage) (err error) { + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettid() (tid int) { + r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0) + tid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getxattr(path string, attr string, dest []byte) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(dest) > 0 { + _p2 = unsafe.Pointer(&dest[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask)) + use(unsafe.Pointer(_p0)) + watchdesc = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func InotifyInit1(flags int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { + r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) + success = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, sig syscall.Signal) (err error) { + _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Klogctl(typ int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listxattr(path string, dest []byte) (sz int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(dest) > 0 { + _p1 = unsafe.Pointer(&dest[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) + use(unsafe.Pointer(_p0)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdirat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func PivotRoot(newroot string, putold string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(newroot) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(putold) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) { + _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { + _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Removexattr(path string, attr string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setdomainname(p []byte) (err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sethostname(p []byte) (err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Settimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setns(fd int, nstype int) (err error) { + _, _, e1 := Syscall(SYS_SETNS, uintptr(fd), uintptr(nstype), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setxattr(path string, attr string, data []byte, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(data) > 0 { + _p2 = unsafe.Pointer(&data[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() { + Syscall(SYS_SYNC, 0, 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sysinfo(info *Sysinfo_t) (err error) { + _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { + r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) + n = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { + _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Times(tms *Tms) (ticks uintptr, err error) { + r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) + ticks = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(mask int) (oldmask int) { + r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0) + oldmask = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Uname(buf *Utsname) (err error) { + _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unmount(target string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(target) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unshare(flags int) (err error) { + _, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func exitThread(code int) (err error) { + _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, p *byte, np int) (n int, err error) { + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writelen(fd int, p *byte, np int) (n int, err error) { + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Madvise(b []byte, advice int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlockall(flags int) (err error) { + _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlockall() (err error) { + _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + var _p0 unsafe.Pointer + if len(events) > 0 { + _p0 = unsafe.Pointer(&events[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(oldfd int, newfd int) (err error) { + _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, buf *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (euid int) { + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + euid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(resource int, rlim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func InotifyInit() (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, n int) (err error) { + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (off int64, err error) { + r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) + off = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) + written = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setfsgid(gid int) (err error) { + _, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setfsuid(uid int) (err error) { + _, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(resource int, rlim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(fd int, how int) (err error) { + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { + r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) + n = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, buf *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { + _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { + r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(n int, list *_Gid_t) (nn int, err error) { + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + nn = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(n int, list *_Gid_t) (err error) { + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) + xaddr = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + use(unsafe.Pointer(_p0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe(p *[2]_C_int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_netbsd_386.go rename to vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go rename to vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_netbsd_arm.go rename to vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_openbsd_386.go rename to vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go rename to vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go similarity index 97% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_solaris_amd64.go rename to vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 4326427817..c0ecfc044a 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -10,10 +10,13 @@ import ( "unsafe" ) +//go:cgo_import_dynamic libc_pipe pipe "libc.so" //go:cgo_import_dynamic libc_getsockname getsockname "libsocket.so" //go:cgo_import_dynamic libc_getcwd getcwd "libc.so" //go:cgo_import_dynamic libc_getgroups getgroups "libc.so" //go:cgo_import_dynamic libc_setgroups setgroups "libc.so" +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" +//go:cgo_import_dynamic libc_gethostname gethostname "libc.so" //go:cgo_import_dynamic libc_utimes utimes "libc.so" //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" //go:cgo_import_dynamic libc_fcntl fcntl "libc.so" @@ -125,10 +128,13 @@ import ( //go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so" //go:cgo_import_dynamic libc_sysconf sysconf "libc.so" +//go:linkname procpipe libc_pipe //go:linkname procgetsockname libc_getsockname //go:linkname procGetcwd libc_getcwd //go:linkname procgetgroups libc_getgroups //go:linkname procsetgroups libc_setgroups +//go:linkname procwait4 libc_wait4 +//go:linkname procgethostname libc_gethostname //go:linkname procutimes libc_utimes //go:linkname procutimensat libc_utimensat //go:linkname procfcntl libc_fcntl @@ -241,10 +247,13 @@ import ( //go:linkname procsysconf libc_sysconf var ( + procpipe, procgetsockname, procGetcwd, procgetgroups, procsetgroups, + procwait4, + procgethostname, procutimes, procutimensat, procfcntl, @@ -357,6 +366,15 @@ var ( procsysconf syscallFunc ) +func pipe(p *[2]_C_int) (n int, err error) { + r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe)), 1, uintptr(unsafe.Pointer(p)), 0, 0, 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { @@ -395,6 +413,28 @@ func setgroups(ngid int, gid *_Gid_t) (err error) { return } +func wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwait4)), 4, uintptr(pid), uintptr(unsafe.Pointer(statusp)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + wpid = int32(r0) + if e1 != 0 { + err = e1 + } + return +} + +func gethostname(buf []byte) (n int, err error) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgethostname)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0, 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + func utimes(path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysctl_openbsd.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysctl_openbsd.go rename to vendor/golang.org/x/sys/unix/zsysctl_openbsd.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_darwin_386.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_darwin_386.go rename to vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_darwin_amd64.go rename to vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_darwin_arm.go rename to vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_darwin_arm64.go rename to vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go rename to vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_freebsd_386.go rename to vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go rename to vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_freebsd_arm.go rename to vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_386.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_amd64.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_arm.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_arm64.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_mips64.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_mips64le.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_ppc64.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_linux_s390x.go rename to vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go new file mode 100644 index 0000000000..46b5bee1db --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -0,0 +1,348 @@ +// mksysnum_linux.pl /usr/include/sparc64-linux-gnu/asm/unistd.h +// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT + +// +build sparc64,linux + +package unix + +const ( + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAIT4 = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECV = 11 + SYS_CHDIR = 12 + SYS_CHOWN = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BRK = 17 + SYS_PERFCTR = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_CAPGET = 21 + SYS_CAPSET = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_VMSPLICE = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_SIGALTSTACK = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_STAT = 38 + SYS_SENDFILE = 39 + SYS_LSTAT = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_UMOUNT2 = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_MEMORY_ORDERING = 52 + SYS_IOCTL = 54 + SYS_REBOOT = 55 + SYS_SYMLINK = 57 + SYS_READLINK = 58 + SYS_EXECVE = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_FSTAT = 62 + SYS_FSTAT64 = 63 + SYS_GETPAGESIZE = 64 + SYS_MSYNC = 65 + SYS_VFORK = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_MMAP = 71 + SYS_MUNMAP = 73 + SYS_MPROTECT = 74 + SYS_MADVISE = 75 + SYS_VHANGUP = 76 + SYS_MINCORE = 78 + SYS_GETGROUPS = 79 + SYS_SETGROUPS = 80 + SYS_GETPGRP = 81 + SYS_SETITIMER = 83 + SYS_SWAPON = 85 + SYS_GETITIMER = 86 + SYS_SETHOSTNAME = 88 + SYS_DUP2 = 90 + SYS_FCNTL = 92 + SYS_SELECT = 93 + SYS_FSYNC = 95 + SYS_SETPRIORITY = 96 + SYS_SOCKET = 97 + SYS_CONNECT = 98 + SYS_ACCEPT = 99 + SYS_GETPRIORITY = 100 + SYS_RT_SIGRETURN = 101 + SYS_RT_SIGACTION = 102 + SYS_RT_SIGPROCMASK = 103 + SYS_RT_SIGPENDING = 104 + SYS_RT_SIGTIMEDWAIT = 105 + SYS_RT_SIGQUEUEINFO = 106 + SYS_RT_SIGSUSPEND = 107 + SYS_SETRESUID = 108 + SYS_GETRESUID = 109 + SYS_SETRESGID = 110 + SYS_GETRESGID = 111 + SYS_RECVMSG = 113 + SYS_SENDMSG = 114 + SYS_GETTIMEOFDAY = 116 + SYS_GETRUSAGE = 117 + SYS_GETSOCKOPT = 118 + SYS_GETCWD = 119 + SYS_READV = 120 + SYS_WRITEV = 121 + SYS_SETTIMEOFDAY = 122 + SYS_FCHOWN = 123 + SYS_FCHMOD = 124 + SYS_RECVFROM = 125 + SYS_SETREUID = 126 + SYS_SETREGID = 127 + SYS_RENAME = 128 + SYS_TRUNCATE = 129 + SYS_FTRUNCATE = 130 + SYS_FLOCK = 131 + SYS_LSTAT64 = 132 + SYS_SENDTO = 133 + SYS_SHUTDOWN = 134 + SYS_SOCKETPAIR = 135 + SYS_MKDIR = 136 + SYS_RMDIR = 137 + SYS_UTIMES = 138 + SYS_STAT64 = 139 + SYS_SENDFILE64 = 140 + SYS_GETPEERNAME = 141 + SYS_FUTEX = 142 + SYS_GETTID = 143 + SYS_GETRLIMIT = 144 + SYS_SETRLIMIT = 145 + SYS_PIVOT_ROOT = 146 + SYS_PRCTL = 147 + SYS_PCICONFIG_READ = 148 + SYS_PCICONFIG_WRITE = 149 + SYS_GETSOCKNAME = 150 + SYS_INOTIFY_INIT = 151 + SYS_INOTIFY_ADD_WATCH = 152 + SYS_POLL = 153 + SYS_GETDENTS64 = 154 + SYS_INOTIFY_RM_WATCH = 156 + SYS_STATFS = 157 + SYS_FSTATFS = 158 + SYS_UMOUNT = 159 + SYS_SCHED_SET_AFFINITY = 160 + SYS_SCHED_GET_AFFINITY = 161 + SYS_GETDOMAINNAME = 162 + SYS_SETDOMAINNAME = 163 + SYS_UTRAP_INSTALL = 164 + SYS_QUOTACTL = 165 + SYS_SET_TID_ADDRESS = 166 + SYS_MOUNT = 167 + SYS_USTAT = 168 + SYS_SETXATTR = 169 + SYS_LSETXATTR = 170 + SYS_FSETXATTR = 171 + SYS_GETXATTR = 172 + SYS_LGETXATTR = 173 + SYS_GETDENTS = 174 + SYS_SETSID = 175 + SYS_FCHDIR = 176 + SYS_FGETXATTR = 177 + SYS_LISTXATTR = 178 + SYS_LLISTXATTR = 179 + SYS_FLISTXATTR = 180 + SYS_REMOVEXATTR = 181 + SYS_LREMOVEXATTR = 182 + SYS_SIGPENDING = 183 + SYS_QUERY_MODULE = 184 + SYS_SETPGID = 185 + SYS_FREMOVEXATTR = 186 + SYS_TKILL = 187 + SYS_EXIT_GROUP = 188 + SYS_UNAME = 189 + SYS_INIT_MODULE = 190 + SYS_PERSONALITY = 191 + SYS_REMAP_FILE_PAGES = 192 + SYS_EPOLL_CREATE = 193 + SYS_EPOLL_CTL = 194 + SYS_EPOLL_WAIT = 195 + SYS_IOPRIO_SET = 196 + SYS_GETPPID = 197 + SYS_SIGACTION = 198 + SYS_SGETMASK = 199 + SYS_SSETMASK = 200 + SYS_SIGSUSPEND = 201 + SYS_OLDLSTAT = 202 + SYS_USELIB = 203 + SYS_READDIR = 204 + SYS_READAHEAD = 205 + SYS_SOCKETCALL = 206 + SYS_SYSLOG = 207 + SYS_LOOKUP_DCOOKIE = 208 + SYS_FADVISE64 = 209 + SYS_FADVISE64_64 = 210 + SYS_TGKILL = 211 + SYS_WAITPID = 212 + SYS_SWAPOFF = 213 + SYS_SYSINFO = 214 + SYS_IPC = 215 + SYS_SIGRETURN = 216 + SYS_CLONE = 217 + SYS_IOPRIO_GET = 218 + SYS_ADJTIMEX = 219 + SYS_SIGPROCMASK = 220 + SYS_CREATE_MODULE = 221 + SYS_DELETE_MODULE = 222 + SYS_GET_KERNEL_SYMS = 223 + SYS_GETPGID = 224 + SYS_BDFLUSH = 225 + SYS_SYSFS = 226 + SYS_AFS_SYSCALL = 227 + SYS_SETFSUID = 228 + SYS_SETFSGID = 229 + SYS__NEWSELECT = 230 + SYS_SPLICE = 232 + SYS_STIME = 233 + SYS_STATFS64 = 234 + SYS_FSTATFS64 = 235 + SYS__LLSEEK = 236 + SYS_MLOCK = 237 + SYS_MUNLOCK = 238 + SYS_MLOCKALL = 239 + SYS_MUNLOCKALL = 240 + SYS_SCHED_SETPARAM = 241 + SYS_SCHED_GETPARAM = 242 + SYS_SCHED_SETSCHEDULER = 243 + SYS_SCHED_GETSCHEDULER = 244 + SYS_SCHED_YIELD = 245 + SYS_SCHED_GET_PRIORITY_MAX = 246 + SYS_SCHED_GET_PRIORITY_MIN = 247 + SYS_SCHED_RR_GET_INTERVAL = 248 + SYS_NANOSLEEP = 249 + SYS_MREMAP = 250 + SYS__SYSCTL = 251 + SYS_GETSID = 252 + SYS_FDATASYNC = 253 + SYS_NFSSERVCTL = 254 + SYS_SYNC_FILE_RANGE = 255 + SYS_CLOCK_SETTIME = 256 + SYS_CLOCK_GETTIME = 257 + SYS_CLOCK_GETRES = 258 + SYS_CLOCK_NANOSLEEP = 259 + SYS_SCHED_GETAFFINITY = 260 + SYS_SCHED_SETAFFINITY = 261 + SYS_TIMER_SETTIME = 262 + SYS_TIMER_GETTIME = 263 + SYS_TIMER_GETOVERRUN = 264 + SYS_TIMER_DELETE = 265 + SYS_TIMER_CREATE = 266 + SYS_IO_SETUP = 268 + SYS_IO_DESTROY = 269 + SYS_IO_SUBMIT = 270 + SYS_IO_CANCEL = 271 + SYS_IO_GETEVENTS = 272 + SYS_MQ_OPEN = 273 + SYS_MQ_UNLINK = 274 + SYS_MQ_TIMEDSEND = 275 + SYS_MQ_TIMEDRECEIVE = 276 + SYS_MQ_NOTIFY = 277 + SYS_MQ_GETSETATTR = 278 + SYS_WAITID = 279 + SYS_TEE = 280 + SYS_ADD_KEY = 281 + SYS_REQUEST_KEY = 282 + SYS_KEYCTL = 283 + SYS_OPENAT = 284 + SYS_MKDIRAT = 285 + SYS_MKNODAT = 286 + SYS_FCHOWNAT = 287 + SYS_FUTIMESAT = 288 + SYS_FSTATAT64 = 289 + SYS_UNLINKAT = 290 + SYS_RENAMEAT = 291 + SYS_LINKAT = 292 + SYS_SYMLINKAT = 293 + SYS_READLINKAT = 294 + SYS_FCHMODAT = 295 + SYS_FACCESSAT = 296 + SYS_PSELECT6 = 297 + SYS_PPOLL = 298 + SYS_UNSHARE = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_GET_ROBUST_LIST = 301 + SYS_MIGRATE_PAGES = 302 + SYS_MBIND = 303 + SYS_GET_MEMPOLICY = 304 + SYS_SET_MEMPOLICY = 305 + SYS_KEXEC_LOAD = 306 + SYS_MOVE_PAGES = 307 + SYS_GETCPU = 308 + SYS_EPOLL_PWAIT = 309 + SYS_UTIMENSAT = 310 + SYS_SIGNALFD = 311 + SYS_TIMERFD_CREATE = 312 + SYS_EVENTFD = 313 + SYS_FALLOCATE = 314 + SYS_TIMERFD_SETTIME = 315 + SYS_TIMERFD_GETTIME = 316 + SYS_SIGNALFD4 = 317 + SYS_EVENTFD2 = 318 + SYS_EPOLL_CREATE1 = 319 + SYS_DUP3 = 320 + SYS_PIPE2 = 321 + SYS_INOTIFY_INIT1 = 322 + SYS_ACCEPT4 = 323 + SYS_PREADV = 324 + SYS_PWRITEV = 325 + SYS_RT_TGSIGQUEUEINFO = 326 + SYS_PERF_EVENT_OPEN = 327 + SYS_RECVMMSG = 328 + SYS_FANOTIFY_INIT = 329 + SYS_FANOTIFY_MARK = 330 + SYS_PRLIMIT64 = 331 + SYS_NAME_TO_HANDLE_AT = 332 + SYS_OPEN_BY_HANDLE_AT = 333 + SYS_CLOCK_ADJTIME = 334 + SYS_SYNCFS = 335 + SYS_SENDMMSG = 336 + SYS_SETNS = 337 + SYS_PROCESS_VM_READV = 338 + SYS_PROCESS_VM_WRITEV = 339 + SYS_KERN_FEATURES = 340 + SYS_KCMP = 341 + SYS_FINIT_MODULE = 342 + SYS_SCHED_SETATTR = 343 + SYS_SCHED_GETATTR = 344 + SYS_RENAMEAT2 = 345 + SYS_SECCOMP = 346 + SYS_GETRANDOM = 347 + SYS_MEMFD_CREATE = 348 + SYS_BPF = 349 + SYS_EXECVEAT = 350 + SYS_MEMBARRIER = 351 + SYS_USERFAULTFD = 352 + SYS_BIND = 353 + SYS_LISTEN = 354 + SYS_SETSOCKOPT = 355 + SYS_MLOCK2 = 356 + SYS_COPY_FILE_RANGE = 357 + SYS_PREADV2 = 358 + SYS_PWRITEV2 = 359 +) diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_netbsd_386.go rename to vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go rename to vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_netbsd_arm.go rename to vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_openbsd_386.go rename to vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go rename to vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_solaris_amd64.go rename to vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_darwin_386.go rename to vendor/golang.org/x/sys/unix/ztypes_darwin_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_darwin_amd64.go rename to vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_darwin_arm.go rename to vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_darwin_arm64.go rename to vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go rename to vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_freebsd_386.go rename to vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_freebsd_amd64.go rename to vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_freebsd_arm.go rename to vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_386.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_amd64.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go similarity index 98% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_arm.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 817ac9c29a..35f11bd1bc 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -1,6 +1,6 @@ // +build arm,linux // Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_linux.go +// cgo -godefs types_linux.go | go run mkpost.go package unix @@ -155,6 +155,15 @@ type Flock_t struct { Pad_cgo_1 [4]byte } +const ( + FADV_NORMAL = 0x0 + FADV_RANDOM = 0x1 + FADV_SEQUENTIAL = 0x2 + FADV_WILLNEED = 0x3 + FADV_DONTNEED = 0x4 + FADV_NOREUSE = 0x5 +) + type RawSockaddrInet4 struct { Family uint16 Port uint16 diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_arm64.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_mips64.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_mips64le.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_ppc64.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_ppc64le.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_linux_s390x.go rename to vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go new file mode 100644 index 0000000000..7d18b704af --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -0,0 +1,640 @@ +// +build sparc64,linux +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_linux.go | go run mkpost.go + +package unix + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 + PathMax = 0x1000 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int32 + Pad_cgo_0 [4]byte +} + +type Timex struct { + Modes uint32 + Pad_cgo_0 [4]byte + Offset int64 + Freq int64 + Maxerror int64 + Esterror int64 + Status int32 + Pad_cgo_1 [4]byte + Constant int64 + Precision int64 + Tolerance int64 + Time Timeval + Tick int64 + Ppsfreq int64 + Jitter int64 + Shift int32 + Pad_cgo_2 [4]byte + Stabil int64 + Jitcnt int64 + Calcnt int64 + Errcnt int64 + Stbcnt int64 + Tai int32 + Pad_cgo_3 [44]byte +} + +type Time_t int64 + +type Tms struct { + Utime int64 + Stime int64 + Cutime int64 + Cstime int64 +} + +type Utimbuf struct { + Actime int64 + Modtime int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type _Gid_t uint32 + +type Stat_t struct { + Dev uint64 + X__pad1 uint16 + Pad_cgo_0 [6]byte + Ino uint64 + Mode uint32 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev uint64 + X__pad2 uint16 + Pad_cgo_1 [6]byte + Size int64 + Blksize int64 + Blocks int64 + Atim Timespec + Mtim Timespec + Ctim Timespec + X__glibc_reserved4 uint64 + X__glibc_reserved5 uint64 +} + +type Statfs_t struct { + Type int64 + Bsize int64 + Blocks uint64 + Bfree uint64 + Bavail uint64 + Files uint64 + Ffree uint64 + Fsid Fsid + Namelen int64 + Frsize int64 + Flags int64 + Spare [4]int64 +} + +type Dirent struct { + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + Pad_cgo_0 [5]byte +} + +type Fsid struct { + X__val [2]int32 +} + +type Flock_t struct { + Type int16 + Whence int16 + Pad_cgo_0 [4]byte + Start int64 + Len int64 + Pid int32 + X__glibc_reserved int16 + Pad_cgo_1 [2]byte +} + +const ( + FADV_NORMAL = 0x0 + FADV_RANDOM = 0x1 + FADV_SEQUENTIAL = 0x2 + FADV_WILLNEED = 0x3 + FADV_DONTNEED = 0x4 + FADV_NOREUSE = 0x5 +) + +type RawSockaddrInet4 struct { + Family uint16 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]uint8 +} + +type RawSockaddrInet6 struct { + Family uint16 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Family uint16 + Path [108]int8 +} + +type RawSockaddrLinklayer struct { + Family uint16 + Protocol uint16 + Ifindex int32 + Hatype uint16 + Pkttype uint8 + Halen uint8 + Addr [8]uint8 +} + +type RawSockaddrNetlink struct { + Family uint16 + Pad uint16 + Pid uint32 + Groups uint32 +} + +type RawSockaddrHCI struct { + Family uint16 + Dev uint16 + Channel uint16 +} + +type RawSockaddr struct { + Family uint16 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [96]int8 +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPMreqn struct { + Multiaddr [4]byte /* in_addr */ + Address [4]byte /* in_addr */ + Ifindex int32 +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Pad_cgo_0 [4]byte + Iov *Iovec + Iovlen uint64 + Control *byte + Controllen uint64 + Flags int32 + Pad_cgo_1 [4]byte +} + +type Cmsghdr struct { + Len uint64 + Level int32 + Type int32 +} + +type Inet4Pktinfo struct { + Ifindex int32 + Spec_dst [4]byte /* in_addr */ + Addr [4]byte /* in_addr */ +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Data [8]uint32 +} + +type Ucred struct { + Pid int32 + Uid uint32 + Gid uint32 +} + +type TCPInfo struct { + State uint8 + Ca_state uint8 + Retransmits uint8 + Probes uint8 + Backoff uint8 + Options uint8 + Pad_cgo_0 [2]byte + Rto uint32 + Ato uint32 + Snd_mss uint32 + Rcv_mss uint32 + Unacked uint32 + Sacked uint32 + Lost uint32 + Retrans uint32 + Fackets uint32 + Last_data_sent uint32 + Last_ack_sent uint32 + Last_data_recv uint32 + Last_ack_recv uint32 + Pmtu uint32 + Rcv_ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Snd_ssthresh uint32 + Snd_cwnd uint32 + Advmss uint32 + Reordering uint32 + Rcv_rtt uint32 + Rcv_space uint32 + Total_retrans uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x70 + SizeofSockaddrUnix = 0x6e + SizeofSockaddrLinklayer = 0x14 + SizeofSockaddrNetlink = 0xc + SizeofSockaddrHCI = 0x6 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 + SizeofInet4Pktinfo = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 + SizeofUcred = 0xc + SizeofTCPInfo = 0x68 +) + +const ( + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_MAX = 0x2a + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 +) + +type NlMsghdr struct { + Len uint32 + Type uint16 + Flags uint16 + Seq uint32 + Pid uint32 +} + +type NlMsgerr struct { + Error int32 + Msg NlMsghdr +} + +type RtGenmsg struct { + Family uint8 +} + +type NlAttr struct { + Len uint16 + Type uint16 +} + +type RtAttr struct { + Len uint16 + Type uint16 +} + +type IfInfomsg struct { + Family uint8 + X__ifi_pad uint8 + Type uint16 + Index int32 + Flags uint32 + Change uint32 +} + +type IfAddrmsg struct { + Family uint8 + Prefixlen uint8 + Flags uint8 + Scope uint8 + Index uint32 +} + +type RtMsg struct { + Family uint8 + Dst_len uint8 + Src_len uint8 + Tos uint8 + Table uint8 + Protocol uint8 + Scope uint8 + Type uint8 + Flags uint32 +} + +type RtNexthop struct { + Len uint16 + Flags uint8 + Hops uint8 + Ifindex int32 +} + +const ( + SizeofSockFilter = 0x8 + SizeofSockFprog = 0x10 +) + +type SockFilter struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type SockFprog struct { + Len uint16 + Pad_cgo_0 [6]byte + Filter *SockFilter +} + +type InotifyEvent struct { + Wd int32 + Mask uint32 + Cookie uint32 + Len uint32 +} + +const SizeofInotifyEvent = 0x10 + +type PtraceRegs struct { + Regs [16]uint64 + Tstate uint64 + Tpc uint64 + Tnpc uint64 + Y uint32 + Magic uint32 +} + +type ptracePsw struct { +} + +type ptraceFpregs struct { +} + +type ptracePer struct { +} + +type FdSet struct { + Bits [16]int64 +} + +type Sysinfo_t struct { + Uptime int64 + Loads [3]uint64 + Totalram uint64 + Freeram uint64 + Sharedram uint64 + Bufferram uint64 + Totalswap uint64 + Freeswap uint64 + Procs uint16 + Pad uint16 + Pad_cgo_0 [4]byte + Totalhigh uint64 + Freehigh uint64 + Unit uint32 + X_f [0]int8 + Pad_cgo_1 [4]byte +} + +type Utsname struct { + Sysname [65]int8 + Nodename [65]int8 + Release [65]int8 + Version [65]int8 + Machine [65]int8 + Domainname [65]int8 +} + +type Ustat_t struct { + Tfree int32 + Pad_cgo_0 [4]byte + Tinode uint64 + Fname [6]int8 + Fpack [6]int8 + Pad_cgo_1 [4]byte +} + +type EpollEvent struct { + Events uint32 + X_padFd int32 + Fd int32 + Pad int32 +} + +const ( + AT_FDCWD = -0x64 + AT_REMOVEDIR = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_SYMLINK_NOFOLLOW = 0x100 +) + +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +const ( + POLLIN = 0x1 + POLLPRI = 0x2 + POLLOUT = 0x4 + POLLRDHUP = 0x800 + POLLERR = 0x8 + POLLHUP = 0x10 + POLLNVAL = 0x20 +) + +type Sigset_t struct { + X__val [16]uint64 +} + +const _SC_PAGESIZE = 0x1e + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Line uint8 + Cc [19]uint8 + Ispeed uint32 + Ospeed uint32 +} diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_netbsd_386.go rename to vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_netbsd_amd64.go rename to vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_netbsd_arm.go rename to vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_openbsd_386.go rename to vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_openbsd_amd64.go rename to vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go diff --git a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go similarity index 98% rename from Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_solaris_amd64.go rename to vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index b3b928a51e..02777e4d8d 100644 --- a/Godeps/_workspace/src/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -1,6 +1,6 @@ // +build amd64,solaris // Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_solaris.go +// cgo -godefs types_solaris.go | go run mkpost.go package unix @@ -11,6 +11,7 @@ const ( sizeofLong = 0x8 sizeofLongLong = 0x8 PathMax = 0x400 + MaxHostNameLen = 0x100 ) type ( diff --git a/vendor/golang.org/x/text/.gitattributes b/vendor/golang.org/x/text/.gitattributes new file mode 100644 index 0000000000..d2f212e5da --- /dev/null +++ b/vendor/golang.org/x/text/.gitattributes @@ -0,0 +1,10 @@ +# Treat all files in this repo as binary, with no git magic updating +# line endings. Windows users contributing to Go will need to use a +# modern version of git and editors capable of LF line endings. +# +# We'll prevent accidental CRLF line endings from entering the repo +# via the git-review gofmt checks. +# +# See golang.org/issue/9281 + +* -text diff --git a/vendor/golang.org/x/text/.gitignore b/vendor/golang.org/x/text/.gitignore new file mode 100644 index 0000000000..782aa6b4c8 --- /dev/null +++ b/vendor/golang.org/x/text/.gitignore @@ -0,0 +1,3 @@ +# Add no patterns to .gitignore except for files generated by the build. +last-change +/DATA diff --git a/vendor/golang.org/x/text/AUTHORS b/vendor/golang.org/x/text/AUTHORS new file mode 100644 index 0000000000..15167cd746 --- /dev/null +++ b/vendor/golang.org/x/text/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/text/CONTRIBUTING.md b/vendor/golang.org/x/text/CONTRIBUTING.md new file mode 100644 index 0000000000..88dff59bc7 --- /dev/null +++ b/vendor/golang.org/x/text/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing to Go + +Go is an open source project. + +It is the work of hundreds of contributors. We appreciate your help! + + +## Filing issues + +When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: + +1. What version of Go are you using (`go version`)? +2. What operating system and processor architecture are you using? +3. What did you do? +4. What did you expect to see? +5. What did you see instead? + +General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. +The gophers there will answer or ask you to file an issue if you've tripped over a bug. + +## Contributing code + +Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) +before sending patches. + +**We do not accept GitHub pull requests** +(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). + +Unless otherwise noted, the Go source files are distributed under +the BSD-style license found in the LICENSE file. + diff --git a/vendor/golang.org/x/text/CONTRIBUTORS b/vendor/golang.org/x/text/CONTRIBUTORS new file mode 100644 index 0000000000..1c4577e968 --- /dev/null +++ b/vendor/golang.org/x/text/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/Godeps/_workspace/src/golang.org/x/tools/LICENSE b/vendor/golang.org/x/text/LICENSE similarity index 100% rename from Godeps/_workspace/src/golang.org/x/tools/LICENSE rename to vendor/golang.org/x/text/LICENSE diff --git a/Godeps/_workspace/src/golang.org/x/text/PATENTS b/vendor/golang.org/x/text/PATENTS similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/PATENTS rename to vendor/golang.org/x/text/PATENTS diff --git a/vendor/golang.org/x/text/README b/vendor/golang.org/x/text/README new file mode 100644 index 0000000000..4826fe8fb6 --- /dev/null +++ b/vendor/golang.org/x/text/README @@ -0,0 +1,23 @@ +This repository holds supplementary Go libraries for text processing, many involving Unicode. + +To submit changes to this repository, see http://golang.org/doc/contribute.html. + +To generate the tables in this repository (except for the encoding tables), +run go generate from this directory. By default tables are generated for the +Unicode version in core and the CLDR version defined in +golang.org/x/text/unicode/cldr. + +Running go generate will as a side effect create a DATA subdirectory in this +directory which holds all files that are used as a source for generating the +tables. This directory will also serve as a cache. + +Run + + go test ./... + +from this directory to run all tests. Add the "-tags icu" flag to also run +ICU conformance tests (if available). This requires that you have the correct +ICU version installed on your system. + +TODO: +- updating unversioned source files. \ No newline at end of file diff --git a/vendor/golang.org/x/text/codereview.cfg b/vendor/golang.org/x/text/codereview.cfg new file mode 100644 index 0000000000..3f8b14b64e --- /dev/null +++ b/vendor/golang.org/x/text/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go b/vendor/golang.org/x/text/encoding/charmap/charmap.go similarity index 98% rename from Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go rename to vendor/golang.org/x/text/encoding/charmap/charmap.go index 2a953075d9..6e62a83747 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/charmap.go +++ b/vendor/golang.org/x/text/encoding/charmap/charmap.go @@ -6,7 +6,7 @@ // Package charmap provides simple character encodings such as IBM Code Page 437 // and Windows 1252. -package charmap +package charmap // import "golang.org/x/text/encoding/charmap" import ( "unicode/utf8" diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/maketables.go b/vendor/golang.org/x/text/encoding/charmap/maketables.go similarity index 95% rename from Godeps/_workspace/src/golang.org/x/text/encoding/charmap/maketables.go rename to vendor/golang.org/x/text/encoding/charmap/maketables.go index 099108121c..9672c552db 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/maketables.go +++ b/vendor/golang.org/x/text/encoding/charmap/maketables.go @@ -73,6 +73,14 @@ var encodings = []struct { encoding.ASCIISub, "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/windows-858-2000.ucm", }, + { + "IBM Code Page 860", + "IBM860", + "", + "CodePage860", + encoding.ASCIISub, + "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/glibc-IBM860-2.1.2.ucm", + }, { "IBM Code Page 862", "PC862LatinHebrew", @@ -81,6 +89,22 @@ var encodings = []struct { encoding.ASCIISub, "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/glibc-IBM862-2.1.2.ucm", }, + { + "IBM Code Page 863", + "IBM863", + "", + "CodePage863", + encoding.ASCIISub, + "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/glibc-IBM863-2.1.2.ucm", + }, + { + "IBM Code Page 865", + "IBM865", + "", + "CodePage865", + encoding.ASCIISub, + "http://source.icu-project.org/repos/icu/data/trunk/charset/data/ucm/glibc-IBM865-2.1.2.ucm", + }, { "IBM Code Page 866", "IBM866", diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/tables.go b/vendor/golang.org/x/text/encoding/charmap/tables.go similarity index 92% rename from Godeps/_workspace/src/golang.org/x/text/encoding/charmap/tables.go rename to vendor/golang.org/x/text/encoding/charmap/tables.go index 2bcef84d36..5ae8dbcfa6 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/charmap/tables.go +++ b/vendor/golang.org/x/text/encoding/charmap/tables.go @@ -882,6 +882,181 @@ var codePage858 = charmap{ }, } +// CodePage860 is the IBM Code Page 860 encoding. +var CodePage860 encoding.Encoding = &codePage860 + +var codePage860 = charmap{ + name: "IBM Code Page 860", + mib: identifier.IBM860, + asciiSuperset: true, + low: 0x80, + replacement: 0x1a, + decode: [256]utf8Enc{ + {1, [3]byte{0x00, 0x00, 0x00}}, {1, [3]byte{0x01, 0x00, 0x00}}, + {1, [3]byte{0x02, 0x00, 0x00}}, {1, [3]byte{0x03, 0x00, 0x00}}, + {1, [3]byte{0x04, 0x00, 0x00}}, {1, [3]byte{0x05, 0x00, 0x00}}, + {1, [3]byte{0x06, 0x00, 0x00}}, {1, [3]byte{0x07, 0x00, 0x00}}, + {1, [3]byte{0x08, 0x00, 0x00}}, {1, [3]byte{0x09, 0x00, 0x00}}, + {1, [3]byte{0x0a, 0x00, 0x00}}, {1, [3]byte{0x0b, 0x00, 0x00}}, + {1, [3]byte{0x0c, 0x00, 0x00}}, {1, [3]byte{0x0d, 0x00, 0x00}}, + {1, [3]byte{0x0e, 0x00, 0x00}}, {1, [3]byte{0x0f, 0x00, 0x00}}, + {1, [3]byte{0x10, 0x00, 0x00}}, {1, [3]byte{0x11, 0x00, 0x00}}, + {1, [3]byte{0x12, 0x00, 0x00}}, {1, [3]byte{0x13, 0x00, 0x00}}, + {1, [3]byte{0x14, 0x00, 0x00}}, {1, [3]byte{0x15, 0x00, 0x00}}, + {1, [3]byte{0x16, 0x00, 0x00}}, {1, [3]byte{0x17, 0x00, 0x00}}, + {1, [3]byte{0x18, 0x00, 0x00}}, {1, [3]byte{0x19, 0x00, 0x00}}, + {1, [3]byte{0x1a, 0x00, 0x00}}, {1, [3]byte{0x1b, 0x00, 0x00}}, + {1, [3]byte{0x1c, 0x00, 0x00}}, {1, [3]byte{0x1d, 0x00, 0x00}}, + {1, [3]byte{0x1e, 0x00, 0x00}}, {1, [3]byte{0x1f, 0x00, 0x00}}, + {1, [3]byte{0x20, 0x00, 0x00}}, {1, [3]byte{0x21, 0x00, 0x00}}, + {1, [3]byte{0x22, 0x00, 0x00}}, {1, [3]byte{0x23, 0x00, 0x00}}, + {1, [3]byte{0x24, 0x00, 0x00}}, {1, [3]byte{0x25, 0x00, 0x00}}, + {1, [3]byte{0x26, 0x00, 0x00}}, {1, [3]byte{0x27, 0x00, 0x00}}, + {1, [3]byte{0x28, 0x00, 0x00}}, {1, [3]byte{0x29, 0x00, 0x00}}, + {1, [3]byte{0x2a, 0x00, 0x00}}, {1, [3]byte{0x2b, 0x00, 0x00}}, + {1, [3]byte{0x2c, 0x00, 0x00}}, {1, [3]byte{0x2d, 0x00, 0x00}}, + {1, [3]byte{0x2e, 0x00, 0x00}}, {1, [3]byte{0x2f, 0x00, 0x00}}, + {1, [3]byte{0x30, 0x00, 0x00}}, {1, [3]byte{0x31, 0x00, 0x00}}, + {1, [3]byte{0x32, 0x00, 0x00}}, {1, [3]byte{0x33, 0x00, 0x00}}, + {1, [3]byte{0x34, 0x00, 0x00}}, {1, [3]byte{0x35, 0x00, 0x00}}, + {1, [3]byte{0x36, 0x00, 0x00}}, {1, [3]byte{0x37, 0x00, 0x00}}, + {1, [3]byte{0x38, 0x00, 0x00}}, {1, [3]byte{0x39, 0x00, 0x00}}, + {1, [3]byte{0x3a, 0x00, 0x00}}, {1, [3]byte{0x3b, 0x00, 0x00}}, + {1, [3]byte{0x3c, 0x00, 0x00}}, {1, [3]byte{0x3d, 0x00, 0x00}}, + {1, [3]byte{0x3e, 0x00, 0x00}}, {1, [3]byte{0x3f, 0x00, 0x00}}, + {1, [3]byte{0x40, 0x00, 0x00}}, {1, [3]byte{0x41, 0x00, 0x00}}, + {1, [3]byte{0x42, 0x00, 0x00}}, {1, [3]byte{0x43, 0x00, 0x00}}, + {1, [3]byte{0x44, 0x00, 0x00}}, {1, [3]byte{0x45, 0x00, 0x00}}, + {1, [3]byte{0x46, 0x00, 0x00}}, {1, [3]byte{0x47, 0x00, 0x00}}, + {1, [3]byte{0x48, 0x00, 0x00}}, {1, [3]byte{0x49, 0x00, 0x00}}, + {1, [3]byte{0x4a, 0x00, 0x00}}, {1, [3]byte{0x4b, 0x00, 0x00}}, + {1, [3]byte{0x4c, 0x00, 0x00}}, {1, [3]byte{0x4d, 0x00, 0x00}}, + {1, [3]byte{0x4e, 0x00, 0x00}}, {1, [3]byte{0x4f, 0x00, 0x00}}, + {1, [3]byte{0x50, 0x00, 0x00}}, {1, [3]byte{0x51, 0x00, 0x00}}, + {1, [3]byte{0x52, 0x00, 0x00}}, {1, [3]byte{0x53, 0x00, 0x00}}, + {1, [3]byte{0x54, 0x00, 0x00}}, {1, [3]byte{0x55, 0x00, 0x00}}, + {1, [3]byte{0x56, 0x00, 0x00}}, {1, [3]byte{0x57, 0x00, 0x00}}, + {1, [3]byte{0x58, 0x00, 0x00}}, {1, [3]byte{0x59, 0x00, 0x00}}, + {1, [3]byte{0x5a, 0x00, 0x00}}, {1, [3]byte{0x5b, 0x00, 0x00}}, + {1, [3]byte{0x5c, 0x00, 0x00}}, {1, [3]byte{0x5d, 0x00, 0x00}}, + {1, [3]byte{0x5e, 0x00, 0x00}}, {1, [3]byte{0x5f, 0x00, 0x00}}, + {1, [3]byte{0x60, 0x00, 0x00}}, {1, [3]byte{0x61, 0x00, 0x00}}, + {1, [3]byte{0x62, 0x00, 0x00}}, {1, [3]byte{0x63, 0x00, 0x00}}, + {1, [3]byte{0x64, 0x00, 0x00}}, {1, [3]byte{0x65, 0x00, 0x00}}, + {1, [3]byte{0x66, 0x00, 0x00}}, {1, [3]byte{0x67, 0x00, 0x00}}, + {1, [3]byte{0x68, 0x00, 0x00}}, {1, [3]byte{0x69, 0x00, 0x00}}, + {1, [3]byte{0x6a, 0x00, 0x00}}, {1, [3]byte{0x6b, 0x00, 0x00}}, + {1, [3]byte{0x6c, 0x00, 0x00}}, {1, [3]byte{0x6d, 0x00, 0x00}}, + {1, [3]byte{0x6e, 0x00, 0x00}}, {1, [3]byte{0x6f, 0x00, 0x00}}, + {1, [3]byte{0x70, 0x00, 0x00}}, {1, [3]byte{0x71, 0x00, 0x00}}, + {1, [3]byte{0x72, 0x00, 0x00}}, {1, [3]byte{0x73, 0x00, 0x00}}, + {1, [3]byte{0x74, 0x00, 0x00}}, {1, [3]byte{0x75, 0x00, 0x00}}, + {1, [3]byte{0x76, 0x00, 0x00}}, {1, [3]byte{0x77, 0x00, 0x00}}, + {1, [3]byte{0x78, 0x00, 0x00}}, {1, [3]byte{0x79, 0x00, 0x00}}, + {1, [3]byte{0x7a, 0x00, 0x00}}, {1, [3]byte{0x7b, 0x00, 0x00}}, + {1, [3]byte{0x7c, 0x00, 0x00}}, {1, [3]byte{0x7d, 0x00, 0x00}}, + {1, [3]byte{0x7e, 0x00, 0x00}}, {1, [3]byte{0x7f, 0x00, 0x00}}, + {2, [3]byte{0xc3, 0x87, 0x00}}, {2, [3]byte{0xc3, 0xbc, 0x00}}, + {2, [3]byte{0xc3, 0xa9, 0x00}}, {2, [3]byte{0xc3, 0xa2, 0x00}}, + {2, [3]byte{0xc3, 0xa3, 0x00}}, {2, [3]byte{0xc3, 0xa0, 0x00}}, + {2, [3]byte{0xc3, 0x81, 0x00}}, {2, [3]byte{0xc3, 0xa7, 0x00}}, + {2, [3]byte{0xc3, 0xaa, 0x00}}, {2, [3]byte{0xc3, 0x8a, 0x00}}, + {2, [3]byte{0xc3, 0xa8, 0x00}}, {2, [3]byte{0xc3, 0x8d, 0x00}}, + {2, [3]byte{0xc3, 0x94, 0x00}}, {2, [3]byte{0xc3, 0xac, 0x00}}, + {2, [3]byte{0xc3, 0x83, 0x00}}, {2, [3]byte{0xc3, 0x82, 0x00}}, + {2, [3]byte{0xc3, 0x89, 0x00}}, {2, [3]byte{0xc3, 0x80, 0x00}}, + {2, [3]byte{0xc3, 0x88, 0x00}}, {2, [3]byte{0xc3, 0xb4, 0x00}}, + {2, [3]byte{0xc3, 0xb5, 0x00}}, {2, [3]byte{0xc3, 0xb2, 0x00}}, + {2, [3]byte{0xc3, 0x9a, 0x00}}, {2, [3]byte{0xc3, 0xb9, 0x00}}, + {2, [3]byte{0xc3, 0x8c, 0x00}}, {2, [3]byte{0xc3, 0x95, 0x00}}, + {2, [3]byte{0xc3, 0x9c, 0x00}}, {2, [3]byte{0xc2, 0xa2, 0x00}}, + {2, [3]byte{0xc2, 0xa3, 0x00}}, {2, [3]byte{0xc3, 0x99, 0x00}}, + {3, [3]byte{0xe2, 0x82, 0xa7}}, {2, [3]byte{0xc3, 0x93, 0x00}}, + {2, [3]byte{0xc3, 0xa1, 0x00}}, {2, [3]byte{0xc3, 0xad, 0x00}}, + {2, [3]byte{0xc3, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0xba, 0x00}}, + {2, [3]byte{0xc3, 0xb1, 0x00}}, {2, [3]byte{0xc3, 0x91, 0x00}}, + {2, [3]byte{0xc2, 0xaa, 0x00}}, {2, [3]byte{0xc2, 0xba, 0x00}}, + {2, [3]byte{0xc2, 0xbf, 0x00}}, {2, [3]byte{0xc3, 0x92, 0x00}}, + {2, [3]byte{0xc2, 0xac, 0x00}}, {2, [3]byte{0xc2, 0xbd, 0x00}}, + {2, [3]byte{0xc2, 0xbc, 0x00}}, {2, [3]byte{0xc2, 0xa1, 0x00}}, + {2, [3]byte{0xc2, 0xab, 0x00}}, {2, [3]byte{0xc2, 0xbb, 0x00}}, + {3, [3]byte{0xe2, 0x96, 0x91}}, {3, [3]byte{0xe2, 0x96, 0x92}}, + {3, [3]byte{0xe2, 0x96, 0x93}}, {3, [3]byte{0xe2, 0x94, 0x82}}, + {3, [3]byte{0xe2, 0x94, 0xa4}}, {3, [3]byte{0xe2, 0x95, 0xa1}}, + {3, [3]byte{0xe2, 0x95, 0xa2}}, {3, [3]byte{0xe2, 0x95, 0x96}}, + {3, [3]byte{0xe2, 0x95, 0x95}}, {3, [3]byte{0xe2, 0x95, 0xa3}}, + {3, [3]byte{0xe2, 0x95, 0x91}}, {3, [3]byte{0xe2, 0x95, 0x97}}, + {3, [3]byte{0xe2, 0x95, 0x9d}}, {3, [3]byte{0xe2, 0x95, 0x9c}}, + {3, [3]byte{0xe2, 0x95, 0x9b}}, {3, [3]byte{0xe2, 0x94, 0x90}}, + {3, [3]byte{0xe2, 0x94, 0x94}}, {3, [3]byte{0xe2, 0x94, 0xb4}}, + {3, [3]byte{0xe2, 0x94, 0xac}}, {3, [3]byte{0xe2, 0x94, 0x9c}}, + {3, [3]byte{0xe2, 0x94, 0x80}}, {3, [3]byte{0xe2, 0x94, 0xbc}}, + {3, [3]byte{0xe2, 0x95, 0x9e}}, {3, [3]byte{0xe2, 0x95, 0x9f}}, + {3, [3]byte{0xe2, 0x95, 0x9a}}, {3, [3]byte{0xe2, 0x95, 0x94}}, + {3, [3]byte{0xe2, 0x95, 0xa9}}, {3, [3]byte{0xe2, 0x95, 0xa6}}, + {3, [3]byte{0xe2, 0x95, 0xa0}}, {3, [3]byte{0xe2, 0x95, 0x90}}, + {3, [3]byte{0xe2, 0x95, 0xac}}, {3, [3]byte{0xe2, 0x95, 0xa7}}, + {3, [3]byte{0xe2, 0x95, 0xa8}}, {3, [3]byte{0xe2, 0x95, 0xa4}}, + {3, [3]byte{0xe2, 0x95, 0xa5}}, {3, [3]byte{0xe2, 0x95, 0x99}}, + {3, [3]byte{0xe2, 0x95, 0x98}}, {3, [3]byte{0xe2, 0x95, 0x92}}, + {3, [3]byte{0xe2, 0x95, 0x93}}, {3, [3]byte{0xe2, 0x95, 0xab}}, + {3, [3]byte{0xe2, 0x95, 0xaa}}, {3, [3]byte{0xe2, 0x94, 0x98}}, + {3, [3]byte{0xe2, 0x94, 0x8c}}, {3, [3]byte{0xe2, 0x96, 0x88}}, + {3, [3]byte{0xe2, 0x96, 0x84}}, {3, [3]byte{0xe2, 0x96, 0x8c}}, + {3, [3]byte{0xe2, 0x96, 0x90}}, {3, [3]byte{0xe2, 0x96, 0x80}}, + {2, [3]byte{0xce, 0xb1, 0x00}}, {2, [3]byte{0xc3, 0x9f, 0x00}}, + {2, [3]byte{0xce, 0x93, 0x00}}, {2, [3]byte{0xcf, 0x80, 0x00}}, + {2, [3]byte{0xce, 0xa3, 0x00}}, {2, [3]byte{0xcf, 0x83, 0x00}}, + {2, [3]byte{0xc2, 0xb5, 0x00}}, {2, [3]byte{0xcf, 0x84, 0x00}}, + {2, [3]byte{0xce, 0xa6, 0x00}}, {2, [3]byte{0xce, 0x98, 0x00}}, + {2, [3]byte{0xce, 0xa9, 0x00}}, {2, [3]byte{0xce, 0xb4, 0x00}}, + {3, [3]byte{0xe2, 0x88, 0x9e}}, {2, [3]byte{0xcf, 0x86, 0x00}}, + {2, [3]byte{0xce, 0xb5, 0x00}}, {3, [3]byte{0xe2, 0x88, 0xa9}}, + {3, [3]byte{0xe2, 0x89, 0xa1}}, {2, [3]byte{0xc2, 0xb1, 0x00}}, + {3, [3]byte{0xe2, 0x89, 0xa5}}, {3, [3]byte{0xe2, 0x89, 0xa4}}, + {3, [3]byte{0xe2, 0x8c, 0xa0}}, {3, [3]byte{0xe2, 0x8c, 0xa1}}, + {2, [3]byte{0xc3, 0xb7, 0x00}}, {3, [3]byte{0xe2, 0x89, 0x88}}, + {2, [3]byte{0xc2, 0xb0, 0x00}}, {3, [3]byte{0xe2, 0x88, 0x99}}, + {2, [3]byte{0xc2, 0xb7, 0x00}}, {3, [3]byte{0xe2, 0x88, 0x9a}}, + {3, [3]byte{0xe2, 0x81, 0xbf}}, {2, [3]byte{0xc2, 0xb2, 0x00}}, + {3, [3]byte{0xe2, 0x96, 0xa0}}, {2, [3]byte{0xc2, 0xa0, 0x00}}, + }, + encode: [256]uint32{ + 0x00000000, 0x01000001, 0x02000002, 0x03000003, 0x04000004, 0x05000005, 0x06000006, 0x07000007, + 0x08000008, 0x09000009, 0x0a00000a, 0x0b00000b, 0x0c00000c, 0x0d00000d, 0x0e00000e, 0x0f00000f, + 0x10000010, 0x11000011, 0x12000012, 0x13000013, 0x14000014, 0x15000015, 0x16000016, 0x17000017, + 0x18000018, 0x19000019, 0x1a00001a, 0x1b00001b, 0x1c00001c, 0x1d00001d, 0x1e00001e, 0x1f00001f, + 0x20000020, 0x21000021, 0x22000022, 0x23000023, 0x24000024, 0x25000025, 0x26000026, 0x27000027, + 0x28000028, 0x29000029, 0x2a00002a, 0x2b00002b, 0x2c00002c, 0x2d00002d, 0x2e00002e, 0x2f00002f, + 0x30000030, 0x31000031, 0x32000032, 0x33000033, 0x34000034, 0x35000035, 0x36000036, 0x37000037, + 0x38000038, 0x39000039, 0x3a00003a, 0x3b00003b, 0x3c00003c, 0x3d00003d, 0x3e00003e, 0x3f00003f, + 0x40000040, 0x41000041, 0x42000042, 0x43000043, 0x44000044, 0x45000045, 0x46000046, 0x47000047, + 0x48000048, 0x49000049, 0x4a00004a, 0x4b00004b, 0x4c00004c, 0x4d00004d, 0x4e00004e, 0x4f00004f, + 0x50000050, 0x51000051, 0x52000052, 0x53000053, 0x54000054, 0x55000055, 0x56000056, 0x57000057, + 0x58000058, 0x59000059, 0x5a00005a, 0x5b00005b, 0x5c00005c, 0x5d00005d, 0x5e00005e, 0x5f00005f, + 0x60000060, 0x61000061, 0x62000062, 0x63000063, 0x64000064, 0x65000065, 0x66000066, 0x67000067, + 0x68000068, 0x69000069, 0x6a00006a, 0x6b00006b, 0x6c00006c, 0x6d00006d, 0x6e00006e, 0x6f00006f, + 0x70000070, 0x71000071, 0x72000072, 0x73000073, 0x74000074, 0x75000075, 0x76000076, 0x77000077, + 0x78000078, 0x79000079, 0x7a00007a, 0x7b00007b, 0x7c00007c, 0x7d00007d, 0x7e00007e, 0x7f00007f, + 0xff0000a0, 0xad0000a1, 0x9b0000a2, 0x9c0000a3, 0xa60000aa, 0xae0000ab, 0xaa0000ac, 0xf80000b0, + 0xf10000b1, 0xfd0000b2, 0xe60000b5, 0xfa0000b7, 0xa70000ba, 0xaf0000bb, 0xac0000bc, 0xab0000bd, + 0xa80000bf, 0x910000c0, 0x860000c1, 0x8f0000c2, 0x8e0000c3, 0x800000c7, 0x920000c8, 0x900000c9, + 0x890000ca, 0x980000cc, 0x8b0000cd, 0xa50000d1, 0xa90000d2, 0x9f0000d3, 0x8c0000d4, 0x990000d5, + 0x9d0000d9, 0x960000da, 0x9a0000dc, 0xe10000df, 0x850000e0, 0xa00000e1, 0x830000e2, 0x840000e3, + 0x870000e7, 0x8a0000e8, 0x820000e9, 0x880000ea, 0x8d0000ec, 0xa10000ed, 0xa40000f1, 0x950000f2, + 0xa20000f3, 0x930000f4, 0x940000f5, 0xf60000f7, 0x970000f9, 0xa30000fa, 0x810000fc, 0xe2000393, + 0xe9000398, 0xe40003a3, 0xe80003a6, 0xea0003a9, 0xe00003b1, 0xeb0003b4, 0xee0003b5, 0xe30003c0, + 0xe50003c3, 0xe70003c4, 0xed0003c6, 0xfc00207f, 0x9e0020a7, 0xf9002219, 0xfb00221a, 0xec00221e, + 0xef002229, 0xf7002248, 0xf0002261, 0xf3002264, 0xf2002265, 0xf4002320, 0xf5002321, 0xc4002500, + 0xb3002502, 0xda00250c, 0xbf002510, 0xc0002514, 0xd9002518, 0xc300251c, 0xb4002524, 0xc200252c, + 0xc1002534, 0xc500253c, 0xcd002550, 0xba002551, 0xd5002552, 0xd6002553, 0xc9002554, 0xb8002555, + 0xb7002556, 0xbb002557, 0xd4002558, 0xd3002559, 0xc800255a, 0xbe00255b, 0xbd00255c, 0xbc00255d, + 0xc600255e, 0xc700255f, 0xcc002560, 0xb5002561, 0xb6002562, 0xb9002563, 0xd1002564, 0xd2002565, + 0xcb002566, 0xcf002567, 0xd0002568, 0xca002569, 0xd800256a, 0xd700256b, 0xce00256c, 0xdf002580, + 0xdc002584, 0xdb002588, 0xdd00258c, 0xde002590, 0xb0002591, 0xb1002592, 0xb2002593, 0xfe0025a0, + }, +} + // CodePage862 is the IBM Code Page 862 encoding. var CodePage862 encoding.Encoding = &codePage862 @@ -1057,6 +1232,356 @@ var codePage862 = charmap{ }, } +// CodePage863 is the IBM Code Page 863 encoding. +var CodePage863 encoding.Encoding = &codePage863 + +var codePage863 = charmap{ + name: "IBM Code Page 863", + mib: identifier.IBM863, + asciiSuperset: true, + low: 0x80, + replacement: 0x1a, + decode: [256]utf8Enc{ + {1, [3]byte{0x00, 0x00, 0x00}}, {1, [3]byte{0x01, 0x00, 0x00}}, + {1, [3]byte{0x02, 0x00, 0x00}}, {1, [3]byte{0x03, 0x00, 0x00}}, + {1, [3]byte{0x04, 0x00, 0x00}}, {1, [3]byte{0x05, 0x00, 0x00}}, + {1, [3]byte{0x06, 0x00, 0x00}}, {1, [3]byte{0x07, 0x00, 0x00}}, + {1, [3]byte{0x08, 0x00, 0x00}}, {1, [3]byte{0x09, 0x00, 0x00}}, + {1, [3]byte{0x0a, 0x00, 0x00}}, {1, [3]byte{0x0b, 0x00, 0x00}}, + {1, [3]byte{0x0c, 0x00, 0x00}}, {1, [3]byte{0x0d, 0x00, 0x00}}, + {1, [3]byte{0x0e, 0x00, 0x00}}, {1, [3]byte{0x0f, 0x00, 0x00}}, + {1, [3]byte{0x10, 0x00, 0x00}}, {1, [3]byte{0x11, 0x00, 0x00}}, + {1, [3]byte{0x12, 0x00, 0x00}}, {1, [3]byte{0x13, 0x00, 0x00}}, + {1, [3]byte{0x14, 0x00, 0x00}}, {1, [3]byte{0x15, 0x00, 0x00}}, + {1, [3]byte{0x16, 0x00, 0x00}}, {1, [3]byte{0x17, 0x00, 0x00}}, + {1, [3]byte{0x18, 0x00, 0x00}}, {1, [3]byte{0x19, 0x00, 0x00}}, + {1, [3]byte{0x1a, 0x00, 0x00}}, {1, [3]byte{0x1b, 0x00, 0x00}}, + {1, [3]byte{0x1c, 0x00, 0x00}}, {1, [3]byte{0x1d, 0x00, 0x00}}, + {1, [3]byte{0x1e, 0x00, 0x00}}, {1, [3]byte{0x1f, 0x00, 0x00}}, + {1, [3]byte{0x20, 0x00, 0x00}}, {1, [3]byte{0x21, 0x00, 0x00}}, + {1, [3]byte{0x22, 0x00, 0x00}}, {1, [3]byte{0x23, 0x00, 0x00}}, + {1, [3]byte{0x24, 0x00, 0x00}}, {1, [3]byte{0x25, 0x00, 0x00}}, + {1, [3]byte{0x26, 0x00, 0x00}}, {1, [3]byte{0x27, 0x00, 0x00}}, + {1, [3]byte{0x28, 0x00, 0x00}}, {1, [3]byte{0x29, 0x00, 0x00}}, + {1, [3]byte{0x2a, 0x00, 0x00}}, {1, [3]byte{0x2b, 0x00, 0x00}}, + {1, [3]byte{0x2c, 0x00, 0x00}}, {1, [3]byte{0x2d, 0x00, 0x00}}, + {1, [3]byte{0x2e, 0x00, 0x00}}, {1, [3]byte{0x2f, 0x00, 0x00}}, + {1, [3]byte{0x30, 0x00, 0x00}}, {1, [3]byte{0x31, 0x00, 0x00}}, + {1, [3]byte{0x32, 0x00, 0x00}}, {1, [3]byte{0x33, 0x00, 0x00}}, + {1, [3]byte{0x34, 0x00, 0x00}}, {1, [3]byte{0x35, 0x00, 0x00}}, + {1, [3]byte{0x36, 0x00, 0x00}}, {1, [3]byte{0x37, 0x00, 0x00}}, + {1, [3]byte{0x38, 0x00, 0x00}}, {1, [3]byte{0x39, 0x00, 0x00}}, + {1, [3]byte{0x3a, 0x00, 0x00}}, {1, [3]byte{0x3b, 0x00, 0x00}}, + {1, [3]byte{0x3c, 0x00, 0x00}}, {1, [3]byte{0x3d, 0x00, 0x00}}, + {1, [3]byte{0x3e, 0x00, 0x00}}, {1, [3]byte{0x3f, 0x00, 0x00}}, + {1, [3]byte{0x40, 0x00, 0x00}}, {1, [3]byte{0x41, 0x00, 0x00}}, + {1, [3]byte{0x42, 0x00, 0x00}}, {1, [3]byte{0x43, 0x00, 0x00}}, + {1, [3]byte{0x44, 0x00, 0x00}}, {1, [3]byte{0x45, 0x00, 0x00}}, + {1, [3]byte{0x46, 0x00, 0x00}}, {1, [3]byte{0x47, 0x00, 0x00}}, + {1, [3]byte{0x48, 0x00, 0x00}}, {1, [3]byte{0x49, 0x00, 0x00}}, + {1, [3]byte{0x4a, 0x00, 0x00}}, {1, [3]byte{0x4b, 0x00, 0x00}}, + {1, [3]byte{0x4c, 0x00, 0x00}}, {1, [3]byte{0x4d, 0x00, 0x00}}, + {1, [3]byte{0x4e, 0x00, 0x00}}, {1, [3]byte{0x4f, 0x00, 0x00}}, + {1, [3]byte{0x50, 0x00, 0x00}}, {1, [3]byte{0x51, 0x00, 0x00}}, + {1, [3]byte{0x52, 0x00, 0x00}}, {1, [3]byte{0x53, 0x00, 0x00}}, + {1, [3]byte{0x54, 0x00, 0x00}}, {1, [3]byte{0x55, 0x00, 0x00}}, + {1, [3]byte{0x56, 0x00, 0x00}}, {1, [3]byte{0x57, 0x00, 0x00}}, + {1, [3]byte{0x58, 0x00, 0x00}}, {1, [3]byte{0x59, 0x00, 0x00}}, + {1, [3]byte{0x5a, 0x00, 0x00}}, {1, [3]byte{0x5b, 0x00, 0x00}}, + {1, [3]byte{0x5c, 0x00, 0x00}}, {1, [3]byte{0x5d, 0x00, 0x00}}, + {1, [3]byte{0x5e, 0x00, 0x00}}, {1, [3]byte{0x5f, 0x00, 0x00}}, + {1, [3]byte{0x60, 0x00, 0x00}}, {1, [3]byte{0x61, 0x00, 0x00}}, + {1, [3]byte{0x62, 0x00, 0x00}}, {1, [3]byte{0x63, 0x00, 0x00}}, + {1, [3]byte{0x64, 0x00, 0x00}}, {1, [3]byte{0x65, 0x00, 0x00}}, + {1, [3]byte{0x66, 0x00, 0x00}}, {1, [3]byte{0x67, 0x00, 0x00}}, + {1, [3]byte{0x68, 0x00, 0x00}}, {1, [3]byte{0x69, 0x00, 0x00}}, + {1, [3]byte{0x6a, 0x00, 0x00}}, {1, [3]byte{0x6b, 0x00, 0x00}}, + {1, [3]byte{0x6c, 0x00, 0x00}}, {1, [3]byte{0x6d, 0x00, 0x00}}, + {1, [3]byte{0x6e, 0x00, 0x00}}, {1, [3]byte{0x6f, 0x00, 0x00}}, + {1, [3]byte{0x70, 0x00, 0x00}}, {1, [3]byte{0x71, 0x00, 0x00}}, + {1, [3]byte{0x72, 0x00, 0x00}}, {1, [3]byte{0x73, 0x00, 0x00}}, + {1, [3]byte{0x74, 0x00, 0x00}}, {1, [3]byte{0x75, 0x00, 0x00}}, + {1, [3]byte{0x76, 0x00, 0x00}}, {1, [3]byte{0x77, 0x00, 0x00}}, + {1, [3]byte{0x78, 0x00, 0x00}}, {1, [3]byte{0x79, 0x00, 0x00}}, + {1, [3]byte{0x7a, 0x00, 0x00}}, {1, [3]byte{0x7b, 0x00, 0x00}}, + {1, [3]byte{0x7c, 0x00, 0x00}}, {1, [3]byte{0x7d, 0x00, 0x00}}, + {1, [3]byte{0x7e, 0x00, 0x00}}, {1, [3]byte{0x7f, 0x00, 0x00}}, + {2, [3]byte{0xc3, 0x87, 0x00}}, {2, [3]byte{0xc3, 0xbc, 0x00}}, + {2, [3]byte{0xc3, 0xa9, 0x00}}, {2, [3]byte{0xc3, 0xa2, 0x00}}, + {2, [3]byte{0xc3, 0x82, 0x00}}, {2, [3]byte{0xc3, 0xa0, 0x00}}, + {2, [3]byte{0xc2, 0xb6, 0x00}}, {2, [3]byte{0xc3, 0xa7, 0x00}}, + {2, [3]byte{0xc3, 0xaa, 0x00}}, {2, [3]byte{0xc3, 0xab, 0x00}}, + {2, [3]byte{0xc3, 0xa8, 0x00}}, {2, [3]byte{0xc3, 0xaf, 0x00}}, + {2, [3]byte{0xc3, 0xae, 0x00}}, {3, [3]byte{0xe2, 0x80, 0x97}}, + {2, [3]byte{0xc3, 0x80, 0x00}}, {2, [3]byte{0xc2, 0xa7, 0x00}}, + {2, [3]byte{0xc3, 0x89, 0x00}}, {2, [3]byte{0xc3, 0x88, 0x00}}, + {2, [3]byte{0xc3, 0x8a, 0x00}}, {2, [3]byte{0xc3, 0xb4, 0x00}}, + {2, [3]byte{0xc3, 0x8b, 0x00}}, {2, [3]byte{0xc3, 0x8f, 0x00}}, + {2, [3]byte{0xc3, 0xbb, 0x00}}, {2, [3]byte{0xc3, 0xb9, 0x00}}, + {2, [3]byte{0xc2, 0xa4, 0x00}}, {2, [3]byte{0xc3, 0x94, 0x00}}, + {2, [3]byte{0xc3, 0x9c, 0x00}}, {2, [3]byte{0xc2, 0xa2, 0x00}}, + {2, [3]byte{0xc2, 0xa3, 0x00}}, {2, [3]byte{0xc3, 0x99, 0x00}}, + {2, [3]byte{0xc3, 0x9b, 0x00}}, {2, [3]byte{0xc6, 0x92, 0x00}}, + {2, [3]byte{0xc2, 0xa6, 0x00}}, {2, [3]byte{0xc2, 0xb4, 0x00}}, + {2, [3]byte{0xc3, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0xba, 0x00}}, + {2, [3]byte{0xc2, 0xa8, 0x00}}, {2, [3]byte{0xc2, 0xb8, 0x00}}, + {2, [3]byte{0xc2, 0xb3, 0x00}}, {2, [3]byte{0xc2, 0xaf, 0x00}}, + {2, [3]byte{0xc3, 0x8e, 0x00}}, {3, [3]byte{0xe2, 0x8c, 0x90}}, + {2, [3]byte{0xc2, 0xac, 0x00}}, {2, [3]byte{0xc2, 0xbd, 0x00}}, + {2, [3]byte{0xc2, 0xbc, 0x00}}, {2, [3]byte{0xc2, 0xbe, 0x00}}, + {2, [3]byte{0xc2, 0xab, 0x00}}, {2, [3]byte{0xc2, 0xbb, 0x00}}, + {3, [3]byte{0xe2, 0x96, 0x91}}, {3, [3]byte{0xe2, 0x96, 0x92}}, + {3, [3]byte{0xe2, 0x96, 0x93}}, {3, [3]byte{0xe2, 0x94, 0x82}}, + {3, [3]byte{0xe2, 0x94, 0xa4}}, {3, [3]byte{0xe2, 0x95, 0xa1}}, + {3, [3]byte{0xe2, 0x95, 0xa2}}, {3, [3]byte{0xe2, 0x95, 0x96}}, + {3, [3]byte{0xe2, 0x95, 0x95}}, {3, [3]byte{0xe2, 0x95, 0xa3}}, + {3, [3]byte{0xe2, 0x95, 0x91}}, {3, [3]byte{0xe2, 0x95, 0x97}}, + {3, [3]byte{0xe2, 0x95, 0x9d}}, {3, [3]byte{0xe2, 0x95, 0x9c}}, + {3, [3]byte{0xe2, 0x95, 0x9b}}, {3, [3]byte{0xe2, 0x94, 0x90}}, + {3, [3]byte{0xe2, 0x94, 0x94}}, {3, [3]byte{0xe2, 0x94, 0xb4}}, + {3, [3]byte{0xe2, 0x94, 0xac}}, {3, [3]byte{0xe2, 0x94, 0x9c}}, + {3, [3]byte{0xe2, 0x94, 0x80}}, {3, [3]byte{0xe2, 0x94, 0xbc}}, + {3, [3]byte{0xe2, 0x95, 0x9e}}, {3, [3]byte{0xe2, 0x95, 0x9f}}, + {3, [3]byte{0xe2, 0x95, 0x9a}}, {3, [3]byte{0xe2, 0x95, 0x94}}, + {3, [3]byte{0xe2, 0x95, 0xa9}}, {3, [3]byte{0xe2, 0x95, 0xa6}}, + {3, [3]byte{0xe2, 0x95, 0xa0}}, {3, [3]byte{0xe2, 0x95, 0x90}}, + {3, [3]byte{0xe2, 0x95, 0xac}}, {3, [3]byte{0xe2, 0x95, 0xa7}}, + {3, [3]byte{0xe2, 0x95, 0xa8}}, {3, [3]byte{0xe2, 0x95, 0xa4}}, + {3, [3]byte{0xe2, 0x95, 0xa5}}, {3, [3]byte{0xe2, 0x95, 0x99}}, + {3, [3]byte{0xe2, 0x95, 0x98}}, {3, [3]byte{0xe2, 0x95, 0x92}}, + {3, [3]byte{0xe2, 0x95, 0x93}}, {3, [3]byte{0xe2, 0x95, 0xab}}, + {3, [3]byte{0xe2, 0x95, 0xaa}}, {3, [3]byte{0xe2, 0x94, 0x98}}, + {3, [3]byte{0xe2, 0x94, 0x8c}}, {3, [3]byte{0xe2, 0x96, 0x88}}, + {3, [3]byte{0xe2, 0x96, 0x84}}, {3, [3]byte{0xe2, 0x96, 0x8c}}, + {3, [3]byte{0xe2, 0x96, 0x90}}, {3, [3]byte{0xe2, 0x96, 0x80}}, + {2, [3]byte{0xce, 0xb1, 0x00}}, {2, [3]byte{0xc3, 0x9f, 0x00}}, + {2, [3]byte{0xce, 0x93, 0x00}}, {2, [3]byte{0xcf, 0x80, 0x00}}, + {2, [3]byte{0xce, 0xa3, 0x00}}, {2, [3]byte{0xcf, 0x83, 0x00}}, + {2, [3]byte{0xc2, 0xb5, 0x00}}, {2, [3]byte{0xcf, 0x84, 0x00}}, + {2, [3]byte{0xce, 0xa6, 0x00}}, {2, [3]byte{0xce, 0x98, 0x00}}, + {2, [3]byte{0xce, 0xa9, 0x00}}, {2, [3]byte{0xce, 0xb4, 0x00}}, + {3, [3]byte{0xe2, 0x88, 0x9e}}, {2, [3]byte{0xcf, 0x86, 0x00}}, + {2, [3]byte{0xce, 0xb5, 0x00}}, {3, [3]byte{0xe2, 0x88, 0xa9}}, + {3, [3]byte{0xe2, 0x89, 0xa1}}, {2, [3]byte{0xc2, 0xb1, 0x00}}, + {3, [3]byte{0xe2, 0x89, 0xa5}}, {3, [3]byte{0xe2, 0x89, 0xa4}}, + {3, [3]byte{0xe2, 0x8c, 0xa0}}, {3, [3]byte{0xe2, 0x8c, 0xa1}}, + {2, [3]byte{0xc3, 0xb7, 0x00}}, {3, [3]byte{0xe2, 0x89, 0x88}}, + {2, [3]byte{0xc2, 0xb0, 0x00}}, {3, [3]byte{0xe2, 0x88, 0x99}}, + {2, [3]byte{0xc2, 0xb7, 0x00}}, {3, [3]byte{0xe2, 0x88, 0x9a}}, + {3, [3]byte{0xe2, 0x81, 0xbf}}, {2, [3]byte{0xc2, 0xb2, 0x00}}, + {3, [3]byte{0xe2, 0x96, 0xa0}}, {2, [3]byte{0xc2, 0xa0, 0x00}}, + }, + encode: [256]uint32{ + 0x00000000, 0x01000001, 0x02000002, 0x03000003, 0x04000004, 0x05000005, 0x06000006, 0x07000007, + 0x08000008, 0x09000009, 0x0a00000a, 0x0b00000b, 0x0c00000c, 0x0d00000d, 0x0e00000e, 0x0f00000f, + 0x10000010, 0x11000011, 0x12000012, 0x13000013, 0x14000014, 0x15000015, 0x16000016, 0x17000017, + 0x18000018, 0x19000019, 0x1a00001a, 0x1b00001b, 0x1c00001c, 0x1d00001d, 0x1e00001e, 0x1f00001f, + 0x20000020, 0x21000021, 0x22000022, 0x23000023, 0x24000024, 0x25000025, 0x26000026, 0x27000027, + 0x28000028, 0x29000029, 0x2a00002a, 0x2b00002b, 0x2c00002c, 0x2d00002d, 0x2e00002e, 0x2f00002f, + 0x30000030, 0x31000031, 0x32000032, 0x33000033, 0x34000034, 0x35000035, 0x36000036, 0x37000037, + 0x38000038, 0x39000039, 0x3a00003a, 0x3b00003b, 0x3c00003c, 0x3d00003d, 0x3e00003e, 0x3f00003f, + 0x40000040, 0x41000041, 0x42000042, 0x43000043, 0x44000044, 0x45000045, 0x46000046, 0x47000047, + 0x48000048, 0x49000049, 0x4a00004a, 0x4b00004b, 0x4c00004c, 0x4d00004d, 0x4e00004e, 0x4f00004f, + 0x50000050, 0x51000051, 0x52000052, 0x53000053, 0x54000054, 0x55000055, 0x56000056, 0x57000057, + 0x58000058, 0x59000059, 0x5a00005a, 0x5b00005b, 0x5c00005c, 0x5d00005d, 0x5e00005e, 0x5f00005f, + 0x60000060, 0x61000061, 0x62000062, 0x63000063, 0x64000064, 0x65000065, 0x66000066, 0x67000067, + 0x68000068, 0x69000069, 0x6a00006a, 0x6b00006b, 0x6c00006c, 0x6d00006d, 0x6e00006e, 0x6f00006f, + 0x70000070, 0x71000071, 0x72000072, 0x73000073, 0x74000074, 0x75000075, 0x76000076, 0x77000077, + 0x78000078, 0x79000079, 0x7a00007a, 0x7b00007b, 0x7c00007c, 0x7d00007d, 0x7e00007e, 0x7f00007f, + 0xff0000a0, 0x9b0000a2, 0x9c0000a3, 0x980000a4, 0xa00000a6, 0x8f0000a7, 0xa40000a8, 0xae0000ab, + 0xaa0000ac, 0xa70000af, 0xf80000b0, 0xf10000b1, 0xfd0000b2, 0xa60000b3, 0xa10000b4, 0xe60000b5, + 0x860000b6, 0xfa0000b7, 0xa50000b8, 0xaf0000bb, 0xac0000bc, 0xab0000bd, 0xad0000be, 0x8e0000c0, + 0x840000c2, 0x800000c7, 0x910000c8, 0x900000c9, 0x920000ca, 0x940000cb, 0xa80000ce, 0x950000cf, + 0x990000d4, 0x9d0000d9, 0x9e0000db, 0x9a0000dc, 0xe10000df, 0x850000e0, 0x830000e2, 0x870000e7, + 0x8a0000e8, 0x820000e9, 0x880000ea, 0x890000eb, 0x8c0000ee, 0x8b0000ef, 0xa20000f3, 0x930000f4, + 0xf60000f7, 0x970000f9, 0xa30000fa, 0x960000fb, 0x810000fc, 0x9f000192, 0xe2000393, 0xe9000398, + 0xe40003a3, 0xe80003a6, 0xea0003a9, 0xe00003b1, 0xeb0003b4, 0xee0003b5, 0xe30003c0, 0xe50003c3, + 0xe70003c4, 0xed0003c6, 0x8d002017, 0xfc00207f, 0xf9002219, 0xfb00221a, 0xec00221e, 0xef002229, + 0xf7002248, 0xf0002261, 0xf3002264, 0xf2002265, 0xa9002310, 0xf4002320, 0xf5002321, 0xc4002500, + 0xb3002502, 0xda00250c, 0xbf002510, 0xc0002514, 0xd9002518, 0xc300251c, 0xb4002524, 0xc200252c, + 0xc1002534, 0xc500253c, 0xcd002550, 0xba002551, 0xd5002552, 0xd6002553, 0xc9002554, 0xb8002555, + 0xb7002556, 0xbb002557, 0xd4002558, 0xd3002559, 0xc800255a, 0xbe00255b, 0xbd00255c, 0xbc00255d, + 0xc600255e, 0xc700255f, 0xcc002560, 0xb5002561, 0xb6002562, 0xb9002563, 0xd1002564, 0xd2002565, + 0xcb002566, 0xcf002567, 0xd0002568, 0xca002569, 0xd800256a, 0xd700256b, 0xce00256c, 0xdf002580, + 0xdc002584, 0xdb002588, 0xdd00258c, 0xde002590, 0xb0002591, 0xb1002592, 0xb2002593, 0xfe0025a0, + }, +} + +// CodePage865 is the IBM Code Page 865 encoding. +var CodePage865 encoding.Encoding = &codePage865 + +var codePage865 = charmap{ + name: "IBM Code Page 865", + mib: identifier.IBM865, + asciiSuperset: true, + low: 0x80, + replacement: 0x1a, + decode: [256]utf8Enc{ + {1, [3]byte{0x00, 0x00, 0x00}}, {1, [3]byte{0x01, 0x00, 0x00}}, + {1, [3]byte{0x02, 0x00, 0x00}}, {1, [3]byte{0x03, 0x00, 0x00}}, + {1, [3]byte{0x04, 0x00, 0x00}}, {1, [3]byte{0x05, 0x00, 0x00}}, + {1, [3]byte{0x06, 0x00, 0x00}}, {1, [3]byte{0x07, 0x00, 0x00}}, + {1, [3]byte{0x08, 0x00, 0x00}}, {1, [3]byte{0x09, 0x00, 0x00}}, + {1, [3]byte{0x0a, 0x00, 0x00}}, {1, [3]byte{0x0b, 0x00, 0x00}}, + {1, [3]byte{0x0c, 0x00, 0x00}}, {1, [3]byte{0x0d, 0x00, 0x00}}, + {1, [3]byte{0x0e, 0x00, 0x00}}, {1, [3]byte{0x0f, 0x00, 0x00}}, + {1, [3]byte{0x10, 0x00, 0x00}}, {1, [3]byte{0x11, 0x00, 0x00}}, + {1, [3]byte{0x12, 0x00, 0x00}}, {1, [3]byte{0x13, 0x00, 0x00}}, + {1, [3]byte{0x14, 0x00, 0x00}}, {1, [3]byte{0x15, 0x00, 0x00}}, + {1, [3]byte{0x16, 0x00, 0x00}}, {1, [3]byte{0x17, 0x00, 0x00}}, + {1, [3]byte{0x18, 0x00, 0x00}}, {1, [3]byte{0x19, 0x00, 0x00}}, + {1, [3]byte{0x1a, 0x00, 0x00}}, {1, [3]byte{0x1b, 0x00, 0x00}}, + {1, [3]byte{0x1c, 0x00, 0x00}}, {1, [3]byte{0x1d, 0x00, 0x00}}, + {1, [3]byte{0x1e, 0x00, 0x00}}, {1, [3]byte{0x1f, 0x00, 0x00}}, + {1, [3]byte{0x20, 0x00, 0x00}}, {1, [3]byte{0x21, 0x00, 0x00}}, + {1, [3]byte{0x22, 0x00, 0x00}}, {1, [3]byte{0x23, 0x00, 0x00}}, + {1, [3]byte{0x24, 0x00, 0x00}}, {1, [3]byte{0x25, 0x00, 0x00}}, + {1, [3]byte{0x26, 0x00, 0x00}}, {1, [3]byte{0x27, 0x00, 0x00}}, + {1, [3]byte{0x28, 0x00, 0x00}}, {1, [3]byte{0x29, 0x00, 0x00}}, + {1, [3]byte{0x2a, 0x00, 0x00}}, {1, [3]byte{0x2b, 0x00, 0x00}}, + {1, [3]byte{0x2c, 0x00, 0x00}}, {1, [3]byte{0x2d, 0x00, 0x00}}, + {1, [3]byte{0x2e, 0x00, 0x00}}, {1, [3]byte{0x2f, 0x00, 0x00}}, + {1, [3]byte{0x30, 0x00, 0x00}}, {1, [3]byte{0x31, 0x00, 0x00}}, + {1, [3]byte{0x32, 0x00, 0x00}}, {1, [3]byte{0x33, 0x00, 0x00}}, + {1, [3]byte{0x34, 0x00, 0x00}}, {1, [3]byte{0x35, 0x00, 0x00}}, + {1, [3]byte{0x36, 0x00, 0x00}}, {1, [3]byte{0x37, 0x00, 0x00}}, + {1, [3]byte{0x38, 0x00, 0x00}}, {1, [3]byte{0x39, 0x00, 0x00}}, + {1, [3]byte{0x3a, 0x00, 0x00}}, {1, [3]byte{0x3b, 0x00, 0x00}}, + {1, [3]byte{0x3c, 0x00, 0x00}}, {1, [3]byte{0x3d, 0x00, 0x00}}, + {1, [3]byte{0x3e, 0x00, 0x00}}, {1, [3]byte{0x3f, 0x00, 0x00}}, + {1, [3]byte{0x40, 0x00, 0x00}}, {1, [3]byte{0x41, 0x00, 0x00}}, + {1, [3]byte{0x42, 0x00, 0x00}}, {1, [3]byte{0x43, 0x00, 0x00}}, + {1, [3]byte{0x44, 0x00, 0x00}}, {1, [3]byte{0x45, 0x00, 0x00}}, + {1, [3]byte{0x46, 0x00, 0x00}}, {1, [3]byte{0x47, 0x00, 0x00}}, + {1, [3]byte{0x48, 0x00, 0x00}}, {1, [3]byte{0x49, 0x00, 0x00}}, + {1, [3]byte{0x4a, 0x00, 0x00}}, {1, [3]byte{0x4b, 0x00, 0x00}}, + {1, [3]byte{0x4c, 0x00, 0x00}}, {1, [3]byte{0x4d, 0x00, 0x00}}, + {1, [3]byte{0x4e, 0x00, 0x00}}, {1, [3]byte{0x4f, 0x00, 0x00}}, + {1, [3]byte{0x50, 0x00, 0x00}}, {1, [3]byte{0x51, 0x00, 0x00}}, + {1, [3]byte{0x52, 0x00, 0x00}}, {1, [3]byte{0x53, 0x00, 0x00}}, + {1, [3]byte{0x54, 0x00, 0x00}}, {1, [3]byte{0x55, 0x00, 0x00}}, + {1, [3]byte{0x56, 0x00, 0x00}}, {1, [3]byte{0x57, 0x00, 0x00}}, + {1, [3]byte{0x58, 0x00, 0x00}}, {1, [3]byte{0x59, 0x00, 0x00}}, + {1, [3]byte{0x5a, 0x00, 0x00}}, {1, [3]byte{0x5b, 0x00, 0x00}}, + {1, [3]byte{0x5c, 0x00, 0x00}}, {1, [3]byte{0x5d, 0x00, 0x00}}, + {1, [3]byte{0x5e, 0x00, 0x00}}, {1, [3]byte{0x5f, 0x00, 0x00}}, + {1, [3]byte{0x60, 0x00, 0x00}}, {1, [3]byte{0x61, 0x00, 0x00}}, + {1, [3]byte{0x62, 0x00, 0x00}}, {1, [3]byte{0x63, 0x00, 0x00}}, + {1, [3]byte{0x64, 0x00, 0x00}}, {1, [3]byte{0x65, 0x00, 0x00}}, + {1, [3]byte{0x66, 0x00, 0x00}}, {1, [3]byte{0x67, 0x00, 0x00}}, + {1, [3]byte{0x68, 0x00, 0x00}}, {1, [3]byte{0x69, 0x00, 0x00}}, + {1, [3]byte{0x6a, 0x00, 0x00}}, {1, [3]byte{0x6b, 0x00, 0x00}}, + {1, [3]byte{0x6c, 0x00, 0x00}}, {1, [3]byte{0x6d, 0x00, 0x00}}, + {1, [3]byte{0x6e, 0x00, 0x00}}, {1, [3]byte{0x6f, 0x00, 0x00}}, + {1, [3]byte{0x70, 0x00, 0x00}}, {1, [3]byte{0x71, 0x00, 0x00}}, + {1, [3]byte{0x72, 0x00, 0x00}}, {1, [3]byte{0x73, 0x00, 0x00}}, + {1, [3]byte{0x74, 0x00, 0x00}}, {1, [3]byte{0x75, 0x00, 0x00}}, + {1, [3]byte{0x76, 0x00, 0x00}}, {1, [3]byte{0x77, 0x00, 0x00}}, + {1, [3]byte{0x78, 0x00, 0x00}}, {1, [3]byte{0x79, 0x00, 0x00}}, + {1, [3]byte{0x7a, 0x00, 0x00}}, {1, [3]byte{0x7b, 0x00, 0x00}}, + {1, [3]byte{0x7c, 0x00, 0x00}}, {1, [3]byte{0x7d, 0x00, 0x00}}, + {1, [3]byte{0x7e, 0x00, 0x00}}, {1, [3]byte{0x7f, 0x00, 0x00}}, + {2, [3]byte{0xc3, 0x87, 0x00}}, {2, [3]byte{0xc3, 0xbc, 0x00}}, + {2, [3]byte{0xc3, 0xa9, 0x00}}, {2, [3]byte{0xc3, 0xa2, 0x00}}, + {2, [3]byte{0xc3, 0xa4, 0x00}}, {2, [3]byte{0xc3, 0xa0, 0x00}}, + {2, [3]byte{0xc3, 0xa5, 0x00}}, {2, [3]byte{0xc3, 0xa7, 0x00}}, + {2, [3]byte{0xc3, 0xaa, 0x00}}, {2, [3]byte{0xc3, 0xab, 0x00}}, + {2, [3]byte{0xc3, 0xa8, 0x00}}, {2, [3]byte{0xc3, 0xaf, 0x00}}, + {2, [3]byte{0xc3, 0xae, 0x00}}, {2, [3]byte{0xc3, 0xac, 0x00}}, + {2, [3]byte{0xc3, 0x84, 0x00}}, {2, [3]byte{0xc3, 0x85, 0x00}}, + {2, [3]byte{0xc3, 0x89, 0x00}}, {2, [3]byte{0xc3, 0xa6, 0x00}}, + {2, [3]byte{0xc3, 0x86, 0x00}}, {2, [3]byte{0xc3, 0xb4, 0x00}}, + {2, [3]byte{0xc3, 0xb6, 0x00}}, {2, [3]byte{0xc3, 0xb2, 0x00}}, + {2, [3]byte{0xc3, 0xbb, 0x00}}, {2, [3]byte{0xc3, 0xb9, 0x00}}, + {2, [3]byte{0xc3, 0xbf, 0x00}}, {2, [3]byte{0xc3, 0x96, 0x00}}, + {2, [3]byte{0xc3, 0x9c, 0x00}}, {2, [3]byte{0xc3, 0xb8, 0x00}}, + {2, [3]byte{0xc2, 0xa3, 0x00}}, {2, [3]byte{0xc3, 0x98, 0x00}}, + {3, [3]byte{0xe2, 0x82, 0xa7}}, {2, [3]byte{0xc6, 0x92, 0x00}}, + {2, [3]byte{0xc3, 0xa1, 0x00}}, {2, [3]byte{0xc3, 0xad, 0x00}}, + {2, [3]byte{0xc3, 0xb3, 0x00}}, {2, [3]byte{0xc3, 0xba, 0x00}}, + {2, [3]byte{0xc3, 0xb1, 0x00}}, {2, [3]byte{0xc3, 0x91, 0x00}}, + {2, [3]byte{0xc2, 0xaa, 0x00}}, {2, [3]byte{0xc2, 0xba, 0x00}}, + {2, [3]byte{0xc2, 0xbf, 0x00}}, {3, [3]byte{0xe2, 0x8c, 0x90}}, + {2, [3]byte{0xc2, 0xac, 0x00}}, {2, [3]byte{0xc2, 0xbd, 0x00}}, + {2, [3]byte{0xc2, 0xbc, 0x00}}, {2, [3]byte{0xc2, 0xa1, 0x00}}, + {2, [3]byte{0xc2, 0xab, 0x00}}, {2, [3]byte{0xc2, 0xa4, 0x00}}, + {3, [3]byte{0xe2, 0x96, 0x91}}, {3, [3]byte{0xe2, 0x96, 0x92}}, + {3, [3]byte{0xe2, 0x96, 0x93}}, {3, [3]byte{0xe2, 0x94, 0x82}}, + {3, [3]byte{0xe2, 0x94, 0xa4}}, {3, [3]byte{0xe2, 0x95, 0xa1}}, + {3, [3]byte{0xe2, 0x95, 0xa2}}, {3, [3]byte{0xe2, 0x95, 0x96}}, + {3, [3]byte{0xe2, 0x95, 0x95}}, {3, [3]byte{0xe2, 0x95, 0xa3}}, + {3, [3]byte{0xe2, 0x95, 0x91}}, {3, [3]byte{0xe2, 0x95, 0x97}}, + {3, [3]byte{0xe2, 0x95, 0x9d}}, {3, [3]byte{0xe2, 0x95, 0x9c}}, + {3, [3]byte{0xe2, 0x95, 0x9b}}, {3, [3]byte{0xe2, 0x94, 0x90}}, + {3, [3]byte{0xe2, 0x94, 0x94}}, {3, [3]byte{0xe2, 0x94, 0xb4}}, + {3, [3]byte{0xe2, 0x94, 0xac}}, {3, [3]byte{0xe2, 0x94, 0x9c}}, + {3, [3]byte{0xe2, 0x94, 0x80}}, {3, [3]byte{0xe2, 0x94, 0xbc}}, + {3, [3]byte{0xe2, 0x95, 0x9e}}, {3, [3]byte{0xe2, 0x95, 0x9f}}, + {3, [3]byte{0xe2, 0x95, 0x9a}}, {3, [3]byte{0xe2, 0x95, 0x94}}, + {3, [3]byte{0xe2, 0x95, 0xa9}}, {3, [3]byte{0xe2, 0x95, 0xa6}}, + {3, [3]byte{0xe2, 0x95, 0xa0}}, {3, [3]byte{0xe2, 0x95, 0x90}}, + {3, [3]byte{0xe2, 0x95, 0xac}}, {3, [3]byte{0xe2, 0x95, 0xa7}}, + {3, [3]byte{0xe2, 0x95, 0xa8}}, {3, [3]byte{0xe2, 0x95, 0xa4}}, + {3, [3]byte{0xe2, 0x95, 0xa5}}, {3, [3]byte{0xe2, 0x95, 0x99}}, + {3, [3]byte{0xe2, 0x95, 0x98}}, {3, [3]byte{0xe2, 0x95, 0x92}}, + {3, [3]byte{0xe2, 0x95, 0x93}}, {3, [3]byte{0xe2, 0x95, 0xab}}, + {3, [3]byte{0xe2, 0x95, 0xaa}}, {3, [3]byte{0xe2, 0x94, 0x98}}, + {3, [3]byte{0xe2, 0x94, 0x8c}}, {3, [3]byte{0xe2, 0x96, 0x88}}, + {3, [3]byte{0xe2, 0x96, 0x84}}, {3, [3]byte{0xe2, 0x96, 0x8c}}, + {3, [3]byte{0xe2, 0x96, 0x90}}, {3, [3]byte{0xe2, 0x96, 0x80}}, + {2, [3]byte{0xce, 0xb1, 0x00}}, {2, [3]byte{0xc3, 0x9f, 0x00}}, + {2, [3]byte{0xce, 0x93, 0x00}}, {2, [3]byte{0xcf, 0x80, 0x00}}, + {2, [3]byte{0xce, 0xa3, 0x00}}, {2, [3]byte{0xcf, 0x83, 0x00}}, + {2, [3]byte{0xc2, 0xb5, 0x00}}, {2, [3]byte{0xcf, 0x84, 0x00}}, + {2, [3]byte{0xce, 0xa6, 0x00}}, {2, [3]byte{0xce, 0x98, 0x00}}, + {2, [3]byte{0xce, 0xa9, 0x00}}, {2, [3]byte{0xce, 0xb4, 0x00}}, + {3, [3]byte{0xe2, 0x88, 0x9e}}, {2, [3]byte{0xcf, 0x86, 0x00}}, + {2, [3]byte{0xce, 0xb5, 0x00}}, {3, [3]byte{0xe2, 0x88, 0xa9}}, + {3, [3]byte{0xe2, 0x89, 0xa1}}, {2, [3]byte{0xc2, 0xb1, 0x00}}, + {3, [3]byte{0xe2, 0x89, 0xa5}}, {3, [3]byte{0xe2, 0x89, 0xa4}}, + {3, [3]byte{0xe2, 0x8c, 0xa0}}, {3, [3]byte{0xe2, 0x8c, 0xa1}}, + {2, [3]byte{0xc3, 0xb7, 0x00}}, {3, [3]byte{0xe2, 0x89, 0x88}}, + {2, [3]byte{0xc2, 0xb0, 0x00}}, {3, [3]byte{0xe2, 0x88, 0x99}}, + {2, [3]byte{0xc2, 0xb7, 0x00}}, {3, [3]byte{0xe2, 0x88, 0x9a}}, + {3, [3]byte{0xe2, 0x81, 0xbf}}, {2, [3]byte{0xc2, 0xb2, 0x00}}, + {3, [3]byte{0xe2, 0x96, 0xa0}}, {2, [3]byte{0xc2, 0xa0, 0x00}}, + }, + encode: [256]uint32{ + 0x00000000, 0x01000001, 0x02000002, 0x03000003, 0x04000004, 0x05000005, 0x06000006, 0x07000007, + 0x08000008, 0x09000009, 0x0a00000a, 0x0b00000b, 0x0c00000c, 0x0d00000d, 0x0e00000e, 0x0f00000f, + 0x10000010, 0x11000011, 0x12000012, 0x13000013, 0x14000014, 0x15000015, 0x16000016, 0x17000017, + 0x18000018, 0x19000019, 0x1a00001a, 0x1b00001b, 0x1c00001c, 0x1d00001d, 0x1e00001e, 0x1f00001f, + 0x20000020, 0x21000021, 0x22000022, 0x23000023, 0x24000024, 0x25000025, 0x26000026, 0x27000027, + 0x28000028, 0x29000029, 0x2a00002a, 0x2b00002b, 0x2c00002c, 0x2d00002d, 0x2e00002e, 0x2f00002f, + 0x30000030, 0x31000031, 0x32000032, 0x33000033, 0x34000034, 0x35000035, 0x36000036, 0x37000037, + 0x38000038, 0x39000039, 0x3a00003a, 0x3b00003b, 0x3c00003c, 0x3d00003d, 0x3e00003e, 0x3f00003f, + 0x40000040, 0x41000041, 0x42000042, 0x43000043, 0x44000044, 0x45000045, 0x46000046, 0x47000047, + 0x48000048, 0x49000049, 0x4a00004a, 0x4b00004b, 0x4c00004c, 0x4d00004d, 0x4e00004e, 0x4f00004f, + 0x50000050, 0x51000051, 0x52000052, 0x53000053, 0x54000054, 0x55000055, 0x56000056, 0x57000057, + 0x58000058, 0x59000059, 0x5a00005a, 0x5b00005b, 0x5c00005c, 0x5d00005d, 0x5e00005e, 0x5f00005f, + 0x60000060, 0x61000061, 0x62000062, 0x63000063, 0x64000064, 0x65000065, 0x66000066, 0x67000067, + 0x68000068, 0x69000069, 0x6a00006a, 0x6b00006b, 0x6c00006c, 0x6d00006d, 0x6e00006e, 0x6f00006f, + 0x70000070, 0x71000071, 0x72000072, 0x73000073, 0x74000074, 0x75000075, 0x76000076, 0x77000077, + 0x78000078, 0x79000079, 0x7a00007a, 0x7b00007b, 0x7c00007c, 0x7d00007d, 0x7e00007e, 0x7f00007f, + 0xff0000a0, 0xad0000a1, 0x9c0000a3, 0xaf0000a4, 0xa60000aa, 0xae0000ab, 0xaa0000ac, 0xf80000b0, + 0xf10000b1, 0xfd0000b2, 0xe60000b5, 0xfa0000b7, 0xa70000ba, 0xac0000bc, 0xab0000bd, 0xa80000bf, + 0x8e0000c4, 0x8f0000c5, 0x920000c6, 0x800000c7, 0x900000c9, 0xa50000d1, 0x990000d6, 0x9d0000d8, + 0x9a0000dc, 0xe10000df, 0x850000e0, 0xa00000e1, 0x830000e2, 0x840000e4, 0x860000e5, 0x910000e6, + 0x870000e7, 0x8a0000e8, 0x820000e9, 0x880000ea, 0x890000eb, 0x8d0000ec, 0xa10000ed, 0x8c0000ee, + 0x8b0000ef, 0xa40000f1, 0x950000f2, 0xa20000f3, 0x930000f4, 0x940000f6, 0xf60000f7, 0x9b0000f8, + 0x970000f9, 0xa30000fa, 0x960000fb, 0x810000fc, 0x980000ff, 0x9f000192, 0xe2000393, 0xe9000398, + 0xe40003a3, 0xe80003a6, 0xea0003a9, 0xe00003b1, 0xeb0003b4, 0xee0003b5, 0xe30003c0, 0xe50003c3, + 0xe70003c4, 0xed0003c6, 0xfc00207f, 0x9e0020a7, 0xf9002219, 0xfb00221a, 0xec00221e, 0xef002229, + 0xf7002248, 0xf0002261, 0xf3002264, 0xf2002265, 0xa9002310, 0xf4002320, 0xf5002321, 0xc4002500, + 0xb3002502, 0xda00250c, 0xbf002510, 0xc0002514, 0xd9002518, 0xc300251c, 0xb4002524, 0xc200252c, + 0xc1002534, 0xc500253c, 0xcd002550, 0xba002551, 0xd5002552, 0xd6002553, 0xc9002554, 0xb8002555, + 0xb7002556, 0xbb002557, 0xd4002558, 0xd3002559, 0xc800255a, 0xbe00255b, 0xbd00255c, 0xbc00255d, + 0xc600255e, 0xc700255f, 0xcc002560, 0xb5002561, 0xb6002562, 0xb9002563, 0xd1002564, 0xd2002565, + 0xcb002566, 0xcf002567, 0xd0002568, 0xca002569, 0xd800256a, 0xd700256b, 0xce00256c, 0xdf002580, + 0xdc002584, 0xdb002588, 0xdd00258c, 0xde002590, 0xb0002591, 0xb1002592, 0xb2002593, 0xfe0025a0, + }, +} + // CodePage866 is the IBM Code Page 866 encoding. var CodePage866 encoding.Encoding = &codePage866 @@ -6139,7 +6664,10 @@ var listAll = []encoding.Encoding{ CodePage852, CodePage855, CodePage858, + CodePage860, CodePage862, + CodePage863, + CodePage865, CodePage866, ISO8859_1, ISO8859_2, @@ -6175,4 +6703,4 @@ var listAll = []encoding.Encoding{ XUserDefined, } -// Total table size 72520 bytes (70KiB); checksum: 811C9DC5 +// Total table size 78736 bytes (76KiB); checksum: 811C9DC5 diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/encoding.go b/vendor/golang.org/x/text/encoding/encoding.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/text/encoding/encoding.go rename to vendor/golang.org/x/text/encoding/encoding.go index abc2c9ad15..221f175c01 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/encoding.go +++ b/vendor/golang.org/x/text/encoding/encoding.go @@ -8,7 +8,7 @@ // Encoding implementations are provided in other packages, such as // golang.org/x/text/encoding/charmap and // golang.org/x/text/encoding/japanese. -package encoding +package encoding // import "golang.org/x/text/encoding" import ( "errors" diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex/gen.go b/vendor/golang.org/x/text/encoding/htmlindex/gen.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex/gen.go rename to vendor/golang.org/x/text/encoding/htmlindex/gen.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex/htmlindex.go b/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex/htmlindex.go rename to vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex/map.go b/vendor/golang.org/x/text/encoding/htmlindex/map.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex/map.go rename to vendor/golang.org/x/text/encoding/htmlindex/map.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex/tables.go b/vendor/golang.org/x/text/encoding/htmlindex/tables.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/htmlindex/tables.go rename to vendor/golang.org/x/text/encoding/htmlindex/tables.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/internal/identifier/gen.go b/vendor/golang.org/x/text/encoding/internal/identifier/gen.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/internal/identifier/gen.go rename to vendor/golang.org/x/text/encoding/internal/identifier/gen.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/internal/identifier/identifier.go b/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/internal/identifier/identifier.go rename to vendor/golang.org/x/text/encoding/internal/identifier/identifier.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/internal/identifier/mib.go b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/internal/identifier/mib.go rename to vendor/golang.org/x/text/encoding/internal/identifier/mib.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/internal/internal.go b/vendor/golang.org/x/text/encoding/internal/internal.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/internal/internal.go rename to vendor/golang.org/x/text/encoding/internal/internal.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/japanese/all.go b/vendor/golang.org/x/text/encoding/japanese/all.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/japanese/all.go rename to vendor/golang.org/x/text/encoding/japanese/all.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/japanese/eucjp.go b/vendor/golang.org/x/text/encoding/japanese/eucjp.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/japanese/eucjp.go rename to vendor/golang.org/x/text/encoding/japanese/eucjp.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/japanese/iso2022jp.go b/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/japanese/iso2022jp.go rename to vendor/golang.org/x/text/encoding/japanese/iso2022jp.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/japanese/maketables.go b/vendor/golang.org/x/text/encoding/japanese/maketables.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/japanese/maketables.go rename to vendor/golang.org/x/text/encoding/japanese/maketables.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/japanese/shiftjis.go b/vendor/golang.org/x/text/encoding/japanese/shiftjis.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/japanese/shiftjis.go rename to vendor/golang.org/x/text/encoding/japanese/shiftjis.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/japanese/tables.go b/vendor/golang.org/x/text/encoding/japanese/tables.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/text/encoding/japanese/tables.go rename to vendor/golang.org/x/text/encoding/japanese/tables.go index 1108e83d57..8717b79ae0 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/japanese/tables.go +++ b/vendor/golang.org/x/text/encoding/japanese/tables.go @@ -1,7 +1,7 @@ // generated by go run maketables.go; DO NOT EDIT // Package japanese provides Japanese encodings such as EUC-JP and Shift JIS. -package japanese +package japanese // import "golang.org/x/text/encoding/japanese" // jis0208Decode is the decoding table from JIS 0208 code to Unicode. // It is defined at http://encoding.spec.whatwg.org/index-jis0208.txt diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/korean/euckr.go b/vendor/golang.org/x/text/encoding/korean/euckr.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/korean/euckr.go rename to vendor/golang.org/x/text/encoding/korean/euckr.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/korean/maketables.go b/vendor/golang.org/x/text/encoding/korean/maketables.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/korean/maketables.go rename to vendor/golang.org/x/text/encoding/korean/maketables.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/korean/tables.go b/vendor/golang.org/x/text/encoding/korean/tables.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/text/encoding/korean/tables.go rename to vendor/golang.org/x/text/encoding/korean/tables.go index eb8b4517f7..0480e85c4a 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/korean/tables.go +++ b/vendor/golang.org/x/text/encoding/korean/tables.go @@ -1,7 +1,7 @@ // generated by go run maketables.go; DO NOT EDIT // Package korean provides Korean encodings such as EUC-KR. -package korean +package korean // import "golang.org/x/text/encoding/korean" // decode is the decoding table from EUC-KR code to Unicode. // It is defined at http://encoding.spec.whatwg.org/index-euc-kr.txt diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/all.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/all.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/all.go rename to vendor/golang.org/x/text/encoding/simplifiedchinese/all.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/gbk.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/gbk.go rename to vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go rename to vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/maketables.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/maketables.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/maketables.go rename to vendor/golang.org/x/text/encoding/simplifiedchinese/maketables.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/tables.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/tables.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/tables.go rename to vendor/golang.org/x/text/encoding/simplifiedchinese/tables.go index fac299d2fa..415f52a111 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/simplifiedchinese/tables.go +++ b/vendor/golang.org/x/text/encoding/simplifiedchinese/tables.go @@ -1,7 +1,7 @@ // generated by go run maketables.go; DO NOT EDIT // Package simplifiedchinese provides Simplified Chinese encodings such as GBK. -package simplifiedchinese +package simplifiedchinese // import "golang.org/x/text/encoding/simplifiedchinese" // gb18030 is the table from http://encoding.spec.whatwg.org/index-gb18030.txt var gb18030 = [...][2]uint16{ diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/traditionalchinese/big5.go b/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/traditionalchinese/big5.go rename to vendor/golang.org/x/text/encoding/traditionalchinese/big5.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/traditionalchinese/maketables.go b/vendor/golang.org/x/text/encoding/traditionalchinese/maketables.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/traditionalchinese/maketables.go rename to vendor/golang.org/x/text/encoding/traditionalchinese/maketables.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/traditionalchinese/tables.go b/vendor/golang.org/x/text/encoding/traditionalchinese/tables.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/text/encoding/traditionalchinese/tables.go rename to vendor/golang.org/x/text/encoding/traditionalchinese/tables.go index b0d23c7d93..d909e38e5e 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/traditionalchinese/tables.go +++ b/vendor/golang.org/x/text/encoding/traditionalchinese/tables.go @@ -1,7 +1,7 @@ // generated by go run maketables.go; DO NOT EDIT // Package traditionalchinese provides Traditional Chinese encodings such as Big5. -package traditionalchinese +package traditionalchinese // import "golang.org/x/text/encoding/traditionalchinese" // decode is the decoding table from Big5 code to Unicode. // It is defined at http://encoding.spec.whatwg.org/index-big5.txt diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/unicode/override.go b/vendor/golang.org/x/text/encoding/unicode/override.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/encoding/unicode/override.go rename to vendor/golang.org/x/text/encoding/unicode/override.go diff --git a/Godeps/_workspace/src/golang.org/x/text/encoding/unicode/unicode.go b/vendor/golang.org/x/text/encoding/unicode/unicode.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/text/encoding/unicode/unicode.go rename to vendor/golang.org/x/text/encoding/unicode/unicode.go index f3f2c4eb0e..579cadfb12 100644 --- a/Godeps/_workspace/src/golang.org/x/text/encoding/unicode/unicode.go +++ b/vendor/golang.org/x/text/encoding/unicode/unicode.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package unicode provides Unicode encodings such as UTF-16. -package unicode +package unicode // import "golang.org/x/text/encoding/unicode" import ( "errors" diff --git a/vendor/golang.org/x/text/internal/gen/code.go b/vendor/golang.org/x/text/internal/gen/code.go new file mode 100644 index 0000000000..2202c9f642 --- /dev/null +++ b/vendor/golang.org/x/text/internal/gen/code.go @@ -0,0 +1,339 @@ +// Copyright 2015 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 gen + +import ( + "bytes" + "encoding/gob" + "fmt" + "hash" + "hash/fnv" + "io" + "log" + "os" + "reflect" + "strings" + "unicode" + "unicode/utf8" +) + +// This file contains utilities for generating code. + +// TODO: other write methods like: +// - slices, maps, types, etc. + +// CodeWriter is a utility for writing structured code. It computes the content +// hash and size of written content. It ensures there are newlines between +// written code blocks. +type CodeWriter struct { + buf bytes.Buffer + Size int + Hash hash.Hash32 // content hash + gob *gob.Encoder + // For comments we skip the usual one-line separator if they are followed by + // a code block. + skipSep bool +} + +func (w *CodeWriter) Write(p []byte) (n int, err error) { + return w.buf.Write(p) +} + +// NewCodeWriter returns a new CodeWriter. +func NewCodeWriter() *CodeWriter { + h := fnv.New32() + return &CodeWriter{Hash: h, gob: gob.NewEncoder(h)} +} + +// WriteGoFile appends the buffer with the total size of all created structures +// and writes it as a Go file to the the given file with the given package name. +func (w *CodeWriter) WriteGoFile(filename, pkg string) { + f, err := os.Create(filename) + if err != nil { + log.Fatalf("Could not create file %s: %v", filename, err) + } + defer f.Close() + if _, err = w.WriteGo(f, pkg); err != nil { + log.Fatalf("Error writing file %s: %v", filename, err) + } +} + +// WriteGo appends the buffer with the total size of all created structures and +// writes it as a Go file to the the given writer with the given package name. +func (w *CodeWriter) WriteGo(out io.Writer, pkg string) (n int, err error) { + sz := w.Size + w.WriteComment("Total table size %d bytes (%dKiB); checksum: %X\n", sz, sz/1024, w.Hash.Sum32()) + defer w.buf.Reset() + return WriteGo(out, pkg, w.buf.Bytes()) +} + +func (w *CodeWriter) printf(f string, x ...interface{}) { + fmt.Fprintf(w, f, x...) +} + +func (w *CodeWriter) insertSep() { + if w.skipSep { + w.skipSep = false + return + } + // Use at least two newlines to ensure a blank space between the previous + // block. WriteGoFile will remove extraneous newlines. + w.printf("\n\n") +} + +// WriteComment writes a comment block. All line starts are prefixed with "//". +// Initial empty lines are gobbled. The indentation for the first line is +// stripped from consecutive lines. +func (w *CodeWriter) WriteComment(comment string, args ...interface{}) { + s := fmt.Sprintf(comment, args...) + s = strings.Trim(s, "\n") + + // Use at least two newlines to ensure a blank space between the previous + // block. WriteGoFile will remove extraneous newlines. + w.printf("\n\n// ") + w.skipSep = true + + // strip first indent level. + sep := "\n" + for ; len(s) > 0 && (s[0] == '\t' || s[0] == ' '); s = s[1:] { + sep += s[:1] + } + + strings.NewReplacer(sep, "\n// ", "\n", "\n// ").WriteString(w, s) + + w.printf("\n") +} + +func (w *CodeWriter) writeSizeInfo(size int) { + w.printf("// Size: %d bytes\n", size) +} + +// WriteConst writes a constant of the given name and value. +func (w *CodeWriter) WriteConst(name string, x interface{}) { + w.insertSep() + v := reflect.ValueOf(x) + + switch v.Type().Kind() { + case reflect.String: + // See golang.org/issue/13145. + const arbitraryCutoff = 16 + if v.Len() > arbitraryCutoff { + w.printf("var %s %s = ", name, typeName(x)) + } else { + w.printf("const %s %s = ", name, typeName(x)) + } + w.WriteString(v.String()) + w.printf("\n") + default: + w.printf("const %s = %#v\n", name, x) + } +} + +// WriteVar writes a variable of the given name and value. +func (w *CodeWriter) WriteVar(name string, x interface{}) { + w.insertSep() + v := reflect.ValueOf(x) + oldSize := w.Size + sz := int(v.Type().Size()) + w.Size += sz + + switch v.Type().Kind() { + case reflect.String: + w.printf("var %s %s = ", name, typeName(x)) + w.WriteString(v.String()) + case reflect.Struct: + w.gob.Encode(x) + fallthrough + case reflect.Slice, reflect.Array: + w.printf("var %s = ", name) + w.writeValue(v) + w.writeSizeInfo(w.Size - oldSize) + default: + w.printf("var %s %s = ", name, typeName(x)) + w.gob.Encode(x) + w.writeValue(v) + w.writeSizeInfo(w.Size - oldSize) + } + w.printf("\n") +} + +func (w *CodeWriter) writeValue(v reflect.Value) { + x := v.Interface() + switch v.Kind() { + case reflect.String: + w.WriteString(v.String()) + case reflect.Array: + // Don't double count: callers of WriteArray count on the size being + // added, so we need to discount it here. + w.Size -= int(v.Type().Size()) + w.writeSlice(x, true) + case reflect.Slice: + w.writeSlice(x, false) + case reflect.Struct: + w.printf("%s{\n", typeName(v.Interface())) + t := v.Type() + for i := 0; i < v.NumField(); i++ { + w.printf("%s: ", t.Field(i).Name) + w.writeValue(v.Field(i)) + w.printf(",\n") + } + w.printf("}") + default: + w.printf("%#v", x) + } +} + +// WriteString writes a string literal. +func (w *CodeWriter) WriteString(s string) { + s = strings.Replace(s, `\`, `\\`, -1) + io.WriteString(w.Hash, s) // content hash + w.Size += len(s) + + const maxInline = 40 + if len(s) <= maxInline { + w.printf("%q", s) + return + } + + // We will render the string as a multi-line string. + const maxWidth = 80 - 4 - len(`"`) - len(`" +`) + + // When starting on its own line, go fmt indents line 2+ an extra level. + n, max := maxWidth, maxWidth-4 + + // Print "" +\n, if a string does not start on its own line. + b := w.buf.Bytes() + if p := len(bytes.TrimRight(b, " \t")); p > 0 && b[p-1] != '\n' { + w.printf("\"\" + // Size: %d bytes\n", len(s)) + n, max = maxWidth, maxWidth + } + + w.printf(`"`) + + for sz, p := 0, 0; p < len(s); { + var r rune + r, sz = utf8.DecodeRuneInString(s[p:]) + out := s[p : p+sz] + chars := 1 + if !unicode.IsPrint(r) || r == utf8.RuneError || r == '"' { + switch sz { + case 1: + out = fmt.Sprintf("\\x%02x", s[p]) + case 2, 3: + out = fmt.Sprintf("\\u%04x", r) + case 4: + out = fmt.Sprintf("\\U%08x", r) + } + chars = len(out) + } + if n -= chars; n < 0 { + w.printf("\" +\n\"") + n = max - len(out) + } + w.printf("%s", out) + p += sz + } + w.printf(`"`) +} + +// WriteSlice writes a slice value. +func (w *CodeWriter) WriteSlice(x interface{}) { + w.writeSlice(x, false) +} + +// WriteArray writes an array value. +func (w *CodeWriter) WriteArray(x interface{}) { + w.writeSlice(x, true) +} + +func (w *CodeWriter) writeSlice(x interface{}, isArray bool) { + v := reflect.ValueOf(x) + w.gob.Encode(v.Len()) + w.Size += v.Len() * int(v.Type().Elem().Size()) + name := typeName(x) + if isArray { + name = fmt.Sprintf("[%d]%s", v.Len(), name[strings.Index(name, "]")+1:]) + } + if isArray { + w.printf("%s{\n", name) + } else { + w.printf("%s{ // %d elements\n", name, v.Len()) + } + + switch kind := v.Type().Elem().Kind(); kind { + case reflect.String: + for _, s := range x.([]string) { + w.WriteString(s) + w.printf(",\n") + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + // nLine and nBlock are the number of elements per line and block. + nLine, nBlock, format := 8, 64, "%d," + switch kind { + case reflect.Uint8: + format = "%#02x," + case reflect.Uint16: + format = "%#04x," + case reflect.Uint32: + nLine, nBlock, format = 4, 32, "%#08x," + case reflect.Uint, reflect.Uint64: + nLine, nBlock, format = 4, 32, "%#016x," + case reflect.Int8: + nLine = 16 + } + n := nLine + for i := 0; i < v.Len(); i++ { + if i%nBlock == 0 && v.Len() > nBlock { + w.printf("// Entry %X - %X\n", i, i+nBlock-1) + } + x := v.Index(i).Interface() + w.gob.Encode(x) + w.printf(format, x) + if n--; n == 0 { + n = nLine + w.printf("\n") + } + } + w.printf("\n") + case reflect.Struct: + zero := reflect.Zero(v.Type().Elem()).Interface() + for i := 0; i < v.Len(); i++ { + x := v.Index(i).Interface() + w.gob.EncodeValue(v) + if !reflect.DeepEqual(zero, x) { + line := fmt.Sprintf("%#v,\n", x) + line = line[strings.IndexByte(line, '{'):] + w.printf("%d: ", i) + w.printf(line) + } + } + case reflect.Array: + for i := 0; i < v.Len(); i++ { + w.printf("%d: %#v,\n", i, v.Index(i).Interface()) + } + default: + panic("gen: slice elem type not supported") + } + w.printf("}") +} + +// WriteType writes a definition of the type of the given value and returns the +// type name. +func (w *CodeWriter) WriteType(x interface{}) string { + t := reflect.TypeOf(x) + w.printf("type %s struct {\n", t.Name()) + for i := 0; i < t.NumField(); i++ { + w.printf("\t%s %s\n", t.Field(i).Name, t.Field(i).Type) + } + w.printf("}\n") + return t.Name() +} + +// typeName returns the name of the go type of x. +func typeName(x interface{}) string { + t := reflect.ValueOf(x).Type() + return strings.Replace(fmt.Sprint(t), "main.", "", 1) +} diff --git a/vendor/golang.org/x/text/internal/gen/gen.go b/vendor/golang.org/x/text/internal/gen/gen.go new file mode 100644 index 0000000000..84c699faa9 --- /dev/null +++ b/vendor/golang.org/x/text/internal/gen/gen.go @@ -0,0 +1,281 @@ +// Copyright 2015 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 gen contains common code for the various code generation tools in the +// text repository. Its usage ensures consistency between tools. +// +// This package defines command line flags that are common to most generation +// tools. The flags allow for specifying specific Unicode and CLDR versions +// in the public Unicode data repository (http://www.unicode.org/Public). +// +// A local Unicode data mirror can be set through the flag -local or the +// environment variable UNICODE_DIR. The former takes precedence. The local +// directory should follow the same structure as the public repository. +// +// IANA data can also optionally be mirrored by putting it in the iana directory +// rooted at the top of the local mirror. Beware, though, that IANA data is not +// versioned. So it is up to the developer to use the right version. +package gen // import "golang.org/x/text/internal/gen" + +import ( + "bytes" + "flag" + "fmt" + "go/build" + "go/format" + "io" + "io/ioutil" + "log" + "net/http" + "os" + "path" + "path/filepath" + "sync" + "unicode" + + "golang.org/x/text/unicode/cldr" +) + +var ( + url = flag.String("url", + "http://www.unicode.org/Public", + "URL of Unicode database directory") + iana = flag.String("iana", + "http://www.iana.org", + "URL of the IANA repository") + unicodeVersion = flag.String("unicode", + getEnv("UNICODE_VERSION", unicode.Version), + "unicode version to use") + cldrVersion = flag.String("cldr", + getEnv("CLDR_VERSION", cldr.Version), + "cldr version to use") +) + +func getEnv(name, def string) string { + if v := os.Getenv(name); v != "" { + return v + } + return def +} + +// Init performs common initialization for a gen command. It parses the flags +// and sets up the standard logging parameters. +func Init() { + log.SetPrefix("") + log.SetFlags(log.Lshortfile) + flag.Parse() +} + +const header = `// This file was generated by go generate; DO NOT EDIT + +package %s + +` + +// UnicodeVersion reports the requested Unicode version. +func UnicodeVersion() string { + return *unicodeVersion +} + +// UnicodeVersion reports the requested CLDR version. +func CLDRVersion() string { + return *cldrVersion +} + +// IsLocal reports whether data files are available locally. +func IsLocal() bool { + dir, err := localReadmeFile() + if err != nil { + return false + } + if _, err = os.Stat(dir); err != nil { + return false + } + return true +} + +// OpenUCDFile opens the requested UCD file. The file is specified relative to +// the public Unicode root directory. It will call log.Fatal if there are any +// errors. +func OpenUCDFile(file string) io.ReadCloser { + return openUnicode(path.Join(*unicodeVersion, "ucd", file)) +} + +// OpenCLDRCoreZip opens the CLDR core zip file. It will call log.Fatal if there +// are any errors. +func OpenCLDRCoreZip() io.ReadCloser { + return OpenUnicodeFile("cldr", *cldrVersion, "core.zip") +} + +// OpenUnicodeFile opens the requested file of the requested category from the +// root of the Unicode data archive. The file is specified relative to the +// public Unicode root directory. If version is "", it will use the default +// Unicode version. It will call log.Fatal if there are any errors. +func OpenUnicodeFile(category, version, file string) io.ReadCloser { + if version == "" { + version = UnicodeVersion() + } + return openUnicode(path.Join(category, version, file)) +} + +// OpenIANAFile opens the requested IANA file. The file is specified relative +// to the IANA root, which is typically either http://www.iana.org or the +// iana directory in the local mirror. It will call log.Fatal if there are any +// errors. +func OpenIANAFile(path string) io.ReadCloser { + return Open(*iana, "iana", path) +} + +var ( + dirMutex sync.Mutex + localDir string +) + +const permissions = 0755 + +func localReadmeFile() (string, error) { + p, err := build.Import("golang.org/x/text", "", build.FindOnly) + if err != nil { + return "", fmt.Errorf("Could not locate package: %v", err) + } + return filepath.Join(p.Dir, "DATA", "README"), nil +} + +func getLocalDir() string { + dirMutex.Lock() + defer dirMutex.Unlock() + + readme, err := localReadmeFile() + if err != nil { + log.Fatal(err) + } + dir := filepath.Dir(readme) + if _, err := os.Stat(readme); err != nil { + if err := os.MkdirAll(dir, permissions); err != nil { + log.Fatalf("Could not create directory: %v", err) + } + ioutil.WriteFile(readme, []byte(readmeTxt), permissions) + } + return dir +} + +const readmeTxt = `Generated by golang.org/x/text/internal/gen. DO NOT EDIT. + +This directory contains downloaded files used to generate the various tables +in the golang.org/x/text subrepo. + +Note that the language subtag repo (iana/assignments/language-subtag-registry) +and all other times in the iana subdirectory are not versioned and will need +to be periodically manually updated. The easiest way to do this is to remove +the entire iana directory. This is mostly of concern when updating the language +package. +` + +// Open opens subdir/path if a local directory is specified and the file exists, +// where subdir is a directory relative to the local root, or fetches it from +// urlRoot/path otherwise. It will call log.Fatal if there are any errors. +func Open(urlRoot, subdir, path string) io.ReadCloser { + file := filepath.Join(getLocalDir(), subdir, filepath.FromSlash(path)) + return open(file, urlRoot, path) +} + +func openUnicode(path string) io.ReadCloser { + file := filepath.Join(getLocalDir(), filepath.FromSlash(path)) + return open(file, *url, path) +} + +// TODO: automatically periodically update non-versioned files. + +func open(file, urlRoot, path string) io.ReadCloser { + if f, err := os.Open(file); err == nil { + return f + } + r := get(urlRoot, path) + defer r.Close() + b, err := ioutil.ReadAll(r) + if err != nil { + log.Fatalf("Could not download file: %v", err) + } + os.MkdirAll(filepath.Dir(file), permissions) + if err := ioutil.WriteFile(file, b, permissions); err != nil { + log.Fatalf("Could not create file: %v", err) + } + return ioutil.NopCloser(bytes.NewReader(b)) +} + +func get(root, path string) io.ReadCloser { + url := root + "/" + path + fmt.Printf("Fetching %s...", url) + defer fmt.Println(" done.") + resp, err := http.Get(url) + if err != nil { + log.Fatalf("HTTP GET: %v", err) + } + if resp.StatusCode != 200 { + log.Fatalf("Bad GET status for %q: %q", url, resp.Status) + } + return resp.Body +} + +// TODO: use Write*Version in all applicable packages. + +// WriteUnicodeVersion writes a constant for the Unicode version from which the +// tables are generated. +func WriteUnicodeVersion(w io.Writer) { + fmt.Fprintf(w, "// UnicodeVersion is the Unicode version from which the tables in this package are derived.\n") + fmt.Fprintf(w, "const UnicodeVersion = %q\n\n", UnicodeVersion()) +} + +// WriteCLDRVersion writes a constant for the CLDR version from which the +// tables are generated. +func WriteCLDRVersion(w io.Writer) { + fmt.Fprintf(w, "// CLDRVersion is the CLDR version from which the tables in this package are derived.\n") + fmt.Fprintf(w, "const CLDRVersion = %q\n\n", CLDRVersion()) +} + +// WriteGoFile prepends a standard file comment and package statement to the +// given bytes, applies gofmt, and writes them to a file with the given name. +// It will call log.Fatal if there are any errors. +func WriteGoFile(filename, pkg string, b []byte) { + w, err := os.Create(filename) + if err != nil { + log.Fatalf("Could not create file %s: %v", filename, err) + } + defer w.Close() + if _, err = WriteGo(w, pkg, b); err != nil { + log.Fatalf("Error writing file %s: %v", filename, err) + } +} + +// WriteGo prepends a standard file comment and package statement to the given +// bytes, applies gofmt, and writes them to w. +func WriteGo(w io.Writer, pkg string, b []byte) (n int, err error) { + src := []byte(fmt.Sprintf(header, pkg)) + src = append(src, b...) + formatted, err := format.Source(src) + if err != nil { + // Print the generated code even in case of an error so that the + // returned error can be meaningfully interpreted. + n, _ = w.Write(src) + return n, err + } + return w.Write(formatted) +} + +// Repackage rewrites a Go file from belonging to package main to belonging to +// the given package. +func Repackage(inFile, outFile, pkg string) { + src, err := ioutil.ReadFile(inFile) + if err != nil { + log.Fatalf("reading %s: %v", inFile, err) + } + const toDelete = "package main\n\n" + i := bytes.Index(src, []byte(toDelete)) + if i < 0 { + log.Fatalf("Could not find %q in %s.", toDelete, inFile) + } + w := &bytes.Buffer{} + w.Write(src[i+len(toDelete):]) + WriteGoFile(outFile, pkg, w.Bytes()) +} diff --git a/Godeps/_workspace/src/golang.org/x/text/internal/tag/tag.go b/vendor/golang.org/x/text/internal/tag/tag.go similarity index 97% rename from Godeps/_workspace/src/golang.org/x/text/internal/tag/tag.go rename to vendor/golang.org/x/text/internal/tag/tag.go index 2cf4ecd292..b5d348891d 100644 --- a/Godeps/_workspace/src/golang.org/x/text/internal/tag/tag.go +++ b/vendor/golang.org/x/text/internal/tag/tag.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package tag contains functionality handling tags and related data. -package tag +package tag // import "golang.org/x/text/internal/tag" import "sort" diff --git a/Godeps/_workspace/src/golang.org/x/text/internal/utf8internal/utf8internal.go b/vendor/golang.org/x/text/internal/utf8internal/utf8internal.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/internal/utf8internal/utf8internal.go rename to vendor/golang.org/x/text/internal/utf8internal/utf8internal.go diff --git a/Godeps/_workspace/src/golang.org/x/text/language/Makefile b/vendor/golang.org/x/text/language/Makefile similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/Makefile rename to vendor/golang.org/x/text/language/Makefile diff --git a/Godeps/_workspace/src/golang.org/x/text/language/common.go b/vendor/golang.org/x/text/language/common.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/common.go rename to vendor/golang.org/x/text/language/common.go diff --git a/Godeps/_workspace/src/golang.org/x/text/language/coverage.go b/vendor/golang.org/x/text/language/coverage.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/coverage.go rename to vendor/golang.org/x/text/language/coverage.go diff --git a/Godeps/_workspace/src/golang.org/x/text/language/gen_common.go b/vendor/golang.org/x/text/language/gen_common.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/gen_common.go rename to vendor/golang.org/x/text/language/gen_common.go diff --git a/Godeps/_workspace/src/golang.org/x/text/language/gen_index.go b/vendor/golang.org/x/text/language/gen_index.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/gen_index.go rename to vendor/golang.org/x/text/language/gen_index.go diff --git a/Godeps/_workspace/src/golang.org/x/text/language/go1_1.go b/vendor/golang.org/x/text/language/go1_1.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/go1_1.go rename to vendor/golang.org/x/text/language/go1_1.go diff --git a/Godeps/_workspace/src/golang.org/x/text/language/go1_2.go b/vendor/golang.org/x/text/language/go1_2.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/go1_2.go rename to vendor/golang.org/x/text/language/go1_2.go diff --git a/vendor/golang.org/x/text/language/index.go b/vendor/golang.org/x/text/language/index.go new file mode 100644 index 0000000000..50c7521868 --- /dev/null +++ b/vendor/golang.org/x/text/language/index.go @@ -0,0 +1,767 @@ +// This file was generated by go generate; DO NOT EDIT + +package language + +// NumCompactTags is the number of common tags. The maximum tag is +// NumCompactTags-1. +const NumCompactTags = 752 + +var specialTags = []Tag{ // 2 elements + 0: {lang: 0xd5, region: 0x6d, script: 0x0, pVariant: 0x5, pExt: 0xe, str: "ca-ES-valencia"}, + 1: {lang: 0x134, region: 0x134, script: 0x0, pVariant: 0x5, pExt: 0x5, str: "en-US-u-va-posix"}, +} // Size: 72 bytes + +var coreTags = map[uint32]uint16{ + 0x0: 0, // und + 0x01500000: 3, // af + 0x015000d1: 4, // af-NA + 0x01500160: 5, // af-ZA + 0x01b00000: 6, // agq + 0x01b00051: 7, // agq-CM + 0x02000000: 8, // ak + 0x0200007f: 9, // ak-GH + 0x02600000: 10, // am + 0x0260006e: 11, // am-ET + 0x03900000: 12, // ar + 0x03900001: 13, // ar-001 + 0x03900022: 14, // ar-AE + 0x03900038: 15, // ar-BH + 0x03900061: 16, // ar-DJ + 0x03900066: 17, // ar-DZ + 0x0390006a: 18, // ar-EG + 0x0390006b: 19, // ar-EH + 0x0390006c: 20, // ar-ER + 0x03900096: 21, // ar-IL + 0x0390009a: 22, // ar-IQ + 0x039000a0: 23, // ar-JO + 0x039000a7: 24, // ar-KM + 0x039000ab: 25, // ar-KW + 0x039000af: 26, // ar-LB + 0x039000b8: 27, // ar-LY + 0x039000b9: 28, // ar-MA + 0x039000c8: 29, // ar-MR + 0x039000e0: 30, // ar-OM + 0x039000ec: 31, // ar-PS + 0x039000f2: 32, // ar-QA + 0x03900107: 33, // ar-SA + 0x0390010a: 34, // ar-SD + 0x03900114: 35, // ar-SO + 0x03900116: 36, // ar-SS + 0x0390011b: 37, // ar-SY + 0x0390011f: 38, // ar-TD + 0x03900127: 39, // ar-TN + 0x0390015d: 40, // ar-YE + 0x03f00000: 41, // ars + 0x04200000: 42, // as + 0x04200098: 43, // as-IN + 0x04300000: 44, // asa + 0x0430012e: 45, // asa-TZ + 0x04700000: 46, // ast + 0x0470006d: 47, // ast-ES + 0x05700000: 48, // az + 0x0571e000: 49, // az-Cyrl + 0x0571e031: 50, // az-Cyrl-AZ + 0x05752000: 51, // az-Latn + 0x05752031: 52, // az-Latn-AZ + 0x05d00000: 53, // bas + 0x05d00051: 54, // bas-CM + 0x07000000: 55, // be + 0x07000046: 56, // be-BY + 0x07400000: 57, // bem + 0x07400161: 58, // bem-ZM + 0x07800000: 59, // bez + 0x0780012e: 60, // bez-TZ + 0x07d00000: 61, // bg + 0x07d00037: 62, // bg-BG + 0x08100000: 63, // bh + 0x09e00000: 64, // bm + 0x09e000c2: 65, // bm-ML + 0x0a300000: 66, // bn + 0x0a300034: 67, // bn-BD + 0x0a300098: 68, // bn-IN + 0x0a700000: 69, // bo + 0x0a700052: 70, // bo-CN + 0x0a700098: 71, // bo-IN + 0x0b000000: 72, // br + 0x0b000077: 73, // br-FR + 0x0b300000: 74, // brx + 0x0b300098: 75, // brx-IN + 0x0b500000: 76, // bs + 0x0b51e000: 77, // bs-Cyrl + 0x0b51e032: 78, // bs-Cyrl-BA + 0x0b552000: 79, // bs-Latn + 0x0b552032: 80, // bs-Latn-BA + 0x0d500000: 81, // ca + 0x0d500021: 82, // ca-AD + 0x0d50006d: 83, // ca-ES + 0x0d500077: 84, // ca-FR + 0x0d50009d: 85, // ca-IT + 0x0da00000: 86, // ce + 0x0da00105: 87, // ce-RU + 0x0dd00000: 88, // cgg + 0x0dd00130: 89, // cgg-UG + 0x0e300000: 90, // chr + 0x0e300134: 91, // chr-US + 0x0e700000: 92, // ckb + 0x0e70009a: 93, // ckb-IQ + 0x0e70009b: 94, // ckb-IR + 0x0f600000: 95, // cs + 0x0f60005d: 96, // cs-CZ + 0x0fa00000: 97, // cu + 0x0fa00105: 98, // cu-RU + 0x0fc00000: 99, // cy + 0x0fc0007a: 100, // cy-GB + 0x0fd00000: 101, // da + 0x0fd00062: 102, // da-DK + 0x0fd00081: 103, // da-GL + 0x10400000: 104, // dav + 0x104000a3: 105, // dav-KE + 0x10900000: 106, // de + 0x1090002d: 107, // de-AT + 0x10900035: 108, // de-BE + 0x1090004d: 109, // de-CH + 0x1090005f: 110, // de-DE + 0x1090009d: 111, // de-IT + 0x109000b1: 112, // de-LI + 0x109000b6: 113, // de-LU + 0x11300000: 114, // dje + 0x113000d3: 115, // dje-NE + 0x11b00000: 116, // dsb + 0x11b0005f: 117, // dsb-DE + 0x12000000: 118, // dua + 0x12000051: 119, // dua-CM + 0x12400000: 120, // dv + 0x12700000: 121, // dyo + 0x12700113: 122, // dyo-SN + 0x12900000: 123, // dz + 0x12900042: 124, // dz-BT + 0x12b00000: 125, // ebu + 0x12b000a3: 126, // ebu-KE + 0x12c00000: 127, // ee + 0x12c0007f: 128, // ee-GH + 0x12c00121: 129, // ee-TG + 0x13100000: 130, // el + 0x1310005c: 131, // el-CY + 0x13100086: 132, // el-GR + 0x13400000: 133, // en + 0x13400001: 134, // en-001 + 0x1340001a: 135, // en-150 + 0x13400024: 136, // en-AG + 0x13400025: 137, // en-AI + 0x1340002c: 138, // en-AS + 0x1340002d: 139, // en-AT + 0x1340002e: 140, // en-AU + 0x13400033: 141, // en-BB + 0x13400035: 142, // en-BE + 0x13400039: 143, // en-BI + 0x1340003c: 144, // en-BM + 0x13400041: 145, // en-BS + 0x13400045: 146, // en-BW + 0x13400047: 147, // en-BZ + 0x13400048: 148, // en-CA + 0x13400049: 149, // en-CC + 0x1340004d: 150, // en-CH + 0x1340004f: 151, // en-CK + 0x13400051: 152, // en-CM + 0x1340005b: 153, // en-CX + 0x1340005c: 154, // en-CY + 0x1340005f: 155, // en-DE + 0x13400060: 156, // en-DG + 0x13400062: 157, // en-DK + 0x13400063: 158, // en-DM + 0x1340006c: 159, // en-ER + 0x13400071: 160, // en-FI + 0x13400072: 161, // en-FJ + 0x13400073: 162, // en-FK + 0x13400074: 163, // en-FM + 0x1340007a: 164, // en-GB + 0x1340007b: 165, // en-GD + 0x1340007e: 166, // en-GG + 0x1340007f: 167, // en-GH + 0x13400080: 168, // en-GI + 0x13400082: 169, // en-GM + 0x13400089: 170, // en-GU + 0x1340008b: 171, // en-GY + 0x1340008c: 172, // en-HK + 0x13400095: 173, // en-IE + 0x13400096: 174, // en-IL + 0x13400097: 175, // en-IM + 0x13400098: 176, // en-IN + 0x13400099: 177, // en-IO + 0x1340009e: 178, // en-JE + 0x1340009f: 179, // en-JM + 0x134000a3: 180, // en-KE + 0x134000a6: 181, // en-KI + 0x134000a8: 182, // en-KN + 0x134000ac: 183, // en-KY + 0x134000b0: 184, // en-LC + 0x134000b3: 185, // en-LR + 0x134000b4: 186, // en-LS + 0x134000be: 187, // en-MG + 0x134000bf: 188, // en-MH + 0x134000c5: 189, // en-MO + 0x134000c6: 190, // en-MP + 0x134000c9: 191, // en-MS + 0x134000ca: 192, // en-MT + 0x134000cb: 193, // en-MU + 0x134000cd: 194, // en-MW + 0x134000cf: 195, // en-MY + 0x134000d1: 196, // en-NA + 0x134000d4: 197, // en-NF + 0x134000d5: 198, // en-NG + 0x134000d8: 199, // en-NL + 0x134000dc: 200, // en-NR + 0x134000de: 201, // en-NU + 0x134000df: 202, // en-NZ + 0x134000e5: 203, // en-PG + 0x134000e6: 204, // en-PH + 0x134000e7: 205, // en-PK + 0x134000ea: 206, // en-PN + 0x134000eb: 207, // en-PR + 0x134000ef: 208, // en-PW + 0x13400106: 209, // en-RW + 0x13400108: 210, // en-SB + 0x13400109: 211, // en-SC + 0x1340010a: 212, // en-SD + 0x1340010b: 213, // en-SE + 0x1340010c: 214, // en-SG + 0x1340010d: 215, // en-SH + 0x1340010e: 216, // en-SI + 0x13400111: 217, // en-SL + 0x13400116: 218, // en-SS + 0x1340011a: 219, // en-SX + 0x1340011c: 220, // en-SZ + 0x1340011e: 221, // en-TC + 0x13400124: 222, // en-TK + 0x13400128: 223, // en-TO + 0x1340012b: 224, // en-TT + 0x1340012c: 225, // en-TV + 0x1340012e: 226, // en-TZ + 0x13400130: 227, // en-UG + 0x13400132: 228, // en-UM + 0x13400134: 229, // en-US + 0x13400138: 230, // en-VC + 0x1340013b: 231, // en-VG + 0x1340013c: 232, // en-VI + 0x1340013e: 233, // en-VU + 0x13400141: 234, // en-WS + 0x13400160: 235, // en-ZA + 0x13400161: 236, // en-ZM + 0x13400163: 237, // en-ZW + 0x13700000: 238, // eo + 0x13700001: 239, // eo-001 + 0x13900000: 240, // es + 0x1390001e: 241, // es-419 + 0x1390002b: 242, // es-AR + 0x1390003e: 243, // es-BO + 0x13900040: 244, // es-BR + 0x13900050: 245, // es-CL + 0x13900053: 246, // es-CO + 0x13900055: 247, // es-CR + 0x13900058: 248, // es-CU + 0x13900064: 249, // es-DO + 0x13900067: 250, // es-EA + 0x13900068: 251, // es-EC + 0x1390006d: 252, // es-ES + 0x13900085: 253, // es-GQ + 0x13900088: 254, // es-GT + 0x1390008e: 255, // es-HN + 0x13900093: 256, // es-IC + 0x139000ce: 257, // es-MX + 0x139000d7: 258, // es-NI + 0x139000e1: 259, // es-PA + 0x139000e3: 260, // es-PE + 0x139000e6: 261, // es-PH + 0x139000eb: 262, // es-PR + 0x139000f0: 263, // es-PY + 0x13900119: 264, // es-SV + 0x13900134: 265, // es-US + 0x13900135: 266, // es-UY + 0x1390013a: 267, // es-VE + 0x13b00000: 268, // et + 0x13b00069: 269, // et-EE + 0x14000000: 270, // eu + 0x1400006d: 271, // eu-ES + 0x14100000: 272, // ewo + 0x14100051: 273, // ewo-CM + 0x14300000: 274, // fa + 0x14300023: 275, // fa-AF + 0x1430009b: 276, // fa-IR + 0x14900000: 277, // ff + 0x14900051: 278, // ff-CM + 0x14900083: 279, // ff-GN + 0x149000c8: 280, // ff-MR + 0x14900113: 281, // ff-SN + 0x14c00000: 282, // fi + 0x14c00071: 283, // fi-FI + 0x14e00000: 284, // fil + 0x14e000e6: 285, // fil-PH + 0x15300000: 286, // fo + 0x15300062: 287, // fo-DK + 0x15300075: 288, // fo-FO + 0x15900000: 289, // fr + 0x15900035: 290, // fr-BE + 0x15900036: 291, // fr-BF + 0x15900039: 292, // fr-BI + 0x1590003a: 293, // fr-BJ + 0x1590003b: 294, // fr-BL + 0x15900048: 295, // fr-CA + 0x1590004a: 296, // fr-CD + 0x1590004b: 297, // fr-CF + 0x1590004c: 298, // fr-CG + 0x1590004d: 299, // fr-CH + 0x1590004e: 300, // fr-CI + 0x15900051: 301, // fr-CM + 0x15900061: 302, // fr-DJ + 0x15900066: 303, // fr-DZ + 0x15900077: 304, // fr-FR + 0x15900079: 305, // fr-GA + 0x1590007d: 306, // fr-GF + 0x15900083: 307, // fr-GN + 0x15900084: 308, // fr-GP + 0x15900085: 309, // fr-GQ + 0x15900090: 310, // fr-HT + 0x159000a7: 311, // fr-KM + 0x159000b6: 312, // fr-LU + 0x159000b9: 313, // fr-MA + 0x159000ba: 314, // fr-MC + 0x159000bd: 315, // fr-MF + 0x159000be: 316, // fr-MG + 0x159000c2: 317, // fr-ML + 0x159000c7: 318, // fr-MQ + 0x159000c8: 319, // fr-MR + 0x159000cb: 320, // fr-MU + 0x159000d2: 321, // fr-NC + 0x159000d3: 322, // fr-NE + 0x159000e4: 323, // fr-PF + 0x159000e9: 324, // fr-PM + 0x15900101: 325, // fr-RE + 0x15900106: 326, // fr-RW + 0x15900109: 327, // fr-SC + 0x15900113: 328, // fr-SN + 0x1590011b: 329, // fr-SY + 0x1590011f: 330, // fr-TD + 0x15900121: 331, // fr-TG + 0x15900127: 332, // fr-TN + 0x1590013e: 333, // fr-VU + 0x1590013f: 334, // fr-WF + 0x1590015e: 335, // fr-YT + 0x16400000: 336, // fur + 0x1640009d: 337, // fur-IT + 0x16800000: 338, // fy + 0x168000d8: 339, // fy-NL + 0x16900000: 340, // ga + 0x16900095: 341, // ga-IE + 0x17800000: 342, // gd + 0x1780007a: 343, // gd-GB + 0x18a00000: 344, // gl + 0x18a0006d: 345, // gl-ES + 0x19c00000: 346, // gsw + 0x19c0004d: 347, // gsw-CH + 0x19c00077: 348, // gsw-FR + 0x19c000b1: 349, // gsw-LI + 0x19d00000: 350, // gu + 0x19d00098: 351, // gu-IN + 0x1a200000: 352, // guw + 0x1a400000: 353, // guz + 0x1a4000a3: 354, // guz-KE + 0x1a500000: 355, // gv + 0x1a500097: 356, // gv-IM + 0x1ad00000: 357, // ha + 0x1ad0007f: 358, // ha-GH + 0x1ad000d3: 359, // ha-NE + 0x1ad000d5: 360, // ha-NG + 0x1b100000: 361, // haw + 0x1b100134: 362, // haw-US + 0x1b500000: 363, // he + 0x1b500096: 364, // he-IL + 0x1b700000: 365, // hi + 0x1b700098: 366, // hi-IN + 0x1ca00000: 367, // hr + 0x1ca00032: 368, // hr-BA + 0x1ca0008f: 369, // hr-HR + 0x1cb00000: 370, // hsb + 0x1cb0005f: 371, // hsb-DE + 0x1ce00000: 372, // hu + 0x1ce00091: 373, // hu-HU + 0x1d000000: 374, // hy + 0x1d000027: 375, // hy-AM + 0x1da00000: 376, // id + 0x1da00094: 377, // id-ID + 0x1df00000: 378, // ig + 0x1df000d5: 379, // ig-NG + 0x1e200000: 380, // ii + 0x1e200052: 381, // ii-CN + 0x1f000000: 382, // is + 0x1f00009c: 383, // is-IS + 0x1f100000: 384, // it + 0x1f10004d: 385, // it-CH + 0x1f10009d: 386, // it-IT + 0x1f100112: 387, // it-SM + 0x1f200000: 388, // iu + 0x1f800000: 389, // ja + 0x1f8000a1: 390, // ja-JP + 0x1fb00000: 391, // jbo + 0x1ff00000: 392, // jgo + 0x1ff00051: 393, // jgo-CM + 0x20200000: 394, // jmc + 0x2020012e: 395, // jmc-TZ + 0x20600000: 396, // jv + 0x20800000: 397, // ka + 0x2080007c: 398, // ka-GE + 0x20a00000: 399, // kab + 0x20a00066: 400, // kab-DZ + 0x20e00000: 401, // kaj + 0x20f00000: 402, // kam + 0x20f000a3: 403, // kam-KE + 0x21700000: 404, // kcg + 0x21b00000: 405, // kde + 0x21b0012e: 406, // kde-TZ + 0x21f00000: 407, // kea + 0x21f00059: 408, // kea-CV + 0x22c00000: 409, // khq + 0x22c000c2: 410, // khq-ML + 0x23100000: 411, // ki + 0x231000a3: 412, // ki-KE + 0x23a00000: 413, // kk + 0x23a000ad: 414, // kk-KZ + 0x23c00000: 415, // kkj + 0x23c00051: 416, // kkj-CM + 0x23d00000: 417, // kl + 0x23d00081: 418, // kl-GL + 0x23e00000: 419, // kln + 0x23e000a3: 420, // kln-KE + 0x24200000: 421, // km + 0x242000a5: 422, // km-KH + 0x24900000: 423, // kn + 0x24900098: 424, // kn-IN + 0x24b00000: 425, // ko + 0x24b000a9: 426, // ko-KP + 0x24b000aa: 427, // ko-KR + 0x24d00000: 428, // kok + 0x24d00098: 429, // kok-IN + 0x26100000: 430, // ks + 0x26100098: 431, // ks-IN + 0x26200000: 432, // ksb + 0x2620012e: 433, // ksb-TZ + 0x26400000: 434, // ksf + 0x26400051: 435, // ksf-CM + 0x26500000: 436, // ksh + 0x2650005f: 437, // ksh-DE + 0x26b00000: 438, // ku + 0x27800000: 439, // kw + 0x2780007a: 440, // kw-GB + 0x28100000: 441, // ky + 0x281000a4: 442, // ky-KG + 0x28800000: 443, // lag + 0x2880012e: 444, // lag-TZ + 0x28c00000: 445, // lb + 0x28c000b6: 446, // lb-LU + 0x29a00000: 447, // lg + 0x29a00130: 448, // lg-UG + 0x2a600000: 449, // lkt + 0x2a600134: 450, // lkt-US + 0x2ac00000: 451, // ln + 0x2ac00029: 452, // ln-AO + 0x2ac0004a: 453, // ln-CD + 0x2ac0004b: 454, // ln-CF + 0x2ac0004c: 455, // ln-CG + 0x2af00000: 456, // lo + 0x2af000ae: 457, // lo-LA + 0x2b600000: 458, // lrc + 0x2b60009a: 459, // lrc-IQ + 0x2b60009b: 460, // lrc-IR + 0x2b700000: 461, // lt + 0x2b7000b5: 462, // lt-LT + 0x2b900000: 463, // lu + 0x2b90004a: 464, // lu-CD + 0x2bb00000: 465, // luo + 0x2bb000a3: 466, // luo-KE + 0x2bc00000: 467, // luy + 0x2bc000a3: 468, // luy-KE + 0x2be00000: 469, // lv + 0x2be000b7: 470, // lv-LV + 0x2c800000: 471, // mas + 0x2c8000a3: 472, // mas-KE + 0x2c80012e: 473, // mas-TZ + 0x2e000000: 474, // mer + 0x2e0000a3: 475, // mer-KE + 0x2e400000: 476, // mfe + 0x2e4000cb: 477, // mfe-MU + 0x2e800000: 478, // mg + 0x2e8000be: 479, // mg-MG + 0x2e900000: 480, // mgh + 0x2e9000d0: 481, // mgh-MZ + 0x2eb00000: 482, // mgo + 0x2eb00051: 483, // mgo-CM + 0x2f600000: 484, // mk + 0x2f6000c1: 485, // mk-MK + 0x2fb00000: 486, // ml + 0x2fb00098: 487, // ml-IN + 0x30200000: 488, // mn + 0x302000c4: 489, // mn-MN + 0x31200000: 490, // mr + 0x31200098: 491, // mr-IN + 0x31600000: 492, // ms + 0x3160003d: 493, // ms-BN + 0x316000cf: 494, // ms-MY + 0x3160010c: 495, // ms-SG + 0x31700000: 496, // mt + 0x317000ca: 497, // mt-MT + 0x31c00000: 498, // mua + 0x31c00051: 499, // mua-CM + 0x32800000: 500, // my + 0x328000c3: 501, // my-MM + 0x33100000: 502, // mzn + 0x3310009b: 503, // mzn-IR + 0x33800000: 504, // nah + 0x33c00000: 505, // naq + 0x33c000d1: 506, // naq-NA + 0x33e00000: 507, // nb + 0x33e000d9: 508, // nb-NO + 0x33e0010f: 509, // nb-SJ + 0x34500000: 510, // nd + 0x34500163: 511, // nd-ZW + 0x34700000: 512, // nds + 0x3470005f: 513, // nds-DE + 0x347000d8: 514, // nds-NL + 0x34800000: 515, // ne + 0x34800098: 516, // ne-IN + 0x348000da: 517, // ne-NP + 0x35e00000: 518, // nl + 0x35e0002f: 519, // nl-AW + 0x35e00035: 520, // nl-BE + 0x35e0003f: 521, // nl-BQ + 0x35e0005a: 522, // nl-CW + 0x35e000d8: 523, // nl-NL + 0x35e00115: 524, // nl-SR + 0x35e0011a: 525, // nl-SX + 0x35f00000: 526, // nmg + 0x35f00051: 527, // nmg-CM + 0x36100000: 528, // nn + 0x361000d9: 529, // nn-NO + 0x36300000: 530, // nnh + 0x36300051: 531, // nnh-CM + 0x36600000: 532, // no + 0x36c00000: 533, // nqo + 0x36d00000: 534, // nr + 0x37100000: 535, // nso + 0x37700000: 536, // nus + 0x37700116: 537, // nus-SS + 0x37e00000: 538, // ny + 0x38000000: 539, // nyn + 0x38000130: 540, // nyn-UG + 0x38700000: 541, // om + 0x3870006e: 542, // om-ET + 0x387000a3: 543, // om-KE + 0x38c00000: 544, // or + 0x38c00098: 545, // or-IN + 0x38f00000: 546, // os + 0x38f0007c: 547, // os-GE + 0x38f00105: 548, // os-RU + 0x39400000: 549, // pa + 0x39405000: 550, // pa-Arab + 0x394050e7: 551, // pa-Arab-PK + 0x3942f000: 552, // pa-Guru + 0x3942f098: 553, // pa-Guru-IN + 0x39800000: 554, // pap + 0x3aa00000: 555, // pl + 0x3aa000e8: 556, // pl-PL + 0x3b400000: 557, // prg + 0x3b400001: 558, // prg-001 + 0x3b500000: 559, // ps + 0x3b500023: 560, // ps-AF + 0x3b700000: 561, // pt + 0x3b700029: 562, // pt-AO + 0x3b700040: 563, // pt-BR + 0x3b70004d: 564, // pt-CH + 0x3b700059: 565, // pt-CV + 0x3b700085: 566, // pt-GQ + 0x3b70008a: 567, // pt-GW + 0x3b7000b6: 568, // pt-LU + 0x3b7000c5: 569, // pt-MO + 0x3b7000d0: 570, // pt-MZ + 0x3b7000ed: 571, // pt-PT + 0x3b700117: 572, // pt-ST + 0x3b700125: 573, // pt-TL + 0x3bb00000: 574, // qu + 0x3bb0003e: 575, // qu-BO + 0x3bb00068: 576, // qu-EC + 0x3bb000e3: 577, // qu-PE + 0x3cb00000: 578, // rm + 0x3cb0004d: 579, // rm-CH + 0x3d000000: 580, // rn + 0x3d000039: 581, // rn-BI + 0x3d300000: 582, // ro + 0x3d3000bb: 583, // ro-MD + 0x3d300103: 584, // ro-RO + 0x3d500000: 585, // rof + 0x3d50012e: 586, // rof-TZ + 0x3d900000: 587, // ru + 0x3d900046: 588, // ru-BY + 0x3d9000a4: 589, // ru-KG + 0x3d9000ad: 590, // ru-KZ + 0x3d9000bb: 591, // ru-MD + 0x3d900105: 592, // ru-RU + 0x3d90012f: 593, // ru-UA + 0x3dc00000: 594, // rw + 0x3dc00106: 595, // rw-RW + 0x3dd00000: 596, // rwk + 0x3dd0012e: 597, // rwk-TZ + 0x3e200000: 598, // sah + 0x3e200105: 599, // sah-RU + 0x3e300000: 600, // saq + 0x3e3000a3: 601, // saq-KE + 0x3e900000: 602, // sbp + 0x3e90012e: 603, // sbp-TZ + 0x3f200000: 604, // sdh + 0x3f300000: 605, // se + 0x3f300071: 606, // se-FI + 0x3f3000d9: 607, // se-NO + 0x3f30010b: 608, // se-SE + 0x3f500000: 609, // seh + 0x3f5000d0: 610, // seh-MZ + 0x3f700000: 611, // ses + 0x3f7000c2: 612, // ses-ML + 0x3f800000: 613, // sg + 0x3f80004b: 614, // sg-CF + 0x3fe00000: 615, // shi + 0x3fe52000: 616, // shi-Latn + 0x3fe520b9: 617, // shi-Latn-MA + 0x3fed2000: 618, // shi-Tfng + 0x3fed20b9: 619, // shi-Tfng-MA + 0x40200000: 620, // si + 0x402000b2: 621, // si-LK + 0x40800000: 622, // sk + 0x40800110: 623, // sk-SK + 0x40c00000: 624, // sl + 0x40c0010e: 625, // sl-SI + 0x41200000: 626, // sma + 0x41300000: 627, // smi + 0x41400000: 628, // smj + 0x41500000: 629, // smn + 0x41500071: 630, // smn-FI + 0x41800000: 631, // sms + 0x41900000: 632, // sn + 0x41900163: 633, // sn-ZW + 0x41f00000: 634, // so + 0x41f00061: 635, // so-DJ + 0x41f0006e: 636, // so-ET + 0x41f000a3: 637, // so-KE + 0x41f00114: 638, // so-SO + 0x42700000: 639, // sq + 0x42700026: 640, // sq-AL + 0x427000c1: 641, // sq-MK + 0x4270014c: 642, // sq-XK + 0x42800000: 643, // sr + 0x4281e000: 644, // sr-Cyrl + 0x4281e032: 645, // sr-Cyrl-BA + 0x4281e0bc: 646, // sr-Cyrl-ME + 0x4281e104: 647, // sr-Cyrl-RS + 0x4281e14c: 648, // sr-Cyrl-XK + 0x42852000: 649, // sr-Latn + 0x42852032: 650, // sr-Latn-BA + 0x428520bc: 651, // sr-Latn-ME + 0x42852104: 652, // sr-Latn-RS + 0x4285214c: 653, // sr-Latn-XK + 0x42d00000: 654, // ss + 0x43000000: 655, // ssy + 0x43100000: 656, // st + 0x43a00000: 657, // sv + 0x43a00030: 658, // sv-AX + 0x43a00071: 659, // sv-FI + 0x43a0010b: 660, // sv-SE + 0x43b00000: 661, // sw + 0x43b0004a: 662, // sw-CD + 0x43b000a3: 663, // sw-KE + 0x43b0012e: 664, // sw-TZ + 0x43b00130: 665, // sw-UG + 0x44400000: 666, // syr + 0x44600000: 667, // ta + 0x44600098: 668, // ta-IN + 0x446000b2: 669, // ta-LK + 0x446000cf: 670, // ta-MY + 0x4460010c: 671, // ta-SG + 0x45700000: 672, // te + 0x45700098: 673, // te-IN + 0x45a00000: 674, // teo + 0x45a000a3: 675, // teo-KE + 0x45a00130: 676, // teo-UG + 0x46100000: 677, // th + 0x46100122: 678, // th-TH + 0x46500000: 679, // ti + 0x4650006c: 680, // ti-ER + 0x4650006e: 681, // ti-ET + 0x46700000: 682, // tig + 0x46c00000: 683, // tk + 0x46c00126: 684, // tk-TM + 0x47600000: 685, // tn + 0x47800000: 686, // to + 0x47800128: 687, // to-TO + 0x48000000: 688, // tr + 0x4800005c: 689, // tr-CY + 0x4800012a: 690, // tr-TR + 0x48400000: 691, // ts + 0x49a00000: 692, // twq + 0x49a000d3: 693, // twq-NE + 0x49f00000: 694, // tzm + 0x49f000b9: 695, // tzm-MA + 0x4a200000: 696, // ug + 0x4a200052: 697, // ug-CN + 0x4a400000: 698, // uk + 0x4a40012f: 699, // uk-UA + 0x4aa00000: 700, // ur + 0x4aa00098: 701, // ur-IN + 0x4aa000e7: 702, // ur-PK + 0x4b200000: 703, // uz + 0x4b205000: 704, // uz-Arab + 0x4b205023: 705, // uz-Arab-AF + 0x4b21e000: 706, // uz-Cyrl + 0x4b21e136: 707, // uz-Cyrl-UZ + 0x4b252000: 708, // uz-Latn + 0x4b252136: 709, // uz-Latn-UZ + 0x4b400000: 710, // vai + 0x4b452000: 711, // vai-Latn + 0x4b4520b3: 712, // vai-Latn-LR + 0x4b4d9000: 713, // vai-Vaii + 0x4b4d90b3: 714, // vai-Vaii-LR + 0x4b600000: 715, // ve + 0x4b900000: 716, // vi + 0x4b90013d: 717, // vi-VN + 0x4bf00000: 718, // vo + 0x4bf00001: 719, // vo-001 + 0x4c200000: 720, // vun + 0x4c20012e: 721, // vun-TZ + 0x4c400000: 722, // wa + 0x4c500000: 723, // wae + 0x4c50004d: 724, // wae-CH + 0x4db00000: 725, // wo + 0x4e800000: 726, // xh + 0x4f100000: 727, // xog + 0x4f100130: 728, // xog-UG + 0x4ff00000: 729, // yav + 0x4ff00051: 730, // yav-CM + 0x50800000: 731, // yi + 0x50800001: 732, // yi-001 + 0x50e00000: 733, // yo + 0x50e0003a: 734, // yo-BJ + 0x50e000d5: 735, // yo-NG + 0x51500000: 736, // yue + 0x5150008c: 737, // yue-HK + 0x51e00000: 738, // zgh + 0x51e000b9: 739, // zgh-MA + 0x51f00000: 740, // zh + 0x51f34000: 741, // zh-Hans + 0x51f34052: 742, // zh-Hans-CN + 0x51f3408c: 743, // zh-Hans-HK + 0x51f340c5: 744, // zh-Hans-MO + 0x51f3410c: 745, // zh-Hans-SG + 0x51f35000: 746, // zh-Hant + 0x51f3508c: 747, // zh-Hant-HK + 0x51f350c5: 748, // zh-Hant-MO + 0x51f3512d: 749, // zh-Hant-TW + 0x52400000: 750, // zu + 0x52400160: 751, // zu-ZA +} + +// Total table size 4580 bytes (4KiB); checksum: A7F72A2A diff --git a/Godeps/_workspace/src/golang.org/x/text/language/language.go b/vendor/golang.org/x/text/language/language.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/text/language/language.go rename to vendor/golang.org/x/text/language/language.go index 5c6dcbd94d..5eecceb619 100644 --- a/Godeps/_workspace/src/golang.org/x/text/language/language.go +++ b/vendor/golang.org/x/text/language/language.go @@ -100,7 +100,7 @@ // // BCP 47 - Tags for Identifying Languages // http://tools.ietf.org/html/bcp47 -package language +package language // import "golang.org/x/text/language" // TODO: Remove above NOTE after: // - verifying that tables are dropped correctly (most notably matcher tables). @@ -593,7 +593,7 @@ func (t Tag) Extension(x byte) (ext Extension, ok bool) { return Extension{ext}, true } } - return Extension{string(x)}, false + return Extension{}, false } // Extensions returns all extensions of t. diff --git a/Godeps/_workspace/src/golang.org/x/text/language/lookup.go b/vendor/golang.org/x/text/language/lookup.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/lookup.go rename to vendor/golang.org/x/text/language/lookup.go diff --git a/Godeps/_workspace/src/golang.org/x/text/language/maketables.go b/vendor/golang.org/x/text/language/maketables.go similarity index 99% rename from Godeps/_workspace/src/golang.org/x/text/language/maketables.go rename to vendor/golang.org/x/text/language/maketables.go index 2cc995b379..107f99254d 100644 --- a/Godeps/_workspace/src/golang.org/x/text/language/maketables.go +++ b/vendor/golang.org/x/text/language/maketables.go @@ -678,6 +678,8 @@ func (b *builder) parseIndices() { b.locale.parse(meta.DefaultContent.Locales) } +// TODO: region inclusion data will probably not be use used in future matchers. + func (b *builder) computeRegionGroups() { b.groups = make(map[int]index) @@ -686,6 +688,11 @@ func (b *builder) computeRegionGroups() { b.groups[i] = index(len(b.groups)) } for _, g := range b.supp.TerritoryContainment.Group { + // Skip UN and EURO zone as they are flattening the containment + // relationship. + if g.Type == "EZ" || g.Type == "UN" { + continue + } group := b.region.index(g.Type) if _, ok := b.groups[group]; !ok { b.groups[group] = index(len(b.groups)) @@ -782,6 +789,7 @@ func (b *builder) writeLanguage() { lang.updateLater("tw", "twi") lang.updateLater("nb", "nob") lang.updateLater("ak", "aka") + lang.updateLater("bh", "bih") // Ensure that each 2-letter code is matched with a 3-letter code. for _, v := range lang.s[1:] { @@ -1482,6 +1490,11 @@ func (b *builder) writeRegionInclusionData() { containment = make(map[index][]index) ) for _, g := range b.supp.TerritoryContainment.Group { + // Skip UN and EURO zone as they are flattening the containment + // relationship. + if g.Type == "EZ" || g.Type == "UN" { + continue + } group := b.region.index(g.Type) groupIdx := b.groups[group] for _, mem := range strings.Split(g.Contains, " ") { diff --git a/Godeps/_workspace/src/golang.org/x/text/language/match.go b/vendor/golang.org/x/text/language/match.go similarity index 98% rename from Godeps/_workspace/src/golang.org/x/text/language/match.go rename to vendor/golang.org/x/text/language/match.go index eec72bcc1f..8ad9505339 100644 --- a/Godeps/_workspace/src/golang.org/x/text/language/match.go +++ b/vendor/golang.org/x/text/language/match.go @@ -396,8 +396,8 @@ type matcher struct { // matchHeader has the lists of tags for exact matches and matches based on // maximized and canonicalized tags for a given language. type matchHeader struct { - exact []haveTag - max []haveTag + exact []*haveTag + max []*haveTag } // haveTag holds a supported Tag and its maximized script and region. The maximized @@ -457,7 +457,7 @@ func (h *matchHeader) addIfNew(n haveTag, exact bool) { } } if exact { - h.exact = append(h.exact, n) + h.exact = append(h.exact, &n) } // Allow duplicate maximized tags, but create a linked list to allow quickly // comparing the equivalents and bail out. @@ -472,7 +472,7 @@ func (h *matchHeader) addIfNew(n haveTag, exact bool) { break } } - h.max = append(h.max, n) + h.max = append(h.max, &n) } // header returns the matchHeader for the given language. It creates one if @@ -503,7 +503,7 @@ func newMatcher(supported []Tag) *matcher { pair, _ := makeHaveTag(tag, i) m.header(tag.lang).addIfNew(pair, true) } - m.default_ = &m.header(supported[0].lang).exact[0] + m.default_ = m.header(supported[0].lang).exact[0] for i, tag := range supported { pair, max := makeHaveTag(tag, i) if max != tag.lang { @@ -520,7 +520,8 @@ func newMatcher(supported []Tag) *matcher { return } hw := m.header(langID(want)) - for _, v := range hh.max { + for _, ht := range hh.max { + v := *ht if conf < v.conf { v.conf = conf } @@ -580,7 +581,7 @@ func (m *matcher) getBest(want ...Tag) (got *haveTag, orig Tag, c Confidence) { continue } for i := range h.exact { - have := &h.exact[i] + have := h.exact[i] if have.tag.equalsRest(w) { return have, w, Exact } @@ -591,7 +592,7 @@ func (m *matcher) getBest(want ...Tag) (got *haveTag, orig Tag, c Confidence) { // Base language is not defined. if h != nil { for i := range h.exact { - have := &h.exact[i] + have := h.exact[i] if have.tag.equalsRest(w) { return have, w, Exact } @@ -609,11 +610,11 @@ func (m *matcher) getBest(want ...Tag) (got *haveTag, orig Tag, c Confidence) { } // Check for match based on maximized tag. for i := range h.max { - have := &h.max[i] + have := h.max[i] best.update(have, w, max.script, max.region) if best.conf == Exact { for have.nextMax != 0 { - have = &h.max[have.nextMax] + have = h.max[have.nextMax] best.update(have, w, max.script, max.region) } return best.have, best.want, High diff --git a/Godeps/_workspace/src/golang.org/x/text/language/parse.go b/vendor/golang.org/x/text/language/parse.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/parse.go rename to vendor/golang.org/x/text/language/parse.go diff --git a/vendor/golang.org/x/text/language/tables.go b/vendor/golang.org/x/text/language/tables.go new file mode 100644 index 0000000000..1a92e582b9 --- /dev/null +++ b/vendor/golang.org/x/text/language/tables.go @@ -0,0 +1,3547 @@ +// This file was generated by go generate; DO NOT EDIT + +package language + +import "golang.org/x/text/internal/tag" + +// CLDRVersion is the CLDR version from which the tables in this package are derived. +const CLDRVersion = "30" + +const numLanguages = 8654 + +const numScripts = 230 + +const numRegions = 356 + +type fromTo struct { + from uint16 + to uint16 +} + +const nonCanonicalUnd = 1191 +const ( + _af = 21 + _am = 38 + _ar = 57 + _az = 87 + _bg = 125 + _bn = 163 + _ca = 213 + _cs = 246 + _da = 253 + _de = 265 + _el = 305 + _en = 308 + _es = 313 + _et = 315 + _fa = 323 + _fi = 332 + _fil = 334 + _fr = 345 + _gu = 413 + _he = 437 + _hi = 439 + _hr = 458 + _hu = 462 + _hy = 464 + _id = 474 + _is = 496 + _it = 497 + _ja = 504 + _ka = 520 + _kk = 570 + _km = 578 + _kn = 585 + _ko = 587 + _ky = 641 + _lo = 687 + _lt = 695 + _lv = 702 + _mk = 758 + _ml = 763 + _mn = 770 + _mo = 775 + _mr = 786 + _ms = 790 + _mul = 797 + _my = 808 + _nb = 830 + _ne = 840 + _nl = 862 + _no = 870 + _pa = 916 + _pl = 938 + _pt = 951 + _ro = 979 + _ru = 985 + _sh = 1021 + _si = 1026 + _sk = 1032 + _sl = 1036 + _sq = 1063 + _sr = 1064 + _sv = 1082 + _sw = 1083 + _ta = 1094 + _te = 1111 + _th = 1121 + _tl = 1136 + _tn = 1142 + _tr = 1152 + _uk = 1188 + _ur = 1194 + _uz = 1202 + _vi = 1209 + _zh = 1311 + _zu = 1316 + _jbo = 507 + _ami = 1639 + _bnn = 2346 + _hak = 431 + _tlh = 14456 + _lb = 652 + _nv = 890 + _pwn = 12044 + _tao = 14177 + _tay = 14187 + _tsu = 14651 + _nn = 865 + _sfb = 13618 + _vgt = 15690 + _sgg = 13649 + _cmn = 2996 + _nan = 826 + _hsn = 460 +) + +const langPrivateStart = 0x2f67 + +const langPrivateEnd = 0x316e + +// lang holds an alphabetically sorted list of ISO-639 language identifiers. +// All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag. +// For 2-byte language identifiers, the two successive bytes have the following meaning: +// - if the first letter of the 2- and 3-letter ISO codes are the same: +// the second and third letter of the 3-letter ISO code. +// - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3. +// For 3-byte language identifiers the 4th byte is 0. +var lang tag.Index = "" + // Size: 5280 bytes + "---\x00aaaraai\x00aak\x00aau\x00abbkabi\x00abr\x00abt\x00aby\x00acd\x00a" + + "ce\x00ach\x00ada\x00ade\x00adj\x00ady\x00adz\x00aeveaeb\x00aey\x00affrag" + + "c\x00agd\x00agg\x00agm\x00ago\x00agq\x00aha\x00ahl\x00aho\x00ajg\x00akka" + + "akk\x00ala\x00ali\x00aln\x00alt\x00ammhamm\x00amn\x00amo\x00amp\x00anrga" + + "nc\x00ank\x00ann\x00any\x00aoj\x00aom\x00aoz\x00apc\x00apd\x00ape\x00apr" + + "\x00aps\x00apz\x00arraarc\x00arh\x00arn\x00aro\x00arq\x00ars\x00ary\x00a" + + "rz\x00assmasa\x00ase\x00asg\x00aso\x00ast\x00ata\x00atg\x00atj\x00auy" + + "\x00avvaavl\x00avn\x00avt\x00avu\x00awa\x00awb\x00awo\x00awx\x00ayymayb" + + "\x00azzebaakbal\x00ban\x00bap\x00bar\x00bas\x00bav\x00bax\x00bba\x00bbb" + + "\x00bbc\x00bbd\x00bbj\x00bbp\x00bbr\x00bcf\x00bch\x00bci\x00bcm\x00bcn" + + "\x00bco\x00bcq\x00bcu\x00bdd\x00beelbef\x00beh\x00bej\x00bem\x00bet\x00b" + + "ew\x00bex\x00bez\x00bfd\x00bfq\x00bft\x00bfy\x00bgulbgc\x00bgn\x00bgx" + + "\x00bhihbhb\x00bhg\x00bhi\x00bhk\x00bhl\x00bho\x00bhy\x00biisbib\x00big" + + "\x00bik\x00bim\x00bin\x00bio\x00biq\x00bjh\x00bji\x00bjj\x00bjn\x00bjo" + + "\x00bjr\x00bjz\x00bkc\x00bkm\x00bkq\x00bku\x00bkv\x00blt\x00bmambmh\x00b" + + "mk\x00bmq\x00bmu\x00bnenbng\x00bnm\x00bnp\x00boodboj\x00bom\x00bon\x00bp" + + "y\x00bqc\x00bqi\x00bqp\x00bqv\x00brrebra\x00brh\x00brx\x00brz\x00bsosbsj" + + "\x00bsq\x00bss\x00bst\x00bto\x00btt\x00btv\x00bua\x00buc\x00bud\x00bug" + + "\x00buk\x00bum\x00buo\x00bus\x00buu\x00bvb\x00bwd\x00bwr\x00bxh\x00bye" + + "\x00byn\x00byr\x00bys\x00byv\x00byx\x00bza\x00bze\x00bzf\x00bzh\x00bzw" + + "\x00caatcan\x00cbj\x00cch\x00ccp\x00ceheceb\x00cfa\x00cgg\x00chhachk\x00" + + "chm\x00cho\x00chp\x00chr\x00cja\x00cjm\x00cjv\x00ckb\x00ckl\x00cko\x00ck" + + "y\x00cla\x00cme\x00cooscop\x00cps\x00crrecrj\x00crk\x00crl\x00crm\x00crs" + + "\x00csescsb\x00csw\x00ctd\x00cuhucvhvcyymdaandad\x00daf\x00dag\x00dah" + + "\x00dak\x00dar\x00dav\x00dbd\x00dbq\x00dcc\x00ddn\x00deeuded\x00den\x00d" + + "ga\x00dgh\x00dgi\x00dgl\x00dgr\x00dgz\x00dia\x00dje\x00dnj\x00dob\x00doi" + + "\x00dop\x00dow\x00dri\x00drs\x00dsb\x00dtm\x00dtp\x00dts\x00dty\x00dua" + + "\x00duc\x00dud\x00dug\x00dvivdva\x00dww\x00dyo\x00dyu\x00dzzodzg\x00ebu" + + "\x00eeweefi\x00egl\x00egy\x00eky\x00elllema\x00emi\x00enngenn\x00enq\x00" + + "eopoeri\x00es\x00\x05esu\x00etstetr\x00ett\x00etu\x00etx\x00euusewo\x00e" + + "xt\x00faasfaa\x00fab\x00fag\x00fai\x00fan\x00ffulffi\x00ffm\x00fiinfia" + + "\x00fil\x00fit\x00fjijflr\x00fmp\x00foaofod\x00fon\x00for\x00fpe\x00fqs" + + "\x00frrafrc\x00frp\x00frr\x00frs\x00fub\x00fud\x00fue\x00fuf\x00fuh\x00f" + + "uq\x00fur\x00fuv\x00fuy\x00fvr\x00fyrygalegaa\x00gaf\x00gag\x00gah\x00ga" + + "j\x00gam\x00gan\x00gaw\x00gay\x00gbf\x00gbm\x00gby\x00gbz\x00gcr\x00gdla" + + "gde\x00gdn\x00gdr\x00geb\x00gej\x00gel\x00gez\x00gfk\x00ggn\x00ghs\x00gi" + + "l\x00gim\x00gjk\x00gjn\x00gju\x00gkn\x00gkp\x00gllgglk\x00gmm\x00gmv\x00" + + "gnrngnd\x00gng\x00god\x00gof\x00goi\x00gom\x00gon\x00gor\x00gos\x00got" + + "\x00grc\x00grt\x00grw\x00gsw\x00guujgub\x00guc\x00gud\x00gur\x00guw\x00g" + + "ux\x00guz\x00gvlvgvf\x00gvr\x00gvs\x00gwc\x00gwi\x00gwt\x00gyi\x00haauha" + + "g\x00hak\x00ham\x00haw\x00haz\x00hbb\x00hdy\x00heebhhy\x00hiinhia\x00hif" + + "\x00hig\x00hih\x00hil\x00hla\x00hlu\x00hmd\x00hmt\x00hnd\x00hne\x00hnj" + + "\x00hnn\x00hno\x00homohoc\x00hoj\x00hot\x00hrrvhsb\x00hsn\x00htathuunhui" + + "\x00hyyehzerianaian\x00iar\x00iba\x00ibb\x00iby\x00ica\x00ich\x00idndidd" + + "\x00idi\x00idu\x00ieleigboigb\x00ige\x00iiiiijj\x00ikpkikk\x00ikt\x00ikw" + + "\x00ikx\x00ilo\x00imo\x00inndinh\x00iodoiou\x00iri\x00isslittaiukuiw\x00" + + "\x03iwm\x00iws\x00izh\x00izi\x00japnjab\x00jam\x00jbo\x00jbu\x00jen\x00j" + + "gk\x00jgo\x00ji\x00\x06jib\x00jmc\x00jml\x00jra\x00jut\x00jvavjwavkaatka" + + "a\x00kab\x00kac\x00kad\x00kai\x00kaj\x00kam\x00kao\x00kbd\x00kbm\x00kbp" + + "\x00kbq\x00kbx\x00kby\x00kcg\x00kck\x00kcl\x00kct\x00kde\x00kdh\x00kdl" + + "\x00kdt\x00kea\x00ken\x00kez\x00kfo\x00kfr\x00kfy\x00kgonkge\x00kgf\x00k" + + "gp\x00kha\x00khb\x00khn\x00khq\x00khs\x00kht\x00khw\x00khz\x00kiikkij" + + "\x00kiu\x00kiw\x00kjuakjd\x00kjg\x00kjs\x00kjy\x00kkazkkc\x00kkj\x00klal" + + "kln\x00klq\x00klt\x00klx\x00kmhmkmb\x00kmh\x00kmo\x00kms\x00kmu\x00kmw" + + "\x00knanknp\x00koorkoi\x00kok\x00kol\x00kos\x00koz\x00kpe\x00kpf\x00kpo" + + "\x00kpr\x00kpx\x00kqb\x00kqf\x00kqs\x00kqy\x00kraukrc\x00kri\x00krj\x00k" + + "rl\x00krs\x00kru\x00ksasksb\x00ksd\x00ksf\x00ksh\x00ksj\x00ksr\x00ktb" + + "\x00ktm\x00kto\x00kuurkub\x00kud\x00kue\x00kuj\x00kum\x00kun\x00kup\x00k" + + "us\x00kvomkvg\x00kvr\x00kvx\x00kw\x00\x01kwj\x00kwo\x00kxa\x00kxc\x00kxm" + + "\x00kxp\x00kxw\x00kxz\x00kyirkye\x00kyx\x00kzr\x00laatlab\x00lad\x00lag" + + "\x00lah\x00laj\x00las\x00lbtzlbe\x00lbu\x00lbw\x00lcm\x00lcp\x00ldb\x00l" + + "ed\x00lee\x00lem\x00lep\x00leq\x00leu\x00lez\x00lguglgg\x00liimlia\x00li" + + "d\x00lif\x00lig\x00lih\x00lij\x00lis\x00ljp\x00lki\x00lkt\x00lle\x00lln" + + "\x00lmn\x00lmo\x00lmp\x00lninlns\x00lnu\x00loaoloj\x00lok\x00lol\x00lor" + + "\x00los\x00loz\x00lrc\x00ltitltg\x00luublua\x00luo\x00luy\x00luz\x00lvav" + + "lwl\x00lzh\x00lzz\x00mad\x00maf\x00mag\x00mai\x00mak\x00man\x00mas\x00ma" + + "w\x00maz\x00mbh\x00mbo\x00mbq\x00mbu\x00mbw\x00mci\x00mcp\x00mcq\x00mcr" + + "\x00mcu\x00mda\x00mde\x00mdf\x00mdh\x00mdj\x00mdr\x00mdx\x00med\x00mee" + + "\x00mek\x00men\x00mer\x00met\x00meu\x00mfa\x00mfe\x00mfn\x00mfo\x00mfq" + + "\x00mglgmgh\x00mgl\x00mgo\x00mgp\x00mgy\x00mhahmhi\x00mhl\x00mirimif\x00" + + "min\x00mis\x00miw\x00mkkdmki\x00mkl\x00mkp\x00mkw\x00mlalmle\x00mlp\x00m" + + "ls\x00mmo\x00mmu\x00mmx\x00mnonmna\x00mnf\x00mni\x00mnw\x00moolmoa\x00mo" + + "e\x00moh\x00mos\x00mox\x00mpp\x00mps\x00mpt\x00mpx\x00mql\x00mrarmrd\x00" + + "mrj\x00mro\x00mssamtltmtc\x00mtf\x00mti\x00mtr\x00mua\x00mul\x00mur\x00m" + + "us\x00mva\x00mvn\x00mvy\x00mwk\x00mwr\x00mwv\x00mxc\x00mxm\x00myyamyk" + + "\x00mym\x00myv\x00myw\x00myx\x00myz\x00mzk\x00mzm\x00mzn\x00mzp\x00mzw" + + "\x00mzz\x00naaunac\x00naf\x00nah\x00nak\x00nan\x00nap\x00naq\x00nas\x00n" + + "bobnca\x00nce\x00ncf\x00nch\x00nco\x00ncu\x00nddendc\x00nds\x00neepneb" + + "\x00new\x00nex\x00nfr\x00ngdonga\x00ngb\x00ngl\x00nhb\x00nhe\x00nhw\x00n" + + "if\x00nii\x00nij\x00nin\x00niu\x00niy\x00niz\x00njo\x00nkg\x00nko\x00nll" + + "dnmg\x00nmz\x00nnnonnf\x00nnh\x00nnk\x00nnm\x00noornod\x00noe\x00non\x00" + + "nop\x00nou\x00nqo\x00nrblnrb\x00nsk\x00nsn\x00nso\x00nss\x00ntm\x00ntr" + + "\x00nui\x00nup\x00nus\x00nuv\x00nux\x00nvavnwb\x00nxq\x00nxr\x00nyyanym" + + "\x00nyn\x00nzi\x00occiogc\x00ojjiokr\x00okv\x00omrmong\x00onn\x00ons\x00" + + "opm\x00orrioro\x00oru\x00osssosa\x00ota\x00otk\x00ozm\x00paanpag\x00pal" + + "\x00pam\x00pap\x00pau\x00pbi\x00pcd\x00pcm\x00pdc\x00pdt\x00ped\x00peo" + + "\x00pex\x00pfl\x00phl\x00phn\x00pilipil\x00pip\x00pka\x00pko\x00plolpla" + + "\x00pms\x00png\x00pnn\x00pnt\x00pon\x00ppo\x00pra\x00prd\x00prg\x00psusp" + + "ss\x00ptorptp\x00puu\x00pwa\x00quuequc\x00qug\x00rai\x00raj\x00rao\x00rc" + + "f\x00rej\x00rel\x00res\x00rgn\x00rhg\x00ria\x00rif\x00rjs\x00rkt\x00rmoh" + + "rmf\x00rmo\x00rmt\x00rmu\x00rnunrna\x00rng\x00roonrob\x00rof\x00roo\x00r" + + "ro\x00rtm\x00ruusrue\x00rug\x00rw\x00\x04rwk\x00rwo\x00ryu\x00saansaf" + + "\x00sah\x00saq\x00sas\x00sat\x00saz\x00sba\x00sbe\x00sbp\x00scrdsck\x00s" + + "cl\x00scn\x00sco\x00scs\x00sdndsdc\x00sdh\x00semesef\x00seh\x00sei\x00se" + + "s\x00sgagsga\x00sgs\x00sgw\x00sgz\x00sh\x00\x02shi\x00shk\x00shn\x00shu" + + "\x00siinsid\x00sig\x00sil\x00sim\x00sjr\x00sklkskc\x00skr\x00sks\x00sllv" + + "sld\x00sli\x00sll\x00sly\x00smmosma\x00smi\x00smj\x00smn\x00smp\x00smq" + + "\x00sms\x00snnasnc\x00snk\x00snp\x00snx\x00sny\x00soomsok\x00soq\x00sou" + + "\x00soy\x00spd\x00spl\x00sps\x00sqqisrrpsrb\x00srn\x00srr\x00srx\x00sssw" + + "ssd\x00ssg\x00ssy\x00stotstk\x00stq\x00suunsua\x00sue\x00suk\x00sur\x00s" + + "us\x00svweswwaswb\x00swc\x00swg\x00swp\x00swv\x00sxn\x00sxw\x00syl\x00sy" + + "r\x00szl\x00taamtaj\x00tal\x00tan\x00taq\x00tbc\x00tbd\x00tbf\x00tbg\x00" + + "tbo\x00tbw\x00tbz\x00tci\x00tcy\x00tdd\x00tdg\x00tdh\x00teelted\x00tem" + + "\x00teo\x00tet\x00tfi\x00tggktgc\x00tgo\x00tgu\x00thhathl\x00thq\x00thr" + + "\x00tiirtif\x00tig\x00tik\x00tim\x00tio\x00tiv\x00tkuktkl\x00tkr\x00tkt" + + "\x00tlgltlf\x00tlx\x00tly\x00tmh\x00tmy\x00tnsntnh\x00toontof\x00tog\x00" + + "toq\x00tpi\x00tpm\x00tpz\x00tqo\x00trurtru\x00trv\x00trw\x00tssotsd\x00t" + + "sf\x00tsg\x00tsj\x00tsw\x00ttatttd\x00tte\x00ttj\x00ttr\x00tts\x00ttt" + + "\x00tuh\x00tul\x00tum\x00tuq\x00tvd\x00tvl\x00tvu\x00twwitwh\x00twq\x00t" + + "xg\x00tyahtya\x00tyv\x00tzm\x00ubu\x00udm\x00ugiguga\x00ukkruli\x00umb" + + "\x00und\x00unr\x00unx\x00urrduri\x00urt\x00urw\x00usa\x00utr\x00uvh\x00u" + + "vl\x00uzzbvag\x00vai\x00van\x00veenvec\x00vep\x00viievic\x00viv\x00vls" + + "\x00vmf\x00vmw\x00voolvot\x00vro\x00vun\x00vut\x00walnwae\x00waj\x00wal" + + "\x00wan\x00war\x00wbp\x00wbq\x00wbr\x00wci\x00wer\x00wgi\x00whg\x00wib" + + "\x00wiu\x00wiv\x00wja\x00wji\x00wls\x00wmo\x00wnc\x00wni\x00wnu\x00woolw" + + "ob\x00wos\x00wrs\x00wsk\x00wtm\x00wuu\x00wuv\x00wwa\x00xav\x00xbi\x00xcr" + + "\x00xes\x00xhhoxla\x00xlc\x00xld\x00xmf\x00xmn\x00xmr\x00xna\x00xnr\x00x" + + "og\x00xon\x00xpr\x00xrb\x00xsa\x00xsi\x00xsm\x00xsr\x00xwe\x00yam\x00yao" + + "\x00yap\x00yas\x00yat\x00yav\x00yay\x00yaz\x00yba\x00ybb\x00yby\x00yer" + + "\x00ygr\x00ygw\x00yiidyko\x00yle\x00ylg\x00yll\x00yml\x00yooryon\x00yrb" + + "\x00yre\x00yrl\x00yss\x00yua\x00yue\x00yuj\x00yut\x00yuw\x00zahazag\x00z" + + "bl\x00zdj\x00zea\x00zgh\x00zhhozia\x00zlm\x00zmi\x00zne\x00zuulzxx\x00zz" + + "a\x00\xff\xff\xff\xff" + +const langNoIndexOffset = 1319 + +// langNoIndex is a bit vector of all 3-letter language codes that are not used as an index +// in lookup tables. The language ids for these language codes are derived directly +// from the letters and are not consecutive. +// Size: 2197 bytes, 2197 elements +var langNoIndex = [2197]uint8{ + // Entry 0 - 3F + 0xff, 0xf8, 0xed, 0xfe, 0xeb, 0xd7, 0x3b, 0xd2, + 0xfb, 0xbf, 0x7a, 0xfa, 0x37, 0x1d, 0x3c, 0x57, + 0x6e, 0x97, 0x73, 0x38, 0xfb, 0xea, 0xbf, 0x70, + 0xad, 0x03, 0xff, 0xff, 0xcf, 0x05, 0x84, 0x62, + 0xe9, 0xbf, 0xfd, 0xbf, 0xbf, 0xf7, 0xfd, 0x77, + 0x0f, 0xff, 0xef, 0x6f, 0xff, 0xfb, 0xdf, 0xe2, + 0xc9, 0xf8, 0x7f, 0x7e, 0x4d, 0xb8, 0x0a, 0x6a, + 0x7c, 0xea, 0xe3, 0xfa, 0x7a, 0xbf, 0x67, 0xff, + // Entry 40 - 7F + 0xff, 0xff, 0xff, 0xdf, 0x2a, 0x54, 0x91, 0xc0, + 0x5d, 0xe3, 0x97, 0x14, 0x07, 0x20, 0xdd, 0xed, + 0x9f, 0x3f, 0xc9, 0x21, 0xf8, 0x3f, 0x94, 0x35, + 0x7c, 0x5f, 0xff, 0x5f, 0x8e, 0x6e, 0xdf, 0xff, + 0xff, 0xff, 0x55, 0x7c, 0xd3, 0xfd, 0xbf, 0xb5, + 0x7b, 0xdf, 0x7f, 0xf7, 0xca, 0xfe, 0xdb, 0xa3, + 0xa8, 0xff, 0x1f, 0x67, 0x7f, 0xeb, 0xef, 0xce, + 0xff, 0xff, 0x9f, 0xff, 0xb7, 0xef, 0xfe, 0xcf, + // Entry 80 - BF + 0xdb, 0xff, 0xf3, 0xcd, 0xfb, 0x2f, 0xff, 0xff, + 0xbb, 0xee, 0xf7, 0xbd, 0xdb, 0xff, 0x5f, 0xf7, + 0xfd, 0xf2, 0xfd, 0xff, 0x5e, 0x2f, 0x3b, 0xba, + 0x7e, 0xff, 0xff, 0xfe, 0xf7, 0xff, 0xdd, 0xff, + 0xfd, 0xdf, 0xfb, 0xfe, 0x9d, 0xb4, 0xd3, 0xff, + 0xef, 0xff, 0xdf, 0xf7, 0x7f, 0xb7, 0xfd, 0xd5, + 0xa5, 0x77, 0x40, 0xff, 0x9c, 0xc1, 0x41, 0x2c, + 0x08, 0x20, 0x41, 0x00, 0x50, 0x40, 0x00, 0x80, + // Entry C0 - FF + 0xfb, 0x4a, 0xf2, 0x9f, 0xb4, 0x42, 0x41, 0x96, + 0x1b, 0x14, 0x08, 0xf2, 0x2b, 0xe7, 0x17, 0x56, + 0x45, 0x7d, 0x0e, 0x1c, 0x37, 0x71, 0xf3, 0xef, + 0x97, 0xff, 0x5d, 0x38, 0x64, 0x08, 0x00, 0x10, + 0xbc, 0x87, 0xaf, 0xdf, 0xff, 0xf7, 0x73, 0x35, + 0x3e, 0x87, 0xc7, 0xdf, 0xff, 0x00, 0x81, 0x00, + 0xb0, 0x05, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x40, 0x00, 0x40, 0x92, 0x21, 0x50, 0xb1, 0x5d, + // Entry 100 - 13F + 0xfd, 0xdc, 0xbe, 0x5e, 0x00, 0x00, 0x02, 0x64, + 0x0d, 0x19, 0x41, 0xdf, 0x79, 0x22, 0x00, 0x00, + 0x00, 0x5e, 0x64, 0xdc, 0x24, 0xe5, 0xd9, 0xe3, + 0xfe, 0xff, 0xfd, 0xcb, 0x9f, 0x14, 0x01, 0x0c, + 0x86, 0x00, 0xd1, 0x00, 0xf0, 0xc5, 0x67, 0x5f, + 0x56, 0x89, 0x5e, 0xb5, 0x6c, 0xaf, 0x03, 0x00, + 0x02, 0x00, 0x00, 0x00, 0xc0, 0x37, 0xda, 0x56, + 0x90, 0x69, 0x01, 0x2c, 0x96, 0x69, 0x20, 0xfb, + // Entry 140 - 17F + 0xff, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x08, 0x16, + 0x01, 0x00, 0x00, 0xb0, 0x14, 0x03, 0x50, 0x06, + 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x09, + 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x44, 0x00, 0x00, 0x10, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x04, 0x00, 0x80, 0x28, 0x04, + 0x00, 0x00, 0x50, 0xd5, 0x2d, 0x00, 0x64, 0x35, + 0x24, 0x52, 0xf4, 0xd4, 0xbd, 0x62, 0xc9, 0x03, + // Entry 180 - 1BF + 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x13, 0x39, 0x01, 0xdd, 0x57, 0x98, + 0x21, 0x18, 0x81, 0x00, 0x00, 0x01, 0x40, 0x82, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x40, 0x00, 0x44, 0x00, 0x00, 0x80, 0xea, + 0xa9, 0x39, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + // Entry 1C0 - 1FF + 0x00, 0x01, 0x28, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x20, 0x04, 0xa6, 0x00, 0x04, 0x00, 0x00, + 0x81, 0x50, 0x00, 0x00, 0x00, 0x11, 0x84, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x55, + 0x02, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x40, + 0x30, 0x83, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1e, 0xcd, 0xbf, 0x7e, 0xbf, + // Entry 200 - 23F + 0xdf, 0xc3, 0x83, 0x82, 0xc0, 0xfb, 0x57, 0x27, + 0xcd, 0x55, 0xe7, 0x01, 0x00, 0x20, 0xb2, 0xc5, + 0xa4, 0x45, 0x25, 0x9b, 0x02, 0xcf, 0xe0, 0xdf, + 0x03, 0x44, 0x08, 0x10, 0x01, 0x04, 0x01, 0xe3, + 0x92, 0x54, 0xdb, 0x28, 0xd1, 0x5f, 0xf6, 0x6d, + 0x79, 0xed, 0x1c, 0x7d, 0x04, 0x08, 0x00, 0x01, + 0x21, 0x12, 0x6c, 0x5f, 0xdd, 0x0e, 0x85, 0x4f, + 0x40, 0x40, 0x00, 0x04, 0xf1, 0xfd, 0x3d, 0x54, + // Entry 240 - 27F + 0xe8, 0x03, 0xb4, 0x27, 0x23, 0x0d, 0x00, 0x00, + 0x20, 0x7b, 0x38, 0x02, 0x05, 0x84, 0x00, 0xf0, + 0xbb, 0x7e, 0x5a, 0x00, 0x18, 0x04, 0x81, 0x00, + 0x00, 0x00, 0x80, 0x10, 0x90, 0x1c, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x04, + 0x08, 0xa0, 0x70, 0xa5, 0x0c, 0x40, 0x00, 0x00, + 0x11, 0x04, 0x04, 0x68, 0x00, 0x20, 0x70, 0xff, + 0x7b, 0x7f, 0x60, 0x00, 0x05, 0x9b, 0xdd, 0x66, + // Entry 280 - 2BF + 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x40, 0x05, + 0xb5, 0xb6, 0x80, 0x08, 0x04, 0x00, 0x04, 0x51, + 0xe2, 0xef, 0xfd, 0x3f, 0x05, 0x09, 0x08, 0x05, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x60, + 0xe5, 0x48, 0x00, 0x81, 0x20, 0xc0, 0x05, 0x80, + 0x03, 0x00, 0x00, 0x00, 0xcc, 0x50, 0x40, 0x04, + 0x84, 0x47, 0x84, 0x40, 0x20, 0x10, 0x00, 0x20, + // Entry 2C0 - 2FF + 0x02, 0x50, 0x80, 0x11, 0x00, 0x91, 0x6c, 0xe2, + 0x50, 0x27, 0x1d, 0x11, 0x29, 0x06, 0x59, 0xe9, + 0x33, 0x08, 0x00, 0x20, 0x04, 0x40, 0x10, 0x00, + 0x00, 0x00, 0x50, 0x44, 0x92, 0x49, 0xd6, 0x5d, + 0xa7, 0x81, 0x47, 0x97, 0xfb, 0x00, 0x10, 0x00, + 0x08, 0x00, 0x80, 0x00, 0x40, 0x04, 0x00, 0x01, + 0x02, 0x00, 0x01, 0x40, 0x80, 0x00, 0x00, 0x08, + 0xd8, 0xeb, 0xf6, 0x39, 0xc4, 0x89, 0x12, 0x00, + // Entry 300 - 33F + 0x00, 0x0c, 0x04, 0x01, 0x20, 0x20, 0xdd, 0xa0, + 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x04, 0x10, 0xd0, 0x9d, 0x95, 0x13, 0x04, 0x80, + 0x00, 0x01, 0xd0, 0x12, 0x40, 0x00, 0x10, 0xb0, + 0x10, 0x62, 0x4c, 0xd2, 0x02, 0x01, 0x4a, 0x00, + 0x46, 0x04, 0x00, 0x08, 0x02, 0x00, 0x20, 0x80, + 0x00, 0x80, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0xd8, 0x6f, 0x15, 0x02, 0x08, 0x00, + // Entry 340 - 37F + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, + 0x00, 0x10, 0x00, 0x00, 0x00, 0xf0, 0x84, 0xe3, + 0xdd, 0xbf, 0xf9, 0xf9, 0x3b, 0x7f, 0x7f, 0xdb, + 0xfd, 0xfc, 0xfe, 0xdf, 0xff, 0xfd, 0xff, 0xf6, + 0xfb, 0xfc, 0xf7, 0x1f, 0xff, 0xb3, 0x6c, 0xff, + 0xd9, 0xad, 0xdf, 0xfe, 0xef, 0xba, 0xdf, 0xff, + 0xff, 0xff, 0xb7, 0xdd, 0x7d, 0xbf, 0xab, 0xff, + 0xfd, 0xfd, 0xdf, 0x2f, 0x9c, 0xdf, 0xf3, 0x6f, + // Entry 380 - 3BF + 0xdf, 0xdd, 0xff, 0xfb, 0xee, 0xd2, 0xab, 0x5f, + 0xd5, 0xdf, 0x7f, 0xff, 0xeb, 0xff, 0xe4, 0x4d, + 0xf9, 0xff, 0xfe, 0xf7, 0xfd, 0xdf, 0xfb, 0xbf, + 0xee, 0xdb, 0x6f, 0xef, 0xff, 0x7f, 0xff, 0xff, + 0xf7, 0x5f, 0xd3, 0x3b, 0xfd, 0xd9, 0xdf, 0xeb, + 0xbc, 0x08, 0x05, 0x24, 0xff, 0x07, 0x70, 0xfe, + 0xe6, 0x5e, 0x00, 0x08, 0x00, 0x83, 0x3d, 0x1b, + 0x06, 0xe6, 0x72, 0x60, 0xd1, 0x3c, 0x7f, 0x44, + // Entry 3C0 - 3FF + 0x02, 0x30, 0x9f, 0x7a, 0x16, 0xbd, 0x7f, 0x57, + 0xf2, 0xff, 0x31, 0xff, 0xf2, 0x1e, 0x90, 0xf7, + 0xf1, 0xf9, 0x45, 0x80, 0x01, 0x02, 0x00, 0x00, + 0x40, 0x54, 0x9f, 0x8a, 0xd9, 0xd9, 0x0e, 0x11, + 0x84, 0x51, 0xc0, 0xf3, 0xfb, 0x47, 0x00, 0x01, + 0x05, 0xd1, 0x50, 0x58, 0x00, 0x00, 0x00, 0x10, + 0x04, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x17, 0xd2, + 0xb9, 0xfd, 0xfc, 0xba, 0xfe, 0xef, 0xc7, 0xbe, + // Entry 400 - 43F + 0x53, 0x6f, 0xdf, 0xe7, 0xdb, 0x65, 0xbb, 0x7f, + 0xfa, 0xff, 0x77, 0xf3, 0xef, 0xbf, 0xfd, 0xf7, + 0xdf, 0xdf, 0x9b, 0x7f, 0xff, 0xff, 0x7f, 0x6f, + 0xf7, 0xfb, 0xeb, 0xdf, 0xbc, 0xff, 0xbf, 0x6b, + 0x7b, 0xfb, 0xff, 0xce, 0x76, 0xbd, 0xf7, 0xf7, + 0xdf, 0xdc, 0xf7, 0xf7, 0xff, 0xdf, 0xf3, 0xfe, + 0xef, 0xff, 0xff, 0xff, 0xb6, 0x7f, 0x7f, 0xde, + 0xf7, 0xb9, 0xeb, 0x77, 0xff, 0xfb, 0xbf, 0xdf, + // Entry 440 - 47F + 0xfd, 0xfe, 0xfb, 0xff, 0xfe, 0xeb, 0x1f, 0x7d, + 0x2f, 0xfd, 0xb6, 0xb5, 0xa5, 0xfc, 0xff, 0xfd, + 0x7f, 0x4e, 0xbf, 0x8e, 0xae, 0xff, 0xee, 0xdf, + 0x7f, 0xf7, 0x73, 0x02, 0x02, 0x04, 0xfc, 0xf7, + 0xff, 0xb7, 0xd7, 0xef, 0xfe, 0xcd, 0xf5, 0xce, + 0xe2, 0x8e, 0xe7, 0xbf, 0xb7, 0xff, 0x56, 0xbd, + 0xcd, 0xff, 0xfb, 0xff, 0xdf, 0xd7, 0xea, 0xff, + 0xe5, 0x5f, 0x6d, 0x0f, 0xa7, 0x51, 0x04, 0x44, + // Entry 480 - 4BF + 0x13, 0x50, 0x5d, 0xaf, 0xa6, 0xfd, 0x99, 0xfb, + 0x63, 0x1d, 0x53, 0xff, 0xef, 0xb7, 0x35, 0x20, + 0x14, 0x00, 0x55, 0x51, 0x82, 0x65, 0xf5, 0x41, + 0xe2, 0xff, 0xfc, 0xdf, 0x00, 0x05, 0xc5, 0x05, + 0x00, 0x22, 0x00, 0x74, 0x69, 0x10, 0x08, 0x04, + 0x41, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x51, 0x20, 0x05, 0x04, 0x01, 0x00, 0x00, + 0x06, 0x01, 0x20, 0x00, 0x18, 0x01, 0x92, 0xb1, + // Entry 4C0 - 4FF + 0xfd, 0x47, 0x49, 0x06, 0x95, 0x06, 0x57, 0xed, + 0xfb, 0x4c, 0x1c, 0x6b, 0x83, 0x04, 0x62, 0x40, + 0x00, 0x11, 0x42, 0x00, 0x00, 0x00, 0x54, 0x83, + 0xb8, 0x4f, 0x10, 0x8c, 0x89, 0x46, 0xde, 0xf7, + 0x13, 0x31, 0x00, 0x20, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x00, + 0x01, 0x00, 0x00, 0xf0, 0x5b, 0xf4, 0xbe, 0x3d, + 0xba, 0xcf, 0xf7, 0xaf, 0x42, 0x04, 0x84, 0x41, + // Entry 500 - 53F + 0x30, 0xff, 0x79, 0x72, 0x04, 0x00, 0x00, 0x49, + 0x2d, 0x14, 0x27, 0x57, 0xed, 0xf1, 0x3f, 0xe7, + 0x3f, 0x00, 0x00, 0x02, 0xc6, 0xa0, 0x1e, 0xf8, + 0xbb, 0xff, 0xfd, 0xfb, 0xb7, 0xfd, 0xe5, 0xf7, + 0xfd, 0xfc, 0xd5, 0xed, 0x47, 0xf4, 0x7e, 0x10, + 0x01, 0x01, 0x84, 0x6d, 0xff, 0xf7, 0xdd, 0xf9, + 0x5b, 0x05, 0x86, 0xed, 0xf5, 0x77, 0xbd, 0x3c, + 0x00, 0x00, 0x00, 0x42, 0x71, 0x42, 0x00, 0x40, + // Entry 540 - 57F + 0x00, 0x00, 0x01, 0x43, 0x19, 0x00, 0x08, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + // Entry 580 - 5BF + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xab, 0xbd, 0xe7, 0x57, 0xee, 0x13, 0x5d, + 0x09, 0xc1, 0x40, 0x21, 0xfa, 0x17, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0xce, 0xfb, 0xbf, + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x30, 0x15, 0xa3, 0x10, 0x00, 0x00, 0x00, + 0x11, 0x04, 0x16, 0x00, 0x00, 0x02, 0x00, 0x81, + 0xa3, 0x01, 0x50, 0x00, 0x00, 0x83, 0x11, 0x40, + // Entry 5C0 - 5FF + 0x00, 0x00, 0x00, 0xf0, 0xdd, 0x7b, 0x3e, 0x02, + 0xaa, 0x10, 0x5d, 0x98, 0x52, 0x00, 0x80, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x02, + 0x19, 0x00, 0x10, 0x02, 0x10, 0x61, 0x5a, 0x9d, + 0x31, 0x00, 0x00, 0x00, 0x01, 0x10, 0x02, 0x20, + 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x20, 0x00, + 0x00, 0x1f, 0xdf, 0xf2, 0xb9, 0xff, 0xfd, 0x3f, + 0x1f, 0x18, 0xcf, 0x9c, 0xbf, 0xaf, 0x5f, 0xfe, + // Entry 600 - 63F + 0x7b, 0x4b, 0x40, 0x10, 0xe1, 0xfd, 0xaf, 0xd9, + 0xb7, 0xf6, 0xfb, 0xb3, 0xc7, 0xff, 0x6f, 0xf1, + 0x73, 0xb1, 0x7f, 0x9f, 0x7f, 0xbd, 0xfc, 0xb7, + 0xee, 0x1c, 0xfa, 0xcb, 0xef, 0xdd, 0xf9, 0xbd, + 0x6e, 0xae, 0x55, 0xfd, 0x6e, 0x81, 0x76, 0x1f, + 0xd4, 0x77, 0xf5, 0x7d, 0xfb, 0xff, 0xeb, 0xfe, + 0xbe, 0x5f, 0x46, 0x1b, 0xe9, 0x5f, 0x50, 0x18, + 0x02, 0xfa, 0xf7, 0x9d, 0x15, 0x97, 0x05, 0x0f, + // Entry 640 - 67F + 0x75, 0xc4, 0x7d, 0x81, 0x82, 0xf1, 0x57, 0x6c, + 0xff, 0xe4, 0xef, 0x6f, 0xff, 0xfc, 0xdd, 0xde, + 0xfc, 0xfd, 0x76, 0x5f, 0x7a, 0x1f, 0x00, 0x98, + 0x02, 0xfb, 0xa3, 0xef, 0xf3, 0xd6, 0xf2, 0xff, + 0xb9, 0xda, 0x7d, 0x50, 0x1e, 0x15, 0x7b, 0xb4, + 0xf5, 0x3e, 0xff, 0xff, 0xf1, 0xf7, 0xff, 0xe7, + 0x5f, 0xff, 0xff, 0x9e, 0xdb, 0xf6, 0xd7, 0xb9, + 0xef, 0x27, 0x80, 0xbb, 0xc5, 0xff, 0xff, 0xe3, + // Entry 680 - 6BF + 0x97, 0x9d, 0xbf, 0x9f, 0xf7, 0xc7, 0xfd, 0x37, + 0xce, 0x7f, 0x04, 0x1d, 0x53, 0x7f, 0xf8, 0xda, + 0x5d, 0xce, 0x7d, 0x06, 0xb9, 0xea, 0x69, 0xa0, + 0x1a, 0x20, 0x00, 0x30, 0x02, 0x04, 0x24, 0x08, + 0x04, 0x00, 0x00, 0x40, 0xd4, 0x02, 0x04, 0x00, + 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x01, 0x06, + 0x50, 0x00, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00, + 0x04, 0x00, 0x10, 0x8c, 0x58, 0xd5, 0x0d, 0x0f, + // Entry 6C0 - 6FF + 0x14, 0x4d, 0xf1, 0x16, 0x44, 0xd1, 0x42, 0x08, + 0x40, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00, + 0x00, 0xdc, 0xfb, 0xcb, 0x0e, 0x58, 0x08, 0x41, + 0x04, 0x20, 0x04, 0x00, 0x30, 0x12, 0x40, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x80, 0x10, 0x10, 0xab, + 0x6d, 0x93, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x80, 0x25, 0x00, 0x00, + // Entry 700 - 73F + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x80, 0x86, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x01, + 0xdf, 0x18, 0x00, 0x00, 0x02, 0xf0, 0xfd, 0x79, + 0x3b, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x03, 0x00, 0x09, 0x20, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 740 - 77F + 0x00, 0x00, 0x00, 0xef, 0xd5, 0xfd, 0xcf, 0x7e, + 0xa0, 0x11, 0x00, 0x00, 0x00, 0x92, 0x01, 0x44, + 0xcd, 0xf9, 0x5c, 0x00, 0x01, 0x00, 0x30, 0x04, + 0x04, 0x55, 0x00, 0x01, 0x04, 0xf4, 0x3f, 0x4a, + 0x01, 0x00, 0x00, 0xb0, 0x80, 0x00, 0x55, 0x55, + 0x97, 0x7c, 0x9f, 0x31, 0xcc, 0x68, 0xd1, 0x03, + 0xd5, 0x57, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x2c, 0xf7, 0xcb, 0x1f, 0x14, 0x60, + // Entry 780 - 7BF + 0x03, 0x68, 0x01, 0x10, 0x8b, 0x38, 0x8a, 0x01, + 0x00, 0x00, 0x20, 0x00, 0x24, 0x44, 0x00, 0x00, + 0x10, 0x03, 0x11, 0x02, 0x01, 0x00, 0x00, 0xf0, + 0xf5, 0xff, 0xd5, 0x97, 0xbc, 0x70, 0xd6, 0x78, + 0x78, 0x15, 0x50, 0x00, 0xa4, 0x84, 0xa9, 0x41, + 0x00, 0x00, 0x00, 0x6b, 0x39, 0x52, 0x74, 0x00, + 0xe8, 0x30, 0x90, 0x6a, 0x92, 0x00, 0x00, 0x02, + 0xff, 0xef, 0xff, 0x4b, 0x85, 0x53, 0xf4, 0xed, + // Entry 7C0 - 7FF + 0xdd, 0xbf, 0x72, 0x19, 0xc7, 0x0c, 0xd5, 0x42, + 0x54, 0xdd, 0x77, 0x14, 0x00, 0x80, 0x40, 0x56, + 0xcc, 0x16, 0x9e, 0xea, 0x35, 0x7d, 0xef, 0xff, + 0xbd, 0xa4, 0xaf, 0x01, 0x44, 0x18, 0x01, 0x4d, + 0x4e, 0x4a, 0x08, 0x50, 0x28, 0x30, 0xe0, 0x80, + 0x10, 0x20, 0x24, 0x00, 0xff, 0x2f, 0xd3, 0x60, + 0xfe, 0x01, 0x02, 0x88, 0x0a, 0x40, 0x16, 0x01, + 0x01, 0x15, 0x2b, 0x3c, 0x01, 0x00, 0x00, 0x10, + // Entry 800 - 83F + 0x90, 0x49, 0x41, 0x02, 0x02, 0x01, 0xe1, 0xbf, + 0xbf, 0x03, 0x00, 0x00, 0x10, 0xd4, 0xa3, 0xd1, + 0x40, 0x9c, 0x44, 0xdf, 0xf5, 0x8f, 0x66, 0xb3, + 0x55, 0x20, 0xd4, 0xc1, 0xd8, 0x30, 0x3d, 0x80, + 0x00, 0x00, 0x00, 0x04, 0xd4, 0x11, 0xc5, 0x84, + 0x2e, 0x50, 0x00, 0x22, 0x50, 0x6e, 0xbd, 0x93, + 0x07, 0x00, 0x20, 0x10, 0x84, 0xb2, 0x45, 0x10, + 0x06, 0x44, 0x00, 0x00, 0x12, 0x02, 0x11, 0x00, + // Entry 840 - 87F + 0xf0, 0xfb, 0xfd, 0x3f, 0x05, 0x00, 0x12, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x02, 0x28, + 0x84, 0x00, 0x23, 0xc0, 0x23, 0x24, 0x00, 0x00, + 0x00, 0xcb, 0xe4, 0x3a, 0x42, 0x88, 0x14, 0xf1, + 0xef, 0xff, 0x7f, 0x12, 0x01, 0x01, 0x84, 0x50, + 0x07, 0xfc, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x40, + 0x10, 0x38, 0x01, 0x01, 0x1c, 0x12, 0x40, 0xe1, + // Entry 880 - 8BF + 0x76, 0x16, 0x08, 0x03, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x24, + 0x0a, 0x00, 0x80, 0x00, 0x00, +} + +// altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives +// to 2-letter language codes that cannot be derived using the method described above. +// Each 3-letter code is followed by its 1-byte langID. +var altLangISO3 tag.Index = "---\x00cor\x00hbs\x01heb\x02kin\x03spa\x04yid\x05\xff\xff\xff\xff" + +// altLangIndex is used to convert indexes in altLangISO3 to langIDs. +// Size: 12 bytes, 6 elements +var altLangIndex = [6]uint16{ + 0x0278, 0x03fd, 0x01f3, 0x03dc, 0x0139, 0x0200, +} + +// langAliasMap maps langIDs to their suggested replacements. +// Size: 644 bytes, 161 elements +var langAliasMap = [161]fromTo{ + 0: {from: 0x81, to: 0x87}, + 1: {from: 0x181, to: 0x1a7}, + 2: {from: 0x1eb, to: 0x1da}, + 3: {from: 0x1f3, to: 0x1b5}, + 4: {from: 0x200, to: 0x508}, + 5: {from: 0x207, to: 0x206}, + 6: {from: 0x307, to: 0x3d3}, + 7: {from: 0x33e, to: 0x366}, + 8: {from: 0x3fd, to: 0x428}, + 9: {from: 0x470, to: 0x14e}, + 10: {from: 0x486, to: 0x447}, + 11: {from: 0x498, to: 0x20}, + 12: {from: 0x533, to: 0x539}, + 13: {from: 0x584, to: 0x129}, + 14: {from: 0x625, to: 0x1ea6}, + 15: {from: 0x646, to: 0x427}, + 16: {from: 0x657, to: 0x427}, + 17: {from: 0x6e2, to: 0x39}, + 18: {from: 0x6ed, to: 0x1d0}, + 19: {from: 0x733, to: 0x2196}, + 20: {from: 0x7a8, to: 0x55}, + 21: {from: 0x7ae, to: 0x2990}, + 22: {from: 0x7ba, to: 0x57}, + 23: {from: 0x7db, to: 0x140}, + 24: {from: 0x801, to: 0x59}, + 25: {from: 0x80a, to: 0x8c}, + 26: {from: 0x873, to: 0x805}, + 27: {from: 0x8b8, to: 0xed8}, + 28: {from: 0x9e4, to: 0x328}, + 29: {from: 0xa2b, to: 0x2bc}, + 30: {from: 0xa32, to: 0xbd}, + 31: {from: 0xab3, to: 0x3317}, + 32: {from: 0xb2d, to: 0x51f}, + 33: {from: 0xb6a, to: 0x264f}, + 34: {from: 0xb73, to: 0xbb8}, + 35: {from: 0xb90, to: 0x444}, + 36: {from: 0xbb1, to: 0x421e}, + 37: {from: 0xbb4, to: 0x51f}, + 38: {from: 0xbf3, to: 0x2d9c}, + 39: {from: 0xc23, to: 0x3176}, + 40: {from: 0xcae, to: 0xf0}, + 41: {from: 0xcfd, to: 0xf6}, + 42: {from: 0xdbd, to: 0x116}, + 43: {from: 0xdcc, to: 0x324}, + 44: {from: 0xded, to: 0xdf0}, + 45: {from: 0xdf3, to: 0x526}, + 46: {from: 0xed4, to: 0x204f}, + 47: {from: 0xee3, to: 0x2e8f}, + 48: {from: 0xf2e, to: 0x35e}, + 49: {from: 0x10c5, to: 0x13b}, + 50: {from: 0x10f9, to: 0x2c7}, + 51: {from: 0x1195, to: 0x1e4}, + 52: {from: 0x126e, to: 0x20}, + 53: {from: 0x1419, to: 0x159}, + 54: {from: 0x1465, to: 0x149}, + 55: {from: 0x1514, to: 0xd90}, + 56: {from: 0x1518, to: 0x387}, + 57: {from: 0x1527, to: 0x16ba}, + 58: {from: 0x1575, to: 0x208}, + 59: {from: 0x1578, to: 0x109}, + 60: {from: 0x1598, to: 0x3ca4}, + 61: {from: 0x165f, to: 0x195}, + 62: {from: 0x16bd, to: 0x131}, + 63: {from: 0x16f5, to: 0x29ed}, + 64: {from: 0x170d, to: 0x18e}, + 65: {from: 0x171c, to: 0xf34}, + 66: {from: 0x176f, to: 0x1519}, + 67: {from: 0x17fe, to: 0x17ab}, + 68: {from: 0x180b, to: 0x18e8}, + 69: {from: 0x187f, to: 0x42c}, + 70: {from: 0x196e, to: 0x1cf6}, + 71: {from: 0x1a69, to: 0x2ba5}, + 72: {from: 0x1a7f, to: 0x1f0}, + 73: {from: 0x1b4f, to: 0x1f2}, + 74: {from: 0x1b7b, to: 0x150a}, + 75: {from: 0x202d, to: 0x37a6}, + 76: {from: 0x2032, to: 0x20d2}, + 77: {from: 0x204f, to: 0x302}, + 78: {from: 0x20d8, to: 0x26b}, + 79: {from: 0x20e3, to: 0x25a}, + 80: {from: 0x20e7, to: 0x225}, + 81: {from: 0x20ee, to: 0x24d}, + 82: {from: 0x2104, to: 0x21e0}, + 83: {from: 0x212a, to: 0x274}, + 84: {from: 0x218e, to: 0x11d}, + 85: {from: 0x21c3, to: 0x1556}, + 86: {from: 0x21db, to: 0x4fa}, + 87: {from: 0x21e9, to: 0x495}, + 88: {from: 0x2222, to: 0x11d}, + 89: {from: 0x222c, to: 0x11d}, + 90: {from: 0x2257, to: 0x91f}, + 91: {from: 0x230b, to: 0x321b}, + 92: {from: 0x2377, to: 0x335a}, + 93: {from: 0x2467, to: 0x2be}, + 94: {from: 0x24d9, to: 0x2f6}, + 95: {from: 0x24e5, to: 0x2f1}, + 96: {from: 0x24ef, to: 0x316}, + 97: {from: 0x2545, to: 0xb50}, + 98: {from: 0x259e, to: 0xe0}, + 99: {from: 0x2633, to: 0x2c7}, + 100: {from: 0x26be, to: 0x26a9}, + 101: {from: 0x26ee, to: 0x3bf}, + 102: {from: 0x271c, to: 0x3ca4}, + 103: {from: 0x275a, to: 0x26a9}, + 104: {from: 0x277e, to: 0x434d}, + 105: {from: 0x28e4, to: 0x282c}, + 106: {from: 0x2909, to: 0x348}, + 107: {from: 0x297b, to: 0x2d9c}, + 108: {from: 0x2b0f, to: 0x384}, + 109: {from: 0x2bf1, to: 0x38c}, + 110: {from: 0x2c34, to: 0x3ca4}, + 111: {from: 0x2cf1, to: 0x3b5}, + 112: {from: 0x2d08, to: 0x58c}, + 113: {from: 0x2d3c, to: 0x143}, + 114: {from: 0x2d3d, to: 0x143}, + 115: {from: 0x2df4, to: 0x2e8}, + 116: {from: 0x2dfd, to: 0x19c1}, + 117: {from: 0x2e0f, to: 0x2d8a}, + 118: {from: 0x2e16, to: 0x289}, + 119: {from: 0x2e49, to: 0x7c}, + 120: {from: 0x2e5a, to: 0x2277}, + 121: {from: 0x2e95, to: 0x2e90}, + 122: {from: 0x2ee4, to: 0x2ecc}, + 123: {from: 0x3188, to: 0x3bb}, + 124: {from: 0x335b, to: 0x3383}, + 125: {from: 0x341f, to: 0x3d3}, + 126: {from: 0x34e3, to: 0x18c5}, + 127: {from: 0x35db, to: 0x408}, + 128: {from: 0x364d, to: 0x23e}, + 129: {from: 0x366b, to: 0x3ea}, + 130: {from: 0x36f2, to: 0x43b}, + 131: {from: 0x37b5, to: 0x11d}, + 132: {from: 0x380b, to: 0x38e7}, + 133: {from: 0x3820, to: 0x2c90}, + 134: {from: 0x3824, to: 0xa7}, + 135: {from: 0x3827, to: 0x321d}, + 136: {from: 0x3861, to: 0x399b}, + 137: {from: 0x3887, to: 0x3fb5}, + 138: {from: 0x389a, to: 0x39cc}, + 139: {from: 0x38a9, to: 0x1f99}, + 140: {from: 0x38aa, to: 0x2e8f}, + 141: {from: 0x3951, to: 0x474}, + 142: {from: 0x3b43, to: 0xd86}, + 143: {from: 0x3b6d, to: 0x132}, + 144: {from: 0x3c8e, to: 0x4b2}, + 145: {from: 0x3fb2, to: 0xfc}, + 146: {from: 0x41fd, to: 0xa86}, + 147: {from: 0x42b3, to: 0x568}, + 148: {from: 0x42ee, to: 0x3f55}, + 149: {from: 0x436d, to: 0x251}, + 150: {from: 0x43c0, to: 0x36c0}, + 151: {from: 0x43c2, to: 0x10b}, + 152: {from: 0x44a4, to: 0x3317}, + 153: {from: 0x44d8, to: 0x508}, + 154: {from: 0x45bf, to: 0x23fe}, + 155: {from: 0x45d2, to: 0x26d1}, + 156: {from: 0x4605, to: 0x48a3}, + 157: {from: 0x46a3, to: 0x4695}, + 158: {from: 0x4733, to: 0x473a}, + 159: {from: 0x490b, to: 0x316}, + 160: {from: 0x499c, to: 0x519}, +} + +// Size: 161 bytes, 161 elements +var langAliasTypes = [161]langAliasType{ + // Entry 0 - 3F + 1, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 1, 0, 0, 1, 2, + 1, 1, 2, 0, 1, 0, 1, 2, 1, 1, 0, 0, 2, 1, 1, 0, + 2, 0, 0, 1, 0, 1, 0, 0, 1, 2, 1, 1, 1, 1, 0, 0, + 2, 1, 1, 1, 1, 2, 1, 0, 1, 1, 2, 2, 0, 1, 2, 0, + // Entry 40 - 7F + 1, 0, 1, 1, 1, 1, 0, 0, 2, 1, 0, 0, 0, 1, 1, 1, + 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 2, 2, + 2, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, + 0, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 2, 0, 2, + // Entry 80 - BF + 1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 1, 0, + 1, 2, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, + 1, +} + +const ( + _Latn = 82 + _Hani = 50 + _Hans = 52 + _Hant = 53 + _Qaaa = 131 + _Qaai = 139 + _Qabx = 180 + _Zinh = 224 + _Zyyy = 229 + _Zzzz = 230 +) + +// script is an alphabetically sorted list of ISO 15924 codes. The index +// of the script in the string, divided by 4, is the internal scriptID. +var script tag.Index = "" + // Size: 928 bytes + "----AdlmAfakAghbAhomArabAranArmiArmnAvstBaliBamuBassBatkBengBhksBlisBopo" + + "BrahBraiBugiBuhdCakmCansCariChamCherCirtCoptCprtCyrlCyrsDevaDsrtDuplEgyd" + + "EgyhEgypElbaEthiGeokGeorGlagGothGranGrekGujrGuruHanbHangHaniHanoHansHant" + + "HatrHebrHiraHluwHmngHrktHungIndsItalJamoJavaJpanJurcKaliKanaKharKhmrKhoj" + + "KitlKitsKndaKoreKpelKthiLanaLaooLatfLatgLatnLekeLepcLimbLinaLinbLisuLoma" + + "LyciLydiMahjMandManiMarcMayaMendMercMeroMlymModiMongMoonMrooMteiMultMymr" + + "NarbNbatNewaNkgbNkooNshuOgamOlckOrkhOryaOsgeOsmaPalmPaucPermPhagPhliPhlp" + + "PhlvPhnxPiqdPlrdPrtiQaaaQaabQaacQaadQaaeQaafQaagQaahQaaiQaajQaakQaalQaam" + + "QaanQaaoQaapQaaqQaarQaasQaatQaauQaavQaawQaaxQaayQaazQabaQabbQabcQabdQabe" + + "QabfQabgQabhQabiQabjQabkQablQabmQabnQaboQabpQabqQabrQabsQabtQabuQabvQabw" + + "QabxRjngRoroRunrSamrSaraSarbSaurSgnwShawShrdSiddSindSinhSoraSundSyloSyrc" + + "SyreSyrjSyrnTagbTakrTaleTaluTamlTangTavtTeluTengTfngTglgThaaThaiTibtTirh" + + "UgarVaiiVispWaraWoleXpeoXsuxYiiiZinhZmthZsyeZsymZxxxZyyyZzzz\xff\xff\xff" + + "\xff" + +// suppressScript is an index from langID to the dominant script for that language, +// if it exists. If a script is given, it should be suppressed from the language tag. +// Size: 1319 bytes, 1319 elements +var suppressScript = [1319]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 40 - 7F + 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, + // Entry 80 - BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry C0 - FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x52, 0x52, 0x00, 0x00, + // Entry 100 - 13F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, + 0x00, 0xd6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x2d, 0x00, 0x00, 0x52, 0x00, 0x00, 0x52, + 0x00, 0x52, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, + // Entry 140 - 17F + 0x52, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, + 0x52, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x52, 0x00, 0x00, 0x52, 0x52, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 180 - 1BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x52, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x52, 0x2e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 1C0 - 1FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x52, 0x52, 0x00, 0x52, 0x52, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x52, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 200 - 23F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x52, 0x00, 0x00, + // Entry 240 - 27F + 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x4a, 0x00, 0x4b, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 280 - 2BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x4f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + // Entry 2C0 - 2FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, + 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, + // Entry 300 - 33F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x52, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + // Entry 340 - 37F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x52, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x52, 0x00, 0x00, + 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + // Entry 380 - 3BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x52, + 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, + // Entry 3C0 - 3FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1e, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 400 - 43F + 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, + 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x52, 0x52, 0x00, 0x00, 0x00, 0x00, + // Entry 440 - 47F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, + 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xd5, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, + 0x52, 0x00, 0x00, 0x00, 0x52, 0x00, 0x52, 0x00, + 0x52, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, + // Entry 480 - 4BF + 0x52, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, + 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 4C0 - 4FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 500 - 53F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, +} + +const ( + _001 = 1 + _419 = 30 + _BR = 64 + _CA = 72 + _ES = 109 + _GB = 122 + _MD = 187 + _PT = 237 + _UK = 305 + _US = 308 + _ZZ = 356 + _XA = 322 + _XC = 324 + _XK = 332 +) + +// isoRegionOffset needs to be added to the index of regionISO to obtain the regionID +// for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for +// the UN.M49 codes used for groups.) +const isoRegionOffset = 31 + +// regionTypes defines the status of a region for various standards. +// Size: 357 bytes, 357 elements +var regionTypes = [357]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry 40 - 7F + 0x06, 0x06, 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x04, 0x00, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, + 0x04, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x04, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, + 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry 80 - BF + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x00, 0x04, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry C0 - FF + 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, + 0x06, 0x06, 0x06, 0x00, 0x06, 0x04, 0x06, 0x06, + 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, + 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + // Entry 100 - 13F + 0x05, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x02, 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry 140 - 17F + 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, 0x06, 0x04, + 0x06, 0x06, 0x04, 0x06, 0x05, +} + +// regionISO holds a list of alphabetically sorted 2-letter ISO region codes. +// Each 2-letter codes is followed by two bytes with the following meaning: +// - [A-Z}{2}: the first letter of the 2-letter code plus these two +// letters form the 3-letter ISO code. +// - 0, n: index into altRegionISO3. +var regionISO tag.Index = "" + // Size: 1308 bytes + "AAAAACSCADNDAEREAFFGAGTGAIIAALLBAMRMANNTAOGOAQTAARRGASSMATUTAUUSAWBWAXLA" + + "AZZEBAIHBBRBBDGDBEELBFFABGGRBHHRBIDIBJENBLLMBMMUBNRNBOOLBQESBRRABSHSBTTN" + + "BUURBVVTBWWABYLRBZLZCAANCCCKCDODCFAFCGOGCHHECIIVCKOKCLHLCMMRCNHNCOOLCPPT" + + "CRRICS\x00\x00CTTECUUBCVPVCWUWCXXRCYYPCZZEDDDRDEEUDGGADJJIDKNKDMMADOOMDY" + + "HYDZZAEA ECCUEESTEGGYEHSHERRIESSPETTHEU\x00\x03EZ FIINFJJIFKLKFMSMFORO" + + "FQ\x00\x18FRRAFXXXGAABGBBRGDRDGEEOGFUFGGGYGHHAGIIBGLRLGMMBGNINGPLPGQNQGR" + + "RCGS\x00\x06GTTMGUUMGWNBGYUYHKKGHMMDHNNDHRRVHTTIHUUNHVVOIC IDDNIERLILSR" + + "IMMNINNDIOOTIQRQIRRNISSLITTAJEEYJMAMJOORJPPNJTTNKEENKGGZKHHMKIIRKM\x00" + + "\x09KNNAKP\x00\x0cKRORKWWTKY\x00\x0fKZAZLAAOLBBNLCCALIIELKKALRBRLSSOLTTU" + + "LUUXLVVALYBYMAARMCCOMDDAMENEMFAFMGDGMHHLMIIDMKKDMLLIMMMRMNNGMOACMPNPMQTQ" + + "MRRTMSSRMTLTMUUSMVDVMWWIMXEXMYYSMZOZNAAMNCCLNEERNFFKNGGANHHBNIICNLLDNOOR" + + "NPPLNQ\x00\x1eNRRUNTTZNUIUNZZLOMMNPAANPCCIPEERPFYFPGNGPHHLPKAKPLOLPM\x00" + + "\x12PNCNPRRIPSSEPTRTPUUSPWLWPYRYPZCZQAATQMMMQNNNQOOOQPPPQQQQQRRRQSSSQTTT" + + "QU\x00\x03QVVVQWWWQXXXQYYYQZZZREEURHHOROOURS\x00\x15RUUSRWWASAAUSBLBSCYC" + + "SDDNSEWESGGPSHHNSIVNSJJMSKVKSLLESMMRSNENSOOMSRURSSSDSTTPSUUNSVLVSXXMSYYR" + + "SZWZTAAATCCATDCDTF\x00\x18TGGOTHHATJJKTKKLTLLSTMKMTNUNTOONTPMPTRURTTTOTV" + + "UVTWWNTZZAUAKRUGGAUK UMMIUN USSAUYRYUZZBVAATVCCTVDDRVEENVGGBVIIRVNNMVU" + + "UTWFLFWKAKWSSMXAAAXBBBXCCCXDDDXEEEXFFFXGGGXHHHXIIIXJJJXKKKXLLLXMMMXNNNXO" + + "OOXPPPXQQQXRRRXSSSXTTTXUUUXVVVXWWWXXXXXYYYXZZZYDMDYEEMYT\x00\x1bYUUGZAAF" + + "ZMMBZRARZWWEZZZZ\xff\xff\xff\xff" + +// altRegionISO3 holds a list of 3-letter region codes that cannot be +// mapped to 2-letter codes using the default algorithm. This is a short list. +var altRegionISO3 string = "SCGQUUSGSCOMPRKCYMSPMSRBATFMYTATN" + +// altRegionIDs holds a list of regionIDs the positions of which match those +// of the 3-letter ISO codes in altRegionISO3. +// Size: 22 bytes, 11 elements +var altRegionIDs = [11]uint16{ + 0x0056, 0x006f, 0x0087, 0x00a7, 0x00a9, 0x00ac, 0x00e9, 0x0104, + 0x0120, 0x015e, 0x00db, +} + +// Size: 80 bytes, 20 elements +var regionOldMap = [20]fromTo{ + 0: {from: 0x43, to: 0xc3}, + 1: {from: 0x57, to: 0xa6}, + 2: {from: 0x5e, to: 0x5f}, + 3: {from: 0x65, to: 0x3a}, + 4: {from: 0x78, to: 0x77}, + 5: {from: 0x92, to: 0x36}, + 6: {from: 0xa2, to: 0x132}, + 7: {from: 0xc0, to: 0x132}, + 8: {from: 0xd6, to: 0x13e}, + 9: {from: 0xdb, to: 0x2a}, + 10: {from: 0xee, to: 0x132}, + 11: {from: 0xf1, to: 0xe1}, + 12: {from: 0xfb, to: 0x6f}, + 13: {from: 0x102, to: 0x163}, + 14: {from: 0x129, to: 0x125}, + 15: {from: 0x131, to: 0x7a}, + 16: {from: 0x139, to: 0x13d}, + 17: {from: 0x140, to: 0x132}, + 18: {from: 0x15c, to: 0x15d}, + 19: {from: 0x162, to: 0x4a}, +} + +// m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are +// codes indicating collections of regions. +// Size: 714 bytes, 357 elements +var m49 = [357]int16{ + // Entry 0 - 3F + 0, 1, 2, 3, 5, 9, 11, 13, + 14, 15, 17, 18, 19, 21, 29, 30, + 34, 35, 39, 53, 54, 57, 61, 142, + 143, 145, 150, 151, 154, 155, 419, 958, + 0, 20, 784, 4, 28, 660, 8, 51, + 530, 24, 10, 32, 16, 40, 36, 533, + 248, 31, 70, 52, 50, 56, 854, 100, + 48, 108, 204, 652, 60, 96, 68, 535, + // Entry 40 - 7F + 76, 44, 64, 104, 74, 72, 112, 84, + 124, 166, 180, 140, 178, 756, 384, 184, + 152, 120, 156, 170, 0, 188, 891, 296, + 192, 132, 531, 162, 196, 203, 278, 276, + 0, 262, 208, 212, 214, 204, 12, 0, + 218, 233, 818, 732, 232, 724, 231, 967, + 0, 246, 242, 238, 583, 234, 0, 250, + 249, 266, 826, 308, 268, 254, 831, 288, + // Entry 80 - BF + 292, 304, 270, 324, 312, 226, 300, 239, + 320, 316, 624, 328, 344, 334, 340, 191, + 332, 348, 854, 0, 360, 372, 376, 833, + 356, 86, 368, 364, 352, 380, 832, 388, + 400, 392, 581, 404, 417, 116, 296, 174, + 659, 408, 410, 414, 136, 398, 418, 422, + 662, 438, 144, 430, 426, 440, 442, 428, + 434, 504, 492, 498, 499, 663, 450, 584, + // Entry C0 - FF + 581, 807, 466, 104, 496, 446, 580, 474, + 478, 500, 470, 480, 462, 454, 484, 458, + 508, 516, 540, 562, 574, 566, 548, 558, + 528, 578, 524, 10, 520, 536, 570, 554, + 512, 591, 0, 604, 258, 598, 608, 586, + 616, 666, 612, 630, 275, 620, 581, 585, + 600, 591, 634, 959, 960, 961, 962, 963, + 964, 965, 966, 967, 968, 969, 970, 971, + // Entry 100 - 13F + 972, 638, 716, 642, 688, 643, 646, 682, + 90, 690, 729, 752, 702, 654, 705, 744, + 703, 694, 674, 686, 706, 740, 728, 678, + 810, 222, 534, 760, 748, 0, 796, 148, + 260, 768, 764, 762, 772, 626, 795, 788, + 776, 626, 792, 780, 798, 158, 834, 804, + 800, 826, 581, 0, 840, 858, 860, 336, + 670, 704, 862, 92, 850, 704, 548, 876, + // Entry 140 - 17F + 581, 882, 973, 974, 975, 976, 977, 978, + 979, 980, 981, 982, 983, 984, 985, 986, + 987, 988, 989, 990, 991, 992, 993, 994, + 995, 996, 997, 998, 720, 887, 175, 891, + 710, 894, 180, 716, 999, +} + +// m49Index gives indexes into fromM49 based on the three most significant bits +// of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in +// fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]] +// for an entry where the first 7 bits match the 7 lsb of the UN.M49 code. +// The region code is stored in the 9 lsb of the indexed value. +// Size: 18 bytes, 9 elements +var m49Index = [9]int16{ + 0, 59, 107, 142, 180, 219, 258, 290, + 332, +} + +// fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details. +// Size: 664 bytes, 332 elements +var fromM49 = [332]uint16{ + // Entry 0 - 3F + 0x0201, 0x0402, 0x0603, 0x0823, 0x0a04, 0x1026, 0x1205, 0x142a, + 0x1606, 0x1866, 0x1a07, 0x1c08, 0x1e09, 0x202c, 0x220a, 0x240b, + 0x260c, 0x2821, 0x2a0d, 0x3029, 0x3824, 0x3a0e, 0x3c0f, 0x3e31, + 0x402b, 0x4410, 0x4611, 0x482e, 0x4e12, 0x502d, 0x5841, 0x6038, + 0x6434, 0x6627, 0x6833, 0x6a13, 0x6c14, 0x7035, 0x7215, 0x783c, + 0x7a16, 0x8042, 0x883e, 0x8c32, 0x9045, 0x9444, 0x9840, 0xa847, + 0xac99, 0xb508, 0xb93b, 0xc03d, 0xc837, 0xd0c3, 0xd839, 0xe046, + 0xe8a5, 0xf051, 0xf848, 0x0859, 0x10ac, 0x184b, 0x1c17, 0x1e18, + // Entry 40 - 7F + 0x20b2, 0x2219, 0x291f, 0x2c1a, 0x2e1b, 0x3050, 0x341c, 0x361d, + 0x3852, 0x3d2d, 0x445b, 0x4c49, 0x5453, 0x5ca7, 0x5f5e, 0x644c, + 0x684a, 0x704f, 0x7855, 0x7e8f, 0x8058, 0x885c, 0x965d, 0x983a, + 0xa062, 0xa863, 0xac64, 0xb468, 0xbd19, 0xc485, 0xcc6e, 0xce6e, + 0xd06c, 0xd269, 0xd475, 0xdc73, 0xde87, 0xe472, 0xec71, 0xf030, + 0xf278, 0xf477, 0xfc7d, 0x04e4, 0x0920, 0x0c61, 0x1479, 0x187c, + 0x1c82, 0x26ec, 0x285f, 0x2c5e, 0x305f, 0x407f, 0x4880, 0x50a6, + 0x5886, 0x6081, 0x687b, 0x7084, 0x7889, 0x8088, 0x8883, 0x908b, + // Entry 80 - BF + 0x9890, 0x9c8d, 0xa137, 0xa88e, 0xb08c, 0xb891, 0xc09c, 0xc898, + 0xd094, 0xd89b, 0xe09a, 0xe895, 0xf096, 0xf89d, 0x004e, 0x089f, + 0x10a1, 0x1cad, 0x20a0, 0x28a3, 0x30a9, 0x34aa, 0x3cab, 0x42a4, + 0x44ae, 0x461e, 0x4caf, 0x54b4, 0x58b7, 0x5cb3, 0x64b8, 0x6cb1, + 0x70b5, 0x74b6, 0x7cc5, 0x84be, 0x8ccd, 0x94cf, 0x9ccc, 0xa4c2, + 0xacca, 0xb4c7, 0xbcc8, 0xc0cb, 0xc8ce, 0xd8ba, 0xe0c4, 0xe4bb, + 0xe6bc, 0xe8c9, 0xf0b9, 0xf8d0, 0x00e0, 0x08d1, 0x10dc, 0x18da, + 0x20d8, 0x2428, 0x265a, 0x2a2f, 0x2d1a, 0x2e3f, 0x30dd, 0x38d2, + // Entry C0 - FF + 0x493e, 0x54df, 0x5cd7, 0x64d3, 0x6cd5, 0x74de, 0x7cd4, 0x84d9, + 0x88c6, 0x8b32, 0x8e74, 0x90bf, 0x92ef, 0x94e7, 0x9ee1, 0xace5, + 0xb0f0, 0xb8e3, 0xc0e6, 0xc8ea, 0xd0e8, 0xd8ed, 0xe08a, 0xe525, + 0xeceb, 0xf4f2, 0xfd01, 0x0503, 0x0705, 0x0d06, 0x183b, 0x1d0d, + 0x26a8, 0x2825, 0x2cb0, 0x2ebd, 0x34e9, 0x3d38, 0x4512, 0x4d17, + 0x5507, 0x5d13, 0x6104, 0x6509, 0x6d11, 0x7d0c, 0x7f10, 0x813d, + 0x830e, 0x8514, 0x8d60, 0x9963, 0xa15c, 0xa86d, 0xb116, 0xb30a, + 0xb86b, 0xc10a, 0xc915, 0xd10f, 0xd91c, 0xe10b, 0xe84d, 0xf11b, + // Entry 100 - 13F + 0xf523, 0xf922, 0x0121, 0x0924, 0x1128, 0x192b, 0x2022, 0x2927, + 0x312a, 0x3726, 0x391e, 0x3d2c, 0x4130, 0x492f, 0x4ec1, 0x5518, + 0x646a, 0x747a, 0x7e7e, 0x809e, 0x8297, 0x852e, 0x9134, 0xa53c, + 0xac36, 0xb535, 0xb936, 0xbd3a, 0xd93f, 0xe541, 0xed5d, 0xef5d, + 0xf656, 0xfd61, 0x7c1f, 0x7ef3, 0x80f4, 0x82f5, 0x84f6, 0x86f7, + 0x88f8, 0x8af9, 0x8cfa, 0x8e6f, 0x90fc, 0x92fd, 0x94fe, 0x96ff, + 0x9900, 0x9b42, 0x9d43, 0x9f44, 0xa145, 0xa346, 0xa547, 0xa748, + 0xa949, 0xab4a, 0xad4b, 0xaf4c, 0xb14d, 0xb34e, 0xb54f, 0xb750, + // Entry 140 - 17F + 0xb951, 0xbb52, 0xbd53, 0xbf54, 0xc155, 0xc356, 0xc557, 0xc758, + 0xc959, 0xcb5a, 0xcd5b, 0xcf64, +} + +// Size: 1463 bytes +var variantIndex = map[string]uint8{ + "1606nict": 0x0, + "1694acad": 0x1, + "1901": 0x2, + "1959acad": 0x3, + "1994": 0x45, + "1996": 0x4, + "abl1943": 0x5, + "alalc97": 0x47, + "aluku": 0x6, + "ao1990": 0x7, + "arevela": 0x8, + "arevmda": 0x9, + "baku1926": 0xa, + "balanka": 0xb, + "barla": 0xc, + "basiceng": 0xd, + "bauddha": 0xe, + "biscayan": 0xf, + "biske": 0x40, + "bohoric": 0x10, + "boont": 0x11, + "colb1945": 0x12, + "cornu": 0x13, + "dajnko": 0x14, + "ekavsk": 0x15, + "emodeng": 0x16, + "fonipa": 0x48, + "fonnapa": 0x49, + "fonupa": 0x4a, + "fonxsamp": 0x4b, + "hepburn": 0x17, + "heploc": 0x46, + "hognorsk": 0x18, + "ijekavsk": 0x19, + "itihasa": 0x1a, + "jauer": 0x1b, + "jyutping": 0x1c, + "kkcor": 0x1d, + "kociewie": 0x1e, + "kscor": 0x1f, + "laukika": 0x20, + "lipaw": 0x41, + "luna1918": 0x21, + "metelko": 0x22, + "monoton": 0x23, + "ndyuka": 0x24, + "nedis": 0x25, + "newfound": 0x26, + "njiva": 0x42, + "nulik": 0x27, + "osojs": 0x43, + "oxendict": 0x28, + "pamaka": 0x29, + "petr1708": 0x2a, + "pinyin": 0x2b, + "polyton": 0x2c, + "puter": 0x2d, + "rigik": 0x2e, + "rozaj": 0x2f, + "rumgr": 0x30, + "scotland": 0x31, + "scouse": 0x32, + "simple": 0x4c, + "solba": 0x44, + "sotav": 0x33, + "surmiran": 0x34, + "sursilv": 0x35, + "sutsilv": 0x36, + "tarask": 0x37, + "uccor": 0x38, + "ucrcor": 0x39, + "ulster": 0x3a, + "unifon": 0x3b, + "vaidika": 0x3c, + "valencia": 0x3d, + "vallader": 0x3e, + "wadegile": 0x3f, +} + +// variantNumSpecialized is the number of specialized variants in variants. +const variantNumSpecialized = 71 + +// nRegionGroups is the number of region groups. +const nRegionGroups = 32 + +type likelyLangRegion struct { + lang uint16 + region uint16 +} + +// likelyScript is a lookup table, indexed by scriptID, for the most likely +// languages and regions given a script. +// Size: 928 bytes, 232 elements +var likelyScript = [232]likelyLangRegion{ + 1: {lang: 0x149, region: 0x83}, + 3: {lang: 0x299, region: 0x105}, + 4: {lang: 0x1e, region: 0x98}, + 5: {lang: 0x39, region: 0x6a}, + 7: {lang: 0x3a, region: 0x9b}, + 8: {lang: 0x1d0, region: 0x27}, + 9: {lang: 0x12, region: 0x9b}, + 10: {lang: 0x5a, region: 0x94}, + 11: {lang: 0x5f, region: 0x51}, + 12: {lang: 0xb7, region: 0xb3}, + 13: {lang: 0x62, region: 0x94}, + 14: {lang: 0xa3, region: 0x34}, + 15: {lang: 0x3e0, region: 0x98}, + 17: {lang: 0x51f, region: 0x12d}, + 18: {lang: 0x3a8, region: 0x98}, + 19: {lang: 0x159, region: 0x77}, + 20: {lang: 0xc0, region: 0x94}, + 21: {lang: 0x9b, region: 0xe6}, + 22: {lang: 0xd9, region: 0x34}, + 23: {lang: 0xf0, region: 0x48}, + 24: {lang: 0x4e6, region: 0x12a}, + 25: {lang: 0xe5, region: 0x13d}, + 26: {lang: 0xe3, region: 0x134}, + 28: {lang: 0xee, region: 0x6a}, + 29: {lang: 0x199, region: 0x5c}, + 30: {lang: 0x3d9, region: 0x105}, + 32: {lang: 0x1b7, region: 0x98}, + 34: {lang: 0x159, region: 0x77}, + 37: {lang: 0x12f, region: 0x6a}, + 38: {lang: 0x427, region: 0x26}, + 39: {lang: 0x26, region: 0x6e}, + 41: {lang: 0x208, region: 0x7c}, + 42: {lang: 0xfa, region: 0x37}, + 43: {lang: 0x198, region: 0x12f}, + 44: {lang: 0x3e0, region: 0x98}, + 45: {lang: 0x131, region: 0x86}, + 46: {lang: 0x19d, region: 0x98}, + 47: {lang: 0x394, region: 0x98}, + 48: {lang: 0x51f, region: 0x12d}, + 49: {lang: 0x24b, region: 0xaa}, + 50: {lang: 0x51f, region: 0x52}, + 51: {lang: 0x1c4, region: 0xe6}, + 52: {lang: 0x51f, region: 0x52}, + 53: {lang: 0x51f, region: 0x12d}, + 54: {lang: 0x2f4, region: 0x9a}, + 55: {lang: 0x1b5, region: 0x96}, + 56: {lang: 0x1f8, region: 0xa1}, + 57: {lang: 0x1be, region: 0x12a}, + 58: {lang: 0x1c3, region: 0xae}, + 60: {lang: 0x1ce, region: 0x91}, + 62: {lang: 0x13d, region: 0x9d}, + 63: {lang: 0x24b, region: 0xaa}, + 64: {lang: 0x206, region: 0x94}, + 65: {lang: 0x1f8, region: 0xa1}, + 67: {lang: 0x130, region: 0xc3}, + 68: {lang: 0x1f8, region: 0xa1}, + 69: {lang: 0x3b2, region: 0xe7}, + 70: {lang: 0x242, region: 0xa5}, + 71: {lang: 0x3f0, region: 0x98}, + 74: {lang: 0x249, region: 0x98}, + 75: {lang: 0x24b, region: 0xaa}, + 77: {lang: 0x87, region: 0x98}, + 78: {lang: 0x367, region: 0x122}, + 79: {lang: 0x2af, region: 0xae}, + 84: {lang: 0x296, region: 0x98}, + 85: {lang: 0x29f, region: 0x98}, + 86: {lang: 0x286, region: 0x86}, + 87: {lang: 0x199, region: 0x86}, + 88: {lang: 0x2a3, region: 0x52}, + 90: {lang: 0x4ea, region: 0x12a}, + 91: {lang: 0x4eb, region: 0x12a}, + 92: {lang: 0x1b7, region: 0x98}, + 93: {lang: 0x32e, region: 0x9b}, + 94: {lang: 0x4ed, region: 0x52}, + 95: {lang: 0xa7, region: 0x52}, + 97: {lang: 0x2df, region: 0x111}, + 98: {lang: 0x4ee, region: 0x10a}, + 99: {lang: 0x4ee, region: 0x10a}, + 100: {lang: 0x2fb, region: 0x98}, + 101: {lang: 0x312, region: 0x98}, + 102: {lang: 0x302, region: 0x52}, + 104: {lang: 0x315, region: 0x34}, + 105: {lang: 0x305, region: 0x98}, + 106: {lang: 0x40a, region: 0xe7}, + 107: {lang: 0x328, region: 0xc3}, + 108: {lang: 0x4ef, region: 0x107}, + 109: {lang: 0x3a, region: 0xa0}, + 110: {lang: 0x34a, region: 0xda}, + 112: {lang: 0x2c7, region: 0x83}, + 114: {lang: 0x3f9, region: 0x95}, + 115: {lang: 0x3e5, region: 0x98}, + 116: {lang: 0x392, region: 0xc4}, + 117: {lang: 0x38c, region: 0x98}, + 118: {lang: 0x390, region: 0x134}, + 119: {lang: 0x41f, region: 0x114}, + 120: {lang: 0x3a, region: 0x11b}, + 121: {lang: 0xf9, region: 0xc3}, + 122: {lang: 0x274, region: 0x105}, + 123: {lang: 0x2c0, region: 0x52}, + 124: {lang: 0x396, region: 0x9b}, + 125: {lang: 0x396, region: 0x52}, + 127: {lang: 0x3a4, region: 0xaf}, + 129: {lang: 0x1bf, region: 0x52}, + 130: {lang: 0x4f3, region: 0x9b}, + 181: {lang: 0x3c2, region: 0x94}, + 183: {lang: 0x369, region: 0x10b}, + 184: {lang: 0x416, region: 0x96}, + 186: {lang: 0x4f5, region: 0x15d}, + 187: {lang: 0x3e6, region: 0x98}, + 188: {lang: 0x44, region: 0x134}, + 189: {lang: 0x134, region: 0x7a}, + 190: {lang: 0x3e0, region: 0x98}, + 191: {lang: 0x3e0, region: 0x98}, + 192: {lang: 0x3f0, region: 0x98}, + 193: {lang: 0x402, region: 0xb2}, + 194: {lang: 0x429, region: 0x98}, + 195: {lang: 0x434, region: 0x94}, + 196: {lang: 0x443, region: 0x34}, + 197: {lang: 0x444, region: 0x9a}, + 201: {lang: 0x450, region: 0xe6}, + 202: {lang: 0x116, region: 0x98}, + 203: {lang: 0x454, region: 0x52}, + 204: {lang: 0x22a, region: 0x52}, + 205: {lang: 0x446, region: 0x98}, + 206: {lang: 0x49b, region: 0x52}, + 207: {lang: 0x9d, region: 0x13d}, + 208: {lang: 0x457, region: 0x98}, + 210: {lang: 0x51e, region: 0xb9}, + 211: {lang: 0x14e, region: 0xe6}, + 212: {lang: 0x124, region: 0xcc}, + 213: {lang: 0x461, region: 0x122}, + 214: {lang: 0xa7, region: 0x52}, + 215: {lang: 0x2c5, region: 0x98}, + 216: {lang: 0x4a3, region: 0x11b}, + 217: {lang: 0x4b4, region: 0xb3}, + 219: {lang: 0x1c7, region: 0x98}, + 221: {lang: 0x3a0, region: 0x9b}, + 222: {lang: 0x21, region: 0x9a}, + 223: {lang: 0x1e2, region: 0x52}, +} + +type likelyScriptRegion struct { + region uint16 + script uint8 + flags uint8 +} + +// likelyLang is a lookup table, indexed by langID, for the most likely +// scripts and regions given incomplete information. If more entries exist for a +// given language, region and script are the index and size respectively +// of the list in likelyLangList. +// Size: 5276 bytes, 1319 elements +var likelyLang = [1319]likelyScriptRegion{ + 0: {region: 0x134, script: 0x52, flags: 0x0}, + 1: {region: 0x6e, script: 0x52, flags: 0x0}, + 2: {region: 0x164, script: 0x52, flags: 0x0}, + 3: {region: 0x164, script: 0x52, flags: 0x0}, + 4: {region: 0x164, script: 0x52, flags: 0x0}, + 5: {region: 0x7c, script: 0x1e, flags: 0x0}, + 6: {region: 0x164, script: 0x52, flags: 0x0}, + 7: {region: 0x7f, script: 0x52, flags: 0x0}, + 8: {region: 0x164, script: 0x52, flags: 0x0}, + 9: {region: 0x164, script: 0x52, flags: 0x0}, + 10: {region: 0x164, script: 0x52, flags: 0x0}, + 11: {region: 0x94, script: 0x52, flags: 0x0}, + 12: {region: 0x130, script: 0x52, flags: 0x0}, + 13: {region: 0x7f, script: 0x52, flags: 0x0}, + 14: {region: 0x164, script: 0x52, flags: 0x0}, + 15: {region: 0x164, script: 0x52, flags: 0x0}, + 16: {region: 0x105, script: 0x1e, flags: 0x0}, + 17: {region: 0x164, script: 0x52, flags: 0x0}, + 18: {region: 0x9b, script: 0x9, flags: 0x0}, + 19: {region: 0x127, script: 0x5, flags: 0x0}, + 20: {region: 0x164, script: 0x52, flags: 0x0}, + 21: {region: 0x160, script: 0x52, flags: 0x0}, + 22: {region: 0x164, script: 0x52, flags: 0x0}, + 23: {region: 0x164, script: 0x52, flags: 0x0}, + 24: {region: 0x164, script: 0x52, flags: 0x0}, + 25: {region: 0x164, script: 0x52, flags: 0x0}, + 26: {region: 0x164, script: 0x52, flags: 0x0}, + 27: {region: 0x51, script: 0x52, flags: 0x0}, + 28: {region: 0x164, script: 0x52, flags: 0x0}, + 29: {region: 0x164, script: 0x52, flags: 0x0}, + 30: {region: 0x98, script: 0x4, flags: 0x0}, + 31: {region: 0x164, script: 0x52, flags: 0x0}, + 32: {region: 0x7f, script: 0x52, flags: 0x0}, + 33: {region: 0x9a, script: 0xde, flags: 0x0}, + 34: {region: 0x164, script: 0x52, flags: 0x0}, + 35: {region: 0x164, script: 0x52, flags: 0x0}, + 36: {region: 0x14c, script: 0x52, flags: 0x0}, + 37: {region: 0x105, script: 0x1e, flags: 0x0}, + 38: {region: 0x6e, script: 0x27, flags: 0x0}, + 39: {region: 0x164, script: 0x52, flags: 0x0}, + 40: {region: 0x164, script: 0x52, flags: 0x0}, + 41: {region: 0xd5, script: 0x52, flags: 0x0}, + 42: {region: 0x164, script: 0x52, flags: 0x0}, + 44: {region: 0x164, script: 0x52, flags: 0x0}, + 45: {region: 0x164, script: 0x52, flags: 0x0}, + 46: {region: 0x164, script: 0x52, flags: 0x0}, + 47: {region: 0x164, script: 0x52, flags: 0x0}, + 48: {region: 0x164, script: 0x52, flags: 0x0}, + 49: {region: 0x164, script: 0x52, flags: 0x0}, + 50: {region: 0x94, script: 0x52, flags: 0x0}, + 51: {region: 0x164, script: 0x5, flags: 0x0}, + 52: {region: 0x121, script: 0x5, flags: 0x0}, + 53: {region: 0x164, script: 0x52, flags: 0x0}, + 54: {region: 0x164, script: 0x52, flags: 0x0}, + 55: {region: 0x164, script: 0x52, flags: 0x0}, + 56: {region: 0x164, script: 0x52, flags: 0x0}, + 57: {region: 0x6a, script: 0x5, flags: 0x0}, + 58: {region: 0x0, script: 0x3, flags: 0x1}, + 59: {region: 0x164, script: 0x52, flags: 0x0}, + 60: {region: 0x50, script: 0x52, flags: 0x0}, + 61: {region: 0x3e, script: 0x52, flags: 0x0}, + 62: {region: 0x66, script: 0x5, flags: 0x0}, + 64: {region: 0xb9, script: 0x5, flags: 0x0}, + 65: {region: 0x6a, script: 0x5, flags: 0x0}, + 66: {region: 0x98, script: 0xe, flags: 0x0}, + 67: {region: 0x12e, script: 0x52, flags: 0x0}, + 68: {region: 0x134, script: 0xbc, flags: 0x0}, + 69: {region: 0x164, script: 0x52, flags: 0x0}, + 70: {region: 0x164, script: 0x52, flags: 0x0}, + 71: {region: 0x6d, script: 0x52, flags: 0x0}, + 72: {region: 0x164, script: 0x52, flags: 0x0}, + 73: {region: 0x164, script: 0x52, flags: 0x0}, + 74: {region: 0x48, script: 0x52, flags: 0x0}, + 75: {region: 0x164, script: 0x52, flags: 0x0}, + 76: {region: 0x105, script: 0x1e, flags: 0x0}, + 77: {region: 0x164, script: 0x5, flags: 0x0}, + 78: {region: 0x164, script: 0x52, flags: 0x0}, + 79: {region: 0x164, script: 0x52, flags: 0x0}, + 80: {region: 0x164, script: 0x52, flags: 0x0}, + 81: {region: 0x98, script: 0x20, flags: 0x0}, + 82: {region: 0x164, script: 0x52, flags: 0x0}, + 83: {region: 0x164, script: 0x52, flags: 0x0}, + 84: {region: 0x164, script: 0x52, flags: 0x0}, + 85: {region: 0x3e, script: 0x52, flags: 0x0}, + 86: {region: 0x164, script: 0x52, flags: 0x0}, + 87: {region: 0x3, script: 0x5, flags: 0x1}, + 88: {region: 0x105, script: 0x1e, flags: 0x0}, + 89: {region: 0xe7, script: 0x5, flags: 0x0}, + 90: {region: 0x94, script: 0x52, flags: 0x0}, + 91: {region: 0xda, script: 0x20, flags: 0x0}, + 92: {region: 0x2d, script: 0x52, flags: 0x0}, + 93: {region: 0x51, script: 0x52, flags: 0x0}, + 94: {region: 0x164, script: 0x52, flags: 0x0}, + 95: {region: 0x51, script: 0xb, flags: 0x0}, + 96: {region: 0x164, script: 0x52, flags: 0x0}, + 97: {region: 0x164, script: 0x52, flags: 0x0}, + 98: {region: 0x94, script: 0x52, flags: 0x0}, + 99: {region: 0x164, script: 0x52, flags: 0x0}, + 100: {region: 0x51, script: 0x52, flags: 0x0}, + 101: {region: 0x164, script: 0x52, flags: 0x0}, + 102: {region: 0x164, script: 0x52, flags: 0x0}, + 103: {region: 0x164, script: 0x52, flags: 0x0}, + 104: {region: 0x164, script: 0x52, flags: 0x0}, + 105: {region: 0x4e, script: 0x52, flags: 0x0}, + 106: {region: 0x164, script: 0x52, flags: 0x0}, + 107: {region: 0x164, script: 0x52, flags: 0x0}, + 108: {region: 0x164, script: 0x52, flags: 0x0}, + 109: {region: 0x164, script: 0x27, flags: 0x0}, + 110: {region: 0x164, script: 0x52, flags: 0x0}, + 111: {region: 0x164, script: 0x52, flags: 0x0}, + 112: {region: 0x46, script: 0x1e, flags: 0x0}, + 113: {region: 0x164, script: 0x52, flags: 0x0}, + 114: {region: 0x164, script: 0x52, flags: 0x0}, + 115: {region: 0x10a, script: 0x5, flags: 0x0}, + 116: {region: 0x161, script: 0x52, flags: 0x0}, + 117: {region: 0x164, script: 0x52, flags: 0x0}, + 118: {region: 0x94, script: 0x52, flags: 0x0}, + 119: {region: 0x164, script: 0x52, flags: 0x0}, + 120: {region: 0x12e, script: 0x52, flags: 0x0}, + 121: {region: 0x51, script: 0x52, flags: 0x0}, + 122: {region: 0x98, script: 0xcd, flags: 0x0}, + 123: {region: 0xe7, script: 0x5, flags: 0x0}, + 124: {region: 0x98, script: 0x20, flags: 0x0}, + 125: {region: 0x37, script: 0x1e, flags: 0x0}, + 126: {region: 0x98, script: 0x20, flags: 0x0}, + 127: {region: 0xe7, script: 0x5, flags: 0x0}, + 128: {region: 0x12a, script: 0x2d, flags: 0x0}, + 130: {region: 0x98, script: 0x20, flags: 0x0}, + 131: {region: 0x164, script: 0x52, flags: 0x0}, + 132: {region: 0x98, script: 0x20, flags: 0x0}, + 133: {region: 0xe6, script: 0x52, flags: 0x0}, + 134: {region: 0x164, script: 0x52, flags: 0x0}, + 135: {region: 0x98, script: 0x20, flags: 0x0}, + 136: {region: 0x164, script: 0x52, flags: 0x0}, + 137: {region: 0x13e, script: 0x52, flags: 0x0}, + 138: {region: 0x164, script: 0x52, flags: 0x0}, + 139: {region: 0x164, script: 0x52, flags: 0x0}, + 140: {region: 0xe6, script: 0x52, flags: 0x0}, + 141: {region: 0x164, script: 0x52, flags: 0x0}, + 142: {region: 0xd5, script: 0x52, flags: 0x0}, + 143: {region: 0x164, script: 0x52, flags: 0x0}, + 144: {region: 0x164, script: 0x52, flags: 0x0}, + 145: {region: 0x164, script: 0x52, flags: 0x0}, + 146: {region: 0x164, script: 0x27, flags: 0x0}, + 147: {region: 0x98, script: 0x20, flags: 0x0}, + 148: {region: 0x94, script: 0x52, flags: 0x0}, + 149: {region: 0x164, script: 0x52, flags: 0x0}, + 150: {region: 0x164, script: 0x52, flags: 0x0}, + 151: {region: 0x164, script: 0x52, flags: 0x0}, + 152: {region: 0x164, script: 0x52, flags: 0x0}, + 153: {region: 0x51, script: 0x52, flags: 0x0}, + 154: {region: 0x164, script: 0x52, flags: 0x0}, + 155: {region: 0xe6, script: 0x52, flags: 0x0}, + 156: {region: 0x164, script: 0x52, flags: 0x0}, + 157: {region: 0x13d, script: 0xcf, flags: 0x0}, + 158: {region: 0xc2, script: 0x52, flags: 0x0}, + 159: {region: 0x164, script: 0x52, flags: 0x0}, + 160: {region: 0x164, script: 0x52, flags: 0x0}, + 161: {region: 0xc2, script: 0x52, flags: 0x0}, + 162: {region: 0x164, script: 0x52, flags: 0x0}, + 163: {region: 0x34, script: 0xe, flags: 0x0}, + 164: {region: 0x164, script: 0x52, flags: 0x0}, + 165: {region: 0x164, script: 0x52, flags: 0x0}, + 166: {region: 0x164, script: 0x52, flags: 0x0}, + 167: {region: 0x52, script: 0xd6, flags: 0x0}, + 168: {region: 0x164, script: 0x52, flags: 0x0}, + 169: {region: 0x164, script: 0x52, flags: 0x0}, + 170: {region: 0x164, script: 0x52, flags: 0x0}, + 171: {region: 0x98, script: 0xe, flags: 0x0}, + 172: {region: 0x164, script: 0x52, flags: 0x0}, + 173: {region: 0x9b, script: 0x5, flags: 0x0}, + 174: {region: 0x164, script: 0x52, flags: 0x0}, + 175: {region: 0x4e, script: 0x52, flags: 0x0}, + 176: {region: 0x77, script: 0x52, flags: 0x0}, + 177: {region: 0x98, script: 0x20, flags: 0x0}, + 178: {region: 0xe7, script: 0x5, flags: 0x0}, + 179: {region: 0x98, script: 0x20, flags: 0x0}, + 180: {region: 0x164, script: 0x52, flags: 0x0}, + 181: {region: 0x32, script: 0x52, flags: 0x0}, + 182: {region: 0x164, script: 0x52, flags: 0x0}, + 183: {region: 0xb3, script: 0xc, flags: 0x0}, + 184: {region: 0x51, script: 0x52, flags: 0x0}, + 185: {region: 0x164, script: 0x27, flags: 0x0}, + 186: {region: 0xe6, script: 0x52, flags: 0x0}, + 187: {region: 0x164, script: 0x52, flags: 0x0}, + 188: {region: 0xe7, script: 0x20, flags: 0x0}, + 189: {region: 0x105, script: 0x1e, flags: 0x0}, + 190: {region: 0x15e, script: 0x52, flags: 0x0}, + 191: {region: 0x164, script: 0x52, flags: 0x0}, + 192: {region: 0x94, script: 0x52, flags: 0x0}, + 193: {region: 0x164, script: 0x52, flags: 0x0}, + 194: {region: 0x51, script: 0x52, flags: 0x0}, + 195: {region: 0x164, script: 0x52, flags: 0x0}, + 196: {region: 0x164, script: 0x52, flags: 0x0}, + 197: {region: 0x164, script: 0x52, flags: 0x0}, + 198: {region: 0x85, script: 0x52, flags: 0x0}, + 199: {region: 0x164, script: 0x52, flags: 0x0}, + 200: {region: 0x164, script: 0x52, flags: 0x0}, + 201: {region: 0x164, script: 0x52, flags: 0x0}, + 202: {region: 0x164, script: 0x52, flags: 0x0}, + 203: {region: 0x6c, script: 0x27, flags: 0x0}, + 204: {region: 0x164, script: 0x52, flags: 0x0}, + 205: {region: 0x164, script: 0x52, flags: 0x0}, + 206: {region: 0x51, script: 0x52, flags: 0x0}, + 207: {region: 0x164, script: 0x52, flags: 0x0}, + 208: {region: 0x164, script: 0x52, flags: 0x0}, + 209: {region: 0xc2, script: 0x52, flags: 0x0}, + 210: {region: 0x164, script: 0x52, flags: 0x0}, + 211: {region: 0x164, script: 0x52, flags: 0x0}, + 212: {region: 0x164, script: 0x52, flags: 0x0}, + 213: {region: 0x6d, script: 0x52, flags: 0x0}, + 214: {region: 0x164, script: 0x52, flags: 0x0}, + 215: {region: 0x164, script: 0x52, flags: 0x0}, + 216: {region: 0xd5, script: 0x52, flags: 0x0}, + 217: {region: 0x8, script: 0x2, flags: 0x1}, + 218: {region: 0x105, script: 0x1e, flags: 0x0}, + 219: {region: 0xe6, script: 0x52, flags: 0x0}, + 220: {region: 0x164, script: 0x52, flags: 0x0}, + 221: {region: 0x130, script: 0x52, flags: 0x0}, + 222: {region: 0x89, script: 0x52, flags: 0x0}, + 223: {region: 0x74, script: 0x52, flags: 0x0}, + 224: {region: 0x105, script: 0x1e, flags: 0x0}, + 225: {region: 0x134, script: 0x52, flags: 0x0}, + 226: {region: 0x48, script: 0x52, flags: 0x0}, + 227: {region: 0x134, script: 0x1a, flags: 0x0}, + 228: {region: 0xa5, script: 0x5, flags: 0x0}, + 229: {region: 0x13d, script: 0x19, flags: 0x0}, + 230: {region: 0x164, script: 0x52, flags: 0x0}, + 231: {region: 0x9a, script: 0x5, flags: 0x0}, + 232: {region: 0x164, script: 0x52, flags: 0x0}, + 233: {region: 0x164, script: 0x52, flags: 0x0}, + 234: {region: 0x164, script: 0x52, flags: 0x0}, + 235: {region: 0x164, script: 0x52, flags: 0x0}, + 236: {region: 0x164, script: 0x52, flags: 0x0}, + 237: {region: 0x77, script: 0x52, flags: 0x0}, + 238: {region: 0x6a, script: 0x1c, flags: 0x0}, + 239: {region: 0xe6, script: 0x52, flags: 0x0}, + 240: {region: 0x48, script: 0x17, flags: 0x0}, + 241: {region: 0x48, script: 0x17, flags: 0x0}, + 242: {region: 0x48, script: 0x17, flags: 0x0}, + 243: {region: 0x48, script: 0x17, flags: 0x0}, + 244: {region: 0x48, script: 0x17, flags: 0x0}, + 245: {region: 0x109, script: 0x52, flags: 0x0}, + 246: {region: 0x5d, script: 0x52, flags: 0x0}, + 247: {region: 0xe8, script: 0x52, flags: 0x0}, + 248: {region: 0x48, script: 0x17, flags: 0x0}, + 249: {region: 0xc3, script: 0x79, flags: 0x0}, + 250: {region: 0xa, script: 0x2, flags: 0x1}, + 251: {region: 0x105, script: 0x1e, flags: 0x0}, + 252: {region: 0x7a, script: 0x52, flags: 0x0}, + 253: {region: 0x62, script: 0x52, flags: 0x0}, + 254: {region: 0x164, script: 0x52, flags: 0x0}, + 255: {region: 0x164, script: 0x52, flags: 0x0}, + 256: {region: 0x164, script: 0x52, flags: 0x0}, + 257: {region: 0x164, script: 0x52, flags: 0x0}, + 258: {region: 0x134, script: 0x52, flags: 0x0}, + 259: {region: 0x105, script: 0x1e, flags: 0x0}, + 260: {region: 0xa3, script: 0x52, flags: 0x0}, + 261: {region: 0x164, script: 0x52, flags: 0x0}, + 262: {region: 0x164, script: 0x52, flags: 0x0}, + 263: {region: 0x98, script: 0x5, flags: 0x0}, + 264: {region: 0x164, script: 0x52, flags: 0x0}, + 265: {region: 0x5f, script: 0x52, flags: 0x0}, + 266: {region: 0x164, script: 0x52, flags: 0x0}, + 267: {region: 0x48, script: 0x52, flags: 0x0}, + 268: {region: 0x164, script: 0x52, flags: 0x0}, + 269: {region: 0x164, script: 0x52, flags: 0x0}, + 270: {region: 0x164, script: 0x52, flags: 0x0}, + 271: {region: 0x164, script: 0x5, flags: 0x0}, + 272: {region: 0x48, script: 0x52, flags: 0x0}, + 273: {region: 0x164, script: 0x52, flags: 0x0}, + 274: {region: 0x164, script: 0x52, flags: 0x0}, + 275: {region: 0xd3, script: 0x52, flags: 0x0}, + 276: {region: 0x4e, script: 0x52, flags: 0x0}, + 277: {region: 0x164, script: 0x52, flags: 0x0}, + 278: {region: 0x98, script: 0x5, flags: 0x0}, + 279: {region: 0x164, script: 0x52, flags: 0x0}, + 280: {region: 0x164, script: 0x52, flags: 0x0}, + 281: {region: 0x164, script: 0x52, flags: 0x0}, + 282: {region: 0x164, script: 0x27, flags: 0x0}, + 283: {region: 0x5f, script: 0x52, flags: 0x0}, + 284: {region: 0xc2, script: 0x52, flags: 0x0}, + 285: {region: 0xcf, script: 0x52, flags: 0x0}, + 286: {region: 0x164, script: 0x52, flags: 0x0}, + 287: {region: 0xda, script: 0x20, flags: 0x0}, + 288: {region: 0x51, script: 0x52, flags: 0x0}, + 289: {region: 0x164, script: 0x52, flags: 0x0}, + 290: {region: 0x164, script: 0x52, flags: 0x0}, + 291: {region: 0x164, script: 0x52, flags: 0x0}, + 292: {region: 0xcc, script: 0xd4, flags: 0x0}, + 293: {region: 0x164, script: 0x52, flags: 0x0}, + 294: {region: 0x164, script: 0x52, flags: 0x0}, + 295: {region: 0x113, script: 0x52, flags: 0x0}, + 296: {region: 0x36, script: 0x52, flags: 0x0}, + 297: {region: 0x42, script: 0xd6, flags: 0x0}, + 298: {region: 0x164, script: 0x52, flags: 0x0}, + 299: {region: 0xa3, script: 0x52, flags: 0x0}, + 300: {region: 0x7f, script: 0x52, flags: 0x0}, + 301: {region: 0xd5, script: 0x52, flags: 0x0}, + 302: {region: 0x9d, script: 0x52, flags: 0x0}, + 303: {region: 0x6a, script: 0x25, flags: 0x0}, + 304: {region: 0xc3, script: 0x43, flags: 0x0}, + 305: {region: 0x86, script: 0x2d, flags: 0x0}, + 306: {region: 0x164, script: 0x52, flags: 0x0}, + 307: {region: 0x164, script: 0x52, flags: 0x0}, + 308: {region: 0xc, script: 0x2, flags: 0x1}, + 309: {region: 0x164, script: 0x52, flags: 0x0}, + 310: {region: 0x164, script: 0x52, flags: 0x0}, + 311: {region: 0x1, script: 0x52, flags: 0x0}, + 312: {region: 0x164, script: 0x52, flags: 0x0}, + 313: {region: 0x6d, script: 0x52, flags: 0x0}, + 314: {region: 0x134, script: 0x52, flags: 0x0}, + 315: {region: 0x69, script: 0x52, flags: 0x0}, + 316: {region: 0x164, script: 0x52, flags: 0x0}, + 317: {region: 0x9d, script: 0x3e, flags: 0x0}, + 318: {region: 0x164, script: 0x52, flags: 0x0}, + 319: {region: 0x164, script: 0x52, flags: 0x0}, + 320: {region: 0x6d, script: 0x52, flags: 0x0}, + 321: {region: 0x51, script: 0x52, flags: 0x0}, + 322: {region: 0x6d, script: 0x52, flags: 0x0}, + 323: {region: 0x9b, script: 0x5, flags: 0x0}, + 324: {region: 0x164, script: 0x52, flags: 0x0}, + 325: {region: 0x164, script: 0x52, flags: 0x0}, + 326: {region: 0x164, script: 0x52, flags: 0x0}, + 327: {region: 0x164, script: 0x52, flags: 0x0}, + 328: {region: 0x85, script: 0x52, flags: 0x0}, + 329: {region: 0xe, script: 0x2, flags: 0x1}, + 330: {region: 0x164, script: 0x52, flags: 0x0}, + 331: {region: 0xc2, script: 0x52, flags: 0x0}, + 332: {region: 0x71, script: 0x52, flags: 0x0}, + 333: {region: 0x10a, script: 0x5, flags: 0x0}, + 334: {region: 0xe6, script: 0x52, flags: 0x0}, + 335: {region: 0x10b, script: 0x52, flags: 0x0}, + 336: {region: 0x72, script: 0x52, flags: 0x0}, + 337: {region: 0x164, script: 0x52, flags: 0x0}, + 338: {region: 0x164, script: 0x52, flags: 0x0}, + 339: {region: 0x75, script: 0x52, flags: 0x0}, + 340: {region: 0x164, script: 0x52, flags: 0x0}, + 341: {region: 0x3a, script: 0x52, flags: 0x0}, + 342: {region: 0x164, script: 0x52, flags: 0x0}, + 343: {region: 0x164, script: 0x52, flags: 0x0}, + 344: {region: 0x164, script: 0x52, flags: 0x0}, + 345: {region: 0x77, script: 0x52, flags: 0x0}, + 346: {region: 0x134, script: 0x52, flags: 0x0}, + 347: {region: 0x77, script: 0x52, flags: 0x0}, + 348: {region: 0x5f, script: 0x52, flags: 0x0}, + 349: {region: 0x5f, script: 0x52, flags: 0x0}, + 350: {region: 0x51, script: 0x5, flags: 0x0}, + 351: {region: 0x13f, script: 0x52, flags: 0x0}, + 352: {region: 0x164, script: 0x52, flags: 0x0}, + 353: {region: 0x83, script: 0x52, flags: 0x0}, + 354: {region: 0x164, script: 0x52, flags: 0x0}, + 355: {region: 0xd3, script: 0x52, flags: 0x0}, + 356: {region: 0x9d, script: 0x52, flags: 0x0}, + 357: {region: 0xd5, script: 0x52, flags: 0x0}, + 358: {region: 0x164, script: 0x52, flags: 0x0}, + 359: {region: 0x10a, script: 0x52, flags: 0x0}, + 360: {region: 0xd8, script: 0x52, flags: 0x0}, + 361: {region: 0x95, script: 0x52, flags: 0x0}, + 362: {region: 0x7f, script: 0x52, flags: 0x0}, + 363: {region: 0x164, script: 0x52, flags: 0x0}, + 364: {region: 0xbb, script: 0x52, flags: 0x0}, + 365: {region: 0x164, script: 0x52, flags: 0x0}, + 366: {region: 0x164, script: 0x52, flags: 0x0}, + 367: {region: 0x164, script: 0x52, flags: 0x0}, + 368: {region: 0x52, script: 0x34, flags: 0x0}, + 369: {region: 0x164, script: 0x52, flags: 0x0}, + 370: {region: 0x94, script: 0x52, flags: 0x0}, + 371: {region: 0x164, script: 0x52, flags: 0x0}, + 372: {region: 0x98, script: 0x20, flags: 0x0}, + 373: {region: 0x164, script: 0x52, flags: 0x0}, + 374: {region: 0x9b, script: 0x5, flags: 0x0}, + 375: {region: 0x7d, script: 0x52, flags: 0x0}, + 376: {region: 0x7a, script: 0x52, flags: 0x0}, + 377: {region: 0x164, script: 0x52, flags: 0x0}, + 378: {region: 0x164, script: 0x52, flags: 0x0}, + 379: {region: 0x164, script: 0x52, flags: 0x0}, + 380: {region: 0x164, script: 0x52, flags: 0x0}, + 381: {region: 0x164, script: 0x52, flags: 0x0}, + 382: {region: 0x164, script: 0x52, flags: 0x0}, + 383: {region: 0x6e, script: 0x27, flags: 0x0}, + 384: {region: 0x164, script: 0x52, flags: 0x0}, + 385: {region: 0xda, script: 0x20, flags: 0x0}, + 386: {region: 0x164, script: 0x52, flags: 0x0}, + 387: {region: 0xa6, script: 0x52, flags: 0x0}, + 388: {region: 0x164, script: 0x52, flags: 0x0}, + 389: {region: 0xe7, script: 0x5, flags: 0x0}, + 390: {region: 0x164, script: 0x52, flags: 0x0}, + 391: {region: 0xe7, script: 0x5, flags: 0x0}, + 392: {region: 0x164, script: 0x52, flags: 0x0}, + 393: {region: 0x164, script: 0x52, flags: 0x0}, + 394: {region: 0x6d, script: 0x52, flags: 0x0}, + 395: {region: 0x9b, script: 0x5, flags: 0x0}, + 396: {region: 0x164, script: 0x52, flags: 0x0}, + 397: {region: 0x164, script: 0x27, flags: 0x0}, + 398: {region: 0xf0, script: 0x52, flags: 0x0}, + 399: {region: 0x164, script: 0x52, flags: 0x0}, + 400: {region: 0x164, script: 0x52, flags: 0x0}, + 401: {region: 0x164, script: 0x52, flags: 0x0}, + 402: {region: 0x164, script: 0x27, flags: 0x0}, + 403: {region: 0x164, script: 0x52, flags: 0x0}, + 404: {region: 0x98, script: 0x20, flags: 0x0}, + 405: {region: 0x98, script: 0xd0, flags: 0x0}, + 406: {region: 0x94, script: 0x52, flags: 0x0}, + 407: {region: 0xd8, script: 0x52, flags: 0x0}, + 408: {region: 0x12f, script: 0x2b, flags: 0x0}, + 409: {region: 0x10, script: 0x2, flags: 0x1}, + 410: {region: 0x98, script: 0xe, flags: 0x0}, + 411: {region: 0x164, script: 0x52, flags: 0x0}, + 412: {region: 0x4d, script: 0x52, flags: 0x0}, + 413: {region: 0x98, script: 0x2e, flags: 0x0}, + 414: {region: 0x40, script: 0x52, flags: 0x0}, + 415: {region: 0x53, script: 0x52, flags: 0x0}, + 416: {region: 0x164, script: 0x52, flags: 0x0}, + 417: {region: 0x7f, script: 0x52, flags: 0x0}, + 418: {region: 0x164, script: 0x52, flags: 0x0}, + 419: {region: 0x164, script: 0x52, flags: 0x0}, + 420: {region: 0xa3, script: 0x52, flags: 0x0}, + 421: {region: 0x97, script: 0x52, flags: 0x0}, + 422: {region: 0x164, script: 0x52, flags: 0x0}, + 423: {region: 0xda, script: 0x20, flags: 0x0}, + 424: {region: 0x164, script: 0x52, flags: 0x0}, + 425: {region: 0x164, script: 0x5, flags: 0x0}, + 426: {region: 0x48, script: 0x52, flags: 0x0}, + 427: {region: 0x164, script: 0x5, flags: 0x0}, + 428: {region: 0x164, script: 0x52, flags: 0x0}, + 429: {region: 0x12, script: 0x3, flags: 0x1}, + 430: {region: 0x164, script: 0x52, flags: 0x0}, + 431: {region: 0x52, script: 0x34, flags: 0x0}, + 432: {region: 0x164, script: 0x52, flags: 0x0}, + 433: {region: 0x134, script: 0x52, flags: 0x0}, + 434: {region: 0x23, script: 0x5, flags: 0x0}, + 435: {region: 0x164, script: 0x52, flags: 0x0}, + 436: {region: 0x164, script: 0x27, flags: 0x0}, + 437: {region: 0x96, script: 0x37, flags: 0x0}, + 438: {region: 0x164, script: 0x52, flags: 0x0}, + 439: {region: 0x98, script: 0x20, flags: 0x0}, + 440: {region: 0x164, script: 0x52, flags: 0x0}, + 441: {region: 0x72, script: 0x52, flags: 0x0}, + 442: {region: 0x164, script: 0x52, flags: 0x0}, + 443: {region: 0x164, script: 0x52, flags: 0x0}, + 444: {region: 0xe6, script: 0x52, flags: 0x0}, + 445: {region: 0x164, script: 0x52, flags: 0x0}, + 446: {region: 0x12a, script: 0x39, flags: 0x0}, + 447: {region: 0x52, script: 0x81, flags: 0x0}, + 448: {region: 0x164, script: 0x52, flags: 0x0}, + 449: {region: 0xe7, script: 0x5, flags: 0x0}, + 450: {region: 0x98, script: 0x20, flags: 0x0}, + 451: {region: 0xae, script: 0x3a, flags: 0x0}, + 452: {region: 0xe6, script: 0x52, flags: 0x0}, + 453: {region: 0xe7, script: 0x5, flags: 0x0}, + 454: {region: 0xe5, script: 0x52, flags: 0x0}, + 455: {region: 0x98, script: 0x20, flags: 0x0}, + 456: {region: 0x98, script: 0x20, flags: 0x0}, + 457: {region: 0x164, script: 0x52, flags: 0x0}, + 458: {region: 0x8f, script: 0x52, flags: 0x0}, + 459: {region: 0x5f, script: 0x52, flags: 0x0}, + 460: {region: 0x52, script: 0x34, flags: 0x0}, + 461: {region: 0x90, script: 0x52, flags: 0x0}, + 462: {region: 0x91, script: 0x52, flags: 0x0}, + 463: {region: 0x164, script: 0x52, flags: 0x0}, + 464: {region: 0x27, script: 0x8, flags: 0x0}, + 465: {region: 0xd1, script: 0x52, flags: 0x0}, + 466: {region: 0x77, script: 0x52, flags: 0x0}, + 467: {region: 0x164, script: 0x52, flags: 0x0}, + 468: {region: 0x164, script: 0x52, flags: 0x0}, + 469: {region: 0xcf, script: 0x52, flags: 0x0}, + 470: {region: 0xd5, script: 0x52, flags: 0x0}, + 471: {region: 0x164, script: 0x52, flags: 0x0}, + 472: {region: 0x164, script: 0x52, flags: 0x0}, + 473: {region: 0x164, script: 0x52, flags: 0x0}, + 474: {region: 0x94, script: 0x52, flags: 0x0}, + 475: {region: 0x164, script: 0x52, flags: 0x0}, + 476: {region: 0x164, script: 0x52, flags: 0x0}, + 477: {region: 0x164, script: 0x52, flags: 0x0}, + 479: {region: 0xd5, script: 0x52, flags: 0x0}, + 480: {region: 0x164, script: 0x52, flags: 0x0}, + 481: {region: 0x164, script: 0x52, flags: 0x0}, + 482: {region: 0x52, script: 0xdf, flags: 0x0}, + 483: {region: 0x164, script: 0x52, flags: 0x0}, + 484: {region: 0x134, script: 0x52, flags: 0x0}, + 485: {region: 0x164, script: 0x52, flags: 0x0}, + 486: {region: 0x48, script: 0x52, flags: 0x0}, + 487: {region: 0x164, script: 0x52, flags: 0x0}, + 488: {region: 0x164, script: 0x52, flags: 0x0}, + 489: {region: 0xe6, script: 0x52, flags: 0x0}, + 490: {region: 0x164, script: 0x52, flags: 0x0}, + 491: {region: 0x94, script: 0x52, flags: 0x0}, + 492: {region: 0x105, script: 0x1e, flags: 0x0}, + 494: {region: 0x164, script: 0x52, flags: 0x0}, + 495: {region: 0x164, script: 0x52, flags: 0x0}, + 496: {region: 0x9c, script: 0x52, flags: 0x0}, + 497: {region: 0x9d, script: 0x52, flags: 0x0}, + 498: {region: 0x48, script: 0x17, flags: 0x0}, + 499: {region: 0x96, script: 0x37, flags: 0x0}, + 500: {region: 0x164, script: 0x52, flags: 0x0}, + 501: {region: 0x164, script: 0x52, flags: 0x0}, + 502: {region: 0x105, script: 0x52, flags: 0x0}, + 503: {region: 0x164, script: 0x52, flags: 0x0}, + 504: {region: 0xa1, script: 0x41, flags: 0x0}, + 505: {region: 0x164, script: 0x52, flags: 0x0}, + 506: {region: 0x9f, script: 0x52, flags: 0x0}, + 508: {region: 0x164, script: 0x52, flags: 0x0}, + 509: {region: 0x164, script: 0x52, flags: 0x0}, + 510: {region: 0x164, script: 0x52, flags: 0x0}, + 511: {region: 0x51, script: 0x52, flags: 0x0}, + 512: {region: 0x12f, script: 0x37, flags: 0x0}, + 513: {region: 0x164, script: 0x52, flags: 0x0}, + 514: {region: 0x12e, script: 0x52, flags: 0x0}, + 515: {region: 0xda, script: 0x20, flags: 0x0}, + 516: {region: 0x164, script: 0x52, flags: 0x0}, + 517: {region: 0x62, script: 0x52, flags: 0x0}, + 518: {region: 0x94, script: 0x52, flags: 0x0}, + 519: {region: 0x94, script: 0x52, flags: 0x0}, + 520: {region: 0x7c, script: 0x29, flags: 0x0}, + 521: {region: 0x136, script: 0x1e, flags: 0x0}, + 522: {region: 0x66, script: 0x52, flags: 0x0}, + 523: {region: 0xc3, script: 0x52, flags: 0x0}, + 524: {region: 0x164, script: 0x52, flags: 0x0}, + 525: {region: 0x164, script: 0x52, flags: 0x0}, + 526: {region: 0xd5, script: 0x52, flags: 0x0}, + 527: {region: 0xa3, script: 0x52, flags: 0x0}, + 528: {region: 0xc2, script: 0x52, flags: 0x0}, + 529: {region: 0x105, script: 0x1e, flags: 0x0}, + 530: {region: 0x164, script: 0x52, flags: 0x0}, + 531: {region: 0x164, script: 0x52, flags: 0x0}, + 532: {region: 0x164, script: 0x52, flags: 0x0}, + 533: {region: 0x164, script: 0x52, flags: 0x0}, + 534: {region: 0xd3, script: 0x5, flags: 0x0}, + 535: {region: 0xd5, script: 0x52, flags: 0x0}, + 536: {region: 0x163, script: 0x52, flags: 0x0}, + 537: {region: 0x164, script: 0x52, flags: 0x0}, + 538: {region: 0x164, script: 0x52, flags: 0x0}, + 539: {region: 0x12e, script: 0x52, flags: 0x0}, + 540: {region: 0x121, script: 0x5, flags: 0x0}, + 541: {region: 0x164, script: 0x52, flags: 0x0}, + 542: {region: 0x122, script: 0xd5, flags: 0x0}, + 543: {region: 0x59, script: 0x52, flags: 0x0}, + 544: {region: 0x51, script: 0x52, flags: 0x0}, + 545: {region: 0x164, script: 0x52, flags: 0x0}, + 546: {region: 0x4e, script: 0x52, flags: 0x0}, + 547: {region: 0x98, script: 0x20, flags: 0x0}, + 548: {region: 0x98, script: 0x20, flags: 0x0}, + 549: {region: 0x4a, script: 0x52, flags: 0x0}, + 550: {region: 0x94, script: 0x52, flags: 0x0}, + 551: {region: 0x164, script: 0x52, flags: 0x0}, + 552: {region: 0x40, script: 0x52, flags: 0x0}, + 553: {region: 0x98, script: 0x52, flags: 0x0}, + 554: {region: 0x52, script: 0xcc, flags: 0x0}, + 555: {region: 0x98, script: 0x20, flags: 0x0}, + 556: {region: 0xc2, script: 0x52, flags: 0x0}, + 557: {region: 0x164, script: 0x52, flags: 0x0}, + 558: {region: 0x98, script: 0x6b, flags: 0x0}, + 559: {region: 0xe7, script: 0x5, flags: 0x0}, + 560: {region: 0x164, script: 0x52, flags: 0x0}, + 561: {region: 0xa3, script: 0x52, flags: 0x0}, + 562: {region: 0x164, script: 0x52, flags: 0x0}, + 563: {region: 0x12a, script: 0x52, flags: 0x0}, + 564: {region: 0x164, script: 0x52, flags: 0x0}, + 565: {region: 0xd1, script: 0x52, flags: 0x0}, + 566: {region: 0x164, script: 0x52, flags: 0x0}, + 567: {region: 0xae, script: 0x4f, flags: 0x0}, + 568: {region: 0x164, script: 0x52, flags: 0x0}, + 569: {region: 0x164, script: 0x52, flags: 0x0}, + 570: {region: 0x15, script: 0x6, flags: 0x1}, + 571: {region: 0x164, script: 0x52, flags: 0x0}, + 572: {region: 0x51, script: 0x52, flags: 0x0}, + 573: {region: 0x81, script: 0x52, flags: 0x0}, + 574: {region: 0xa3, script: 0x52, flags: 0x0}, + 575: {region: 0x164, script: 0x52, flags: 0x0}, + 576: {region: 0x164, script: 0x52, flags: 0x0}, + 577: {region: 0x164, script: 0x52, flags: 0x0}, + 578: {region: 0xa5, script: 0x46, flags: 0x0}, + 579: {region: 0x29, script: 0x52, flags: 0x0}, + 580: {region: 0x164, script: 0x52, flags: 0x0}, + 581: {region: 0x164, script: 0x52, flags: 0x0}, + 582: {region: 0x164, script: 0x52, flags: 0x0}, + 583: {region: 0x164, script: 0x52, flags: 0x0}, + 584: {region: 0x164, script: 0x52, flags: 0x0}, + 585: {region: 0x98, script: 0x4a, flags: 0x0}, + 586: {region: 0x164, script: 0x52, flags: 0x0}, + 587: {region: 0xaa, script: 0x4b, flags: 0x0}, + 588: {region: 0x105, script: 0x1e, flags: 0x0}, + 589: {region: 0x98, script: 0x20, flags: 0x0}, + 590: {region: 0x164, script: 0x52, flags: 0x0}, + 591: {region: 0x74, script: 0x52, flags: 0x0}, + 592: {region: 0x164, script: 0x52, flags: 0x0}, + 593: {region: 0xb3, script: 0x52, flags: 0x0}, + 594: {region: 0x164, script: 0x52, flags: 0x0}, + 595: {region: 0x164, script: 0x52, flags: 0x0}, + 596: {region: 0x164, script: 0x52, flags: 0x0}, + 597: {region: 0x164, script: 0x52, flags: 0x0}, + 598: {region: 0x164, script: 0x52, flags: 0x0}, + 599: {region: 0x164, script: 0x52, flags: 0x0}, + 600: {region: 0x164, script: 0x52, flags: 0x0}, + 601: {region: 0x164, script: 0x27, flags: 0x0}, + 603: {region: 0x105, script: 0x1e, flags: 0x0}, + 604: {region: 0x111, script: 0x52, flags: 0x0}, + 605: {region: 0xe6, script: 0x52, flags: 0x0}, + 606: {region: 0x105, script: 0x52, flags: 0x0}, + 607: {region: 0x164, script: 0x52, flags: 0x0}, + 608: {region: 0x98, script: 0x20, flags: 0x0}, + 609: {region: 0x98, script: 0x5, flags: 0x0}, + 610: {region: 0x12e, script: 0x52, flags: 0x0}, + 611: {region: 0x164, script: 0x52, flags: 0x0}, + 612: {region: 0x51, script: 0x52, flags: 0x0}, + 613: {region: 0x5f, script: 0x52, flags: 0x0}, + 614: {region: 0x164, script: 0x52, flags: 0x0}, + 615: {region: 0x164, script: 0x52, flags: 0x0}, + 616: {region: 0x164, script: 0x27, flags: 0x0}, + 617: {region: 0x164, script: 0x52, flags: 0x0}, + 618: {region: 0x164, script: 0x52, flags: 0x0}, + 619: {region: 0x1b, script: 0x3, flags: 0x1}, + 620: {region: 0x164, script: 0x52, flags: 0x0}, + 621: {region: 0x164, script: 0x52, flags: 0x0}, + 622: {region: 0x164, script: 0x52, flags: 0x0}, + 623: {region: 0x164, script: 0x52, flags: 0x0}, + 624: {region: 0x105, script: 0x1e, flags: 0x0}, + 625: {region: 0x164, script: 0x52, flags: 0x0}, + 626: {region: 0x164, script: 0x52, flags: 0x0}, + 627: {region: 0x164, script: 0x52, flags: 0x0}, + 628: {region: 0x105, script: 0x1e, flags: 0x0}, + 629: {region: 0x164, script: 0x52, flags: 0x0}, + 630: {region: 0x94, script: 0x52, flags: 0x0}, + 631: {region: 0xe7, script: 0x5, flags: 0x0}, + 632: {region: 0x7a, script: 0x52, flags: 0x0}, + 633: {region: 0x164, script: 0x52, flags: 0x0}, + 634: {region: 0x164, script: 0x52, flags: 0x0}, + 635: {region: 0x164, script: 0x52, flags: 0x0}, + 636: {region: 0x164, script: 0x27, flags: 0x0}, + 637: {region: 0x122, script: 0xd5, flags: 0x0}, + 638: {region: 0xe7, script: 0x5, flags: 0x0}, + 639: {region: 0x164, script: 0x52, flags: 0x0}, + 640: {region: 0x164, script: 0x52, flags: 0x0}, + 641: {region: 0x1e, script: 0x5, flags: 0x1}, + 642: {region: 0x164, script: 0x52, flags: 0x0}, + 643: {region: 0x164, script: 0x52, flags: 0x0}, + 644: {region: 0x164, script: 0x52, flags: 0x0}, + 645: {region: 0x137, script: 0x52, flags: 0x0}, + 646: {region: 0x86, script: 0x56, flags: 0x0}, + 647: {region: 0x96, script: 0x37, flags: 0x0}, + 648: {region: 0x12e, script: 0x52, flags: 0x0}, + 649: {region: 0xe7, script: 0x5, flags: 0x0}, + 650: {region: 0x130, script: 0x52, flags: 0x0}, + 651: {region: 0x164, script: 0x52, flags: 0x0}, + 652: {region: 0xb6, script: 0x52, flags: 0x0}, + 653: {region: 0x105, script: 0x1e, flags: 0x0}, + 654: {region: 0x164, script: 0x52, flags: 0x0}, + 655: {region: 0x94, script: 0x52, flags: 0x0}, + 656: {region: 0x164, script: 0x52, flags: 0x0}, + 657: {region: 0x52, script: 0xd5, flags: 0x0}, + 658: {region: 0x164, script: 0x52, flags: 0x0}, + 659: {region: 0x164, script: 0x52, flags: 0x0}, + 660: {region: 0x164, script: 0x52, flags: 0x0}, + 661: {region: 0x164, script: 0x52, flags: 0x0}, + 662: {region: 0x98, script: 0x54, flags: 0x0}, + 663: {region: 0x164, script: 0x52, flags: 0x0}, + 664: {region: 0x164, script: 0x52, flags: 0x0}, + 665: {region: 0x105, script: 0x1e, flags: 0x0}, + 666: {region: 0x130, script: 0x52, flags: 0x0}, + 667: {region: 0x164, script: 0x52, flags: 0x0}, + 668: {region: 0xd8, script: 0x52, flags: 0x0}, + 669: {region: 0x164, script: 0x52, flags: 0x0}, + 670: {region: 0x164, script: 0x52, flags: 0x0}, + 671: {region: 0x23, script: 0x2, flags: 0x1}, + 672: {region: 0x164, script: 0x52, flags: 0x0}, + 673: {region: 0x164, script: 0x52, flags: 0x0}, + 674: {region: 0x9d, script: 0x52, flags: 0x0}, + 675: {region: 0x52, script: 0x58, flags: 0x0}, + 676: {region: 0x94, script: 0x52, flags: 0x0}, + 677: {region: 0x9b, script: 0x5, flags: 0x0}, + 678: {region: 0x134, script: 0x52, flags: 0x0}, + 679: {region: 0x164, script: 0x52, flags: 0x0}, + 680: {region: 0x164, script: 0x52, flags: 0x0}, + 681: {region: 0x98, script: 0xd0, flags: 0x0}, + 682: {region: 0x9d, script: 0x52, flags: 0x0}, + 683: {region: 0x164, script: 0x52, flags: 0x0}, + 684: {region: 0x4a, script: 0x52, flags: 0x0}, + 685: {region: 0x164, script: 0x52, flags: 0x0}, + 686: {region: 0x164, script: 0x52, flags: 0x0}, + 687: {region: 0xae, script: 0x4f, flags: 0x0}, + 688: {region: 0x164, script: 0x52, flags: 0x0}, + 689: {region: 0x164, script: 0x52, flags: 0x0}, + 690: {region: 0x4a, script: 0x52, flags: 0x0}, + 691: {region: 0x164, script: 0x52, flags: 0x0}, + 692: {region: 0x164, script: 0x52, flags: 0x0}, + 693: {region: 0x161, script: 0x52, flags: 0x0}, + 694: {region: 0x9b, script: 0x5, flags: 0x0}, + 695: {region: 0xb5, script: 0x52, flags: 0x0}, + 696: {region: 0xb7, script: 0x52, flags: 0x0}, + 697: {region: 0x4a, script: 0x52, flags: 0x0}, + 698: {region: 0x4a, script: 0x52, flags: 0x0}, + 699: {region: 0xa3, script: 0x52, flags: 0x0}, + 700: {region: 0xa3, script: 0x52, flags: 0x0}, + 701: {region: 0x9b, script: 0x5, flags: 0x0}, + 702: {region: 0xb7, script: 0x52, flags: 0x0}, + 703: {region: 0x122, script: 0xd5, flags: 0x0}, + 704: {region: 0x52, script: 0x34, flags: 0x0}, + 705: {region: 0x12a, script: 0x52, flags: 0x0}, + 706: {region: 0x94, script: 0x52, flags: 0x0}, + 707: {region: 0x51, script: 0x52, flags: 0x0}, + 708: {region: 0x98, script: 0x20, flags: 0x0}, + 709: {region: 0x98, script: 0x20, flags: 0x0}, + 710: {region: 0x94, script: 0x52, flags: 0x0}, + 711: {region: 0x25, script: 0x3, flags: 0x1}, + 712: {region: 0xa3, script: 0x52, flags: 0x0}, + 713: {region: 0x164, script: 0x52, flags: 0x0}, + 714: {region: 0xce, script: 0x52, flags: 0x0}, + 715: {region: 0x164, script: 0x52, flags: 0x0}, + 716: {region: 0x164, script: 0x52, flags: 0x0}, + 717: {region: 0x164, script: 0x52, flags: 0x0}, + 718: {region: 0x164, script: 0x52, flags: 0x0}, + 719: {region: 0x164, script: 0x52, flags: 0x0}, + 720: {region: 0x164, script: 0x52, flags: 0x0}, + 721: {region: 0x164, script: 0x52, flags: 0x0}, + 722: {region: 0x164, script: 0x52, flags: 0x0}, + 723: {region: 0x164, script: 0x52, flags: 0x0}, + 724: {region: 0x164, script: 0x52, flags: 0x0}, + 725: {region: 0x164, script: 0x52, flags: 0x0}, + 726: {region: 0x164, script: 0x5, flags: 0x0}, + 727: {region: 0x105, script: 0x1e, flags: 0x0}, + 728: {region: 0xe6, script: 0x52, flags: 0x0}, + 729: {region: 0x164, script: 0x52, flags: 0x0}, + 730: {region: 0x94, script: 0x52, flags: 0x0}, + 731: {region: 0x164, script: 0x27, flags: 0x0}, + 732: {region: 0x164, script: 0x52, flags: 0x0}, + 733: {region: 0x164, script: 0x52, flags: 0x0}, + 734: {region: 0x164, script: 0x52, flags: 0x0}, + 735: {region: 0x111, script: 0x52, flags: 0x0}, + 736: {region: 0xa3, script: 0x52, flags: 0x0}, + 737: {region: 0x164, script: 0x52, flags: 0x0}, + 738: {region: 0x164, script: 0x52, flags: 0x0}, + 739: {region: 0x122, script: 0x5, flags: 0x0}, + 740: {region: 0xcb, script: 0x52, flags: 0x0}, + 741: {region: 0x164, script: 0x52, flags: 0x0}, + 742: {region: 0x164, script: 0x52, flags: 0x0}, + 743: {region: 0x164, script: 0x52, flags: 0x0}, + 744: {region: 0xbe, script: 0x52, flags: 0x0}, + 745: {region: 0xd0, script: 0x52, flags: 0x0}, + 746: {region: 0x164, script: 0x52, flags: 0x0}, + 747: {region: 0x51, script: 0x52, flags: 0x0}, + 748: {region: 0xda, script: 0x20, flags: 0x0}, + 749: {region: 0x12e, script: 0x52, flags: 0x0}, + 750: {region: 0xbf, script: 0x52, flags: 0x0}, + 751: {region: 0x164, script: 0x52, flags: 0x0}, + 752: {region: 0x164, script: 0x52, flags: 0x0}, + 753: {region: 0xdf, script: 0x52, flags: 0x0}, + 754: {region: 0x164, script: 0x52, flags: 0x0}, + 755: {region: 0x94, script: 0x52, flags: 0x0}, + 756: {region: 0x9a, script: 0x36, flags: 0x0}, + 757: {region: 0x164, script: 0x52, flags: 0x0}, + 758: {region: 0xc1, script: 0x1e, flags: 0x0}, + 759: {region: 0x164, script: 0x5, flags: 0x0}, + 760: {region: 0x164, script: 0x52, flags: 0x0}, + 761: {region: 0x164, script: 0x52, flags: 0x0}, + 762: {region: 0x164, script: 0x52, flags: 0x0}, + 763: {region: 0x98, script: 0x64, flags: 0x0}, + 764: {region: 0x164, script: 0x52, flags: 0x0}, + 765: {region: 0x164, script: 0x52, flags: 0x0}, + 766: {region: 0x10a, script: 0x52, flags: 0x0}, + 767: {region: 0x164, script: 0x52, flags: 0x0}, + 768: {region: 0x164, script: 0x52, flags: 0x0}, + 769: {region: 0x164, script: 0x52, flags: 0x0}, + 770: {region: 0x28, script: 0x3, flags: 0x1}, + 771: {region: 0x164, script: 0x52, flags: 0x0}, + 772: {region: 0x164, script: 0x52, flags: 0x0}, + 773: {region: 0x98, script: 0xe, flags: 0x0}, + 774: {region: 0xc3, script: 0x6b, flags: 0x0}, + 776: {region: 0x164, script: 0x52, flags: 0x0}, + 777: {region: 0x48, script: 0x52, flags: 0x0}, + 778: {region: 0x48, script: 0x52, flags: 0x0}, + 779: {region: 0x36, script: 0x52, flags: 0x0}, + 780: {region: 0x164, script: 0x52, flags: 0x0}, + 781: {region: 0x164, script: 0x52, flags: 0x0}, + 782: {region: 0x164, script: 0x52, flags: 0x0}, + 783: {region: 0x164, script: 0x52, flags: 0x0}, + 784: {region: 0x164, script: 0x52, flags: 0x0}, + 785: {region: 0x164, script: 0x52, flags: 0x0}, + 786: {region: 0x98, script: 0x20, flags: 0x0}, + 787: {region: 0xda, script: 0x20, flags: 0x0}, + 788: {region: 0x105, script: 0x1e, flags: 0x0}, + 789: {region: 0x34, script: 0x68, flags: 0x0}, + 790: {region: 0x2b, script: 0x3, flags: 0x1}, + 791: {region: 0xca, script: 0x52, flags: 0x0}, + 792: {region: 0x164, script: 0x52, flags: 0x0}, + 793: {region: 0x164, script: 0x52, flags: 0x0}, + 794: {region: 0x164, script: 0x52, flags: 0x0}, + 795: {region: 0x98, script: 0x20, flags: 0x0}, + 796: {region: 0x51, script: 0x52, flags: 0x0}, + 798: {region: 0x164, script: 0x52, flags: 0x0}, + 799: {region: 0x134, script: 0x52, flags: 0x0}, + 800: {region: 0x164, script: 0x52, flags: 0x0}, + 801: {region: 0x164, script: 0x52, flags: 0x0}, + 802: {region: 0xe7, script: 0x5, flags: 0x0}, + 803: {region: 0xc2, script: 0x52, flags: 0x0}, + 804: {region: 0x98, script: 0x20, flags: 0x0}, + 805: {region: 0x94, script: 0x52, flags: 0x0}, + 806: {region: 0x163, script: 0x52, flags: 0x0}, + 807: {region: 0x164, script: 0x52, flags: 0x0}, + 808: {region: 0xc3, script: 0x6b, flags: 0x0}, + 809: {region: 0x164, script: 0x52, flags: 0x0}, + 810: {region: 0x164, script: 0x27, flags: 0x0}, + 811: {region: 0x105, script: 0x1e, flags: 0x0}, + 812: {region: 0x164, script: 0x52, flags: 0x0}, + 813: {region: 0x130, script: 0x52, flags: 0x0}, + 814: {region: 0x9b, script: 0x5d, flags: 0x0}, + 815: {region: 0x164, script: 0x52, flags: 0x0}, + 816: {region: 0x164, script: 0x52, flags: 0x0}, + 817: {region: 0x9b, script: 0x5, flags: 0x0}, + 818: {region: 0x164, script: 0x52, flags: 0x0}, + 819: {region: 0x164, script: 0x52, flags: 0x0}, + 820: {region: 0x164, script: 0x52, flags: 0x0}, + 821: {region: 0xdc, script: 0x52, flags: 0x0}, + 822: {region: 0x164, script: 0x52, flags: 0x0}, + 823: {region: 0x164, script: 0x52, flags: 0x0}, + 825: {region: 0x164, script: 0x52, flags: 0x0}, + 826: {region: 0x52, script: 0x34, flags: 0x0}, + 827: {region: 0x9d, script: 0x52, flags: 0x0}, + 828: {region: 0xd1, script: 0x52, flags: 0x0}, + 829: {region: 0x164, script: 0x52, flags: 0x0}, + 830: {region: 0xd9, script: 0x52, flags: 0x0}, + 831: {region: 0x164, script: 0x52, flags: 0x0}, + 832: {region: 0x164, script: 0x52, flags: 0x0}, + 833: {region: 0x164, script: 0x52, flags: 0x0}, + 834: {region: 0xce, script: 0x52, flags: 0x0}, + 835: {region: 0x164, script: 0x52, flags: 0x0}, + 836: {region: 0x164, script: 0x52, flags: 0x0}, + 837: {region: 0x163, script: 0x52, flags: 0x0}, + 838: {region: 0xd0, script: 0x52, flags: 0x0}, + 839: {region: 0x5f, script: 0x52, flags: 0x0}, + 840: {region: 0xda, script: 0x20, flags: 0x0}, + 841: {region: 0x164, script: 0x52, flags: 0x0}, + 842: {region: 0xda, script: 0x20, flags: 0x0}, + 843: {region: 0x164, script: 0x52, flags: 0x0}, + 844: {region: 0x164, script: 0x52, flags: 0x0}, + 845: {region: 0xd1, script: 0x52, flags: 0x0}, + 846: {region: 0x164, script: 0x52, flags: 0x0}, + 847: {region: 0x164, script: 0x52, flags: 0x0}, + 848: {region: 0xd0, script: 0x52, flags: 0x0}, + 849: {region: 0x164, script: 0x52, flags: 0x0}, + 850: {region: 0xce, script: 0x52, flags: 0x0}, + 851: {region: 0xce, script: 0x52, flags: 0x0}, + 852: {region: 0x164, script: 0x52, flags: 0x0}, + 853: {region: 0x164, script: 0x52, flags: 0x0}, + 854: {region: 0x94, script: 0x52, flags: 0x0}, + 855: {region: 0x164, script: 0x52, flags: 0x0}, + 856: {region: 0xde, script: 0x52, flags: 0x0}, + 857: {region: 0x164, script: 0x52, flags: 0x0}, + 858: {region: 0x164, script: 0x52, flags: 0x0}, + 859: {region: 0x98, script: 0x52, flags: 0x0}, + 860: {region: 0x164, script: 0x52, flags: 0x0}, + 861: {region: 0x164, script: 0x52, flags: 0x0}, + 862: {region: 0xd8, script: 0x52, flags: 0x0}, + 863: {region: 0x51, script: 0x52, flags: 0x0}, + 864: {region: 0x164, script: 0x52, flags: 0x0}, + 865: {region: 0xd9, script: 0x52, flags: 0x0}, + 866: {region: 0x164, script: 0x52, flags: 0x0}, + 867: {region: 0x51, script: 0x52, flags: 0x0}, + 868: {region: 0x164, script: 0x52, flags: 0x0}, + 869: {region: 0x164, script: 0x52, flags: 0x0}, + 870: {region: 0xd9, script: 0x52, flags: 0x0}, + 871: {region: 0x122, script: 0x4e, flags: 0x0}, + 872: {region: 0x98, script: 0x20, flags: 0x0}, + 873: {region: 0x10b, script: 0xb7, flags: 0x0}, + 874: {region: 0x164, script: 0x52, flags: 0x0}, + 875: {region: 0x164, script: 0x52, flags: 0x0}, + 876: {region: 0x83, script: 0x70, flags: 0x0}, + 877: {region: 0x160, script: 0x52, flags: 0x0}, + 878: {region: 0x164, script: 0x52, flags: 0x0}, + 879: {region: 0x48, script: 0x17, flags: 0x0}, + 880: {region: 0x164, script: 0x52, flags: 0x0}, + 881: {region: 0x160, script: 0x52, flags: 0x0}, + 882: {region: 0x164, script: 0x52, flags: 0x0}, + 883: {region: 0x164, script: 0x52, flags: 0x0}, + 884: {region: 0x164, script: 0x52, flags: 0x0}, + 885: {region: 0x164, script: 0x52, flags: 0x0}, + 886: {region: 0x164, script: 0x52, flags: 0x0}, + 887: {region: 0x116, script: 0x52, flags: 0x0}, + 888: {region: 0x164, script: 0x52, flags: 0x0}, + 889: {region: 0x164, script: 0x52, flags: 0x0}, + 890: {region: 0x134, script: 0x52, flags: 0x0}, + 891: {region: 0x164, script: 0x52, flags: 0x0}, + 892: {region: 0x52, script: 0x52, flags: 0x0}, + 893: {region: 0x164, script: 0x52, flags: 0x0}, + 894: {region: 0xcd, script: 0x52, flags: 0x0}, + 895: {region: 0x12e, script: 0x52, flags: 0x0}, + 896: {region: 0x130, script: 0x52, flags: 0x0}, + 897: {region: 0x7f, script: 0x52, flags: 0x0}, + 898: {region: 0x77, script: 0x52, flags: 0x0}, + 899: {region: 0x164, script: 0x52, flags: 0x0}, + 901: {region: 0x164, script: 0x52, flags: 0x0}, + 902: {region: 0x164, script: 0x52, flags: 0x0}, + 903: {region: 0x6e, script: 0x52, flags: 0x0}, + 904: {region: 0x164, script: 0x52, flags: 0x0}, + 905: {region: 0x164, script: 0x52, flags: 0x0}, + 906: {region: 0x164, script: 0x52, flags: 0x0}, + 907: {region: 0x164, script: 0x52, flags: 0x0}, + 908: {region: 0x98, script: 0x75, flags: 0x0}, + 909: {region: 0x164, script: 0x52, flags: 0x0}, + 910: {region: 0x164, script: 0x5, flags: 0x0}, + 911: {region: 0x7c, script: 0x1e, flags: 0x0}, + 912: {region: 0x134, script: 0x76, flags: 0x0}, + 913: {region: 0x164, script: 0x5, flags: 0x0}, + 914: {region: 0xc4, script: 0x74, flags: 0x0}, + 915: {region: 0x164, script: 0x52, flags: 0x0}, + 916: {region: 0x2e, script: 0x3, flags: 0x1}, + 917: {region: 0xe6, script: 0x52, flags: 0x0}, + 918: {region: 0x31, script: 0x2, flags: 0x1}, + 919: {region: 0xe6, script: 0x52, flags: 0x0}, + 920: {region: 0x2f, script: 0x52, flags: 0x0}, + 921: {region: 0xef, script: 0x52, flags: 0x0}, + 922: {region: 0x164, script: 0x52, flags: 0x0}, + 923: {region: 0x77, script: 0x52, flags: 0x0}, + 924: {region: 0xd5, script: 0x52, flags: 0x0}, + 925: {region: 0x134, script: 0x52, flags: 0x0}, + 926: {region: 0x48, script: 0x52, flags: 0x0}, + 927: {region: 0x164, script: 0x52, flags: 0x0}, + 928: {region: 0x9b, script: 0xdd, flags: 0x0}, + 929: {region: 0x164, script: 0x52, flags: 0x0}, + 930: {region: 0x5f, script: 0x52, flags: 0x0}, + 931: {region: 0x164, script: 0x5, flags: 0x0}, + 932: {region: 0xaf, script: 0x7f, flags: 0x0}, + 934: {region: 0x164, script: 0x52, flags: 0x0}, + 935: {region: 0x164, script: 0x52, flags: 0x0}, + 936: {region: 0x98, script: 0x12, flags: 0x0}, + 937: {region: 0xa3, script: 0x52, flags: 0x0}, + 938: {region: 0xe8, script: 0x52, flags: 0x0}, + 939: {region: 0x164, script: 0x52, flags: 0x0}, + 940: {region: 0x9d, script: 0x52, flags: 0x0}, + 941: {region: 0x164, script: 0x52, flags: 0x0}, + 942: {region: 0x164, script: 0x52, flags: 0x0}, + 943: {region: 0x86, script: 0x2d, flags: 0x0}, + 944: {region: 0x74, script: 0x52, flags: 0x0}, + 945: {region: 0x164, script: 0x52, flags: 0x0}, + 946: {region: 0xe7, script: 0x45, flags: 0x0}, + 947: {region: 0x9b, script: 0x5, flags: 0x0}, + 948: {region: 0x1, script: 0x52, flags: 0x0}, + 949: {region: 0x23, script: 0x5, flags: 0x0}, + 950: {region: 0x164, script: 0x52, flags: 0x0}, + 951: {region: 0x40, script: 0x52, flags: 0x0}, + 952: {region: 0x164, script: 0x52, flags: 0x0}, + 953: {region: 0x79, script: 0x52, flags: 0x0}, + 954: {region: 0x164, script: 0x52, flags: 0x0}, + 955: {region: 0xe3, script: 0x52, flags: 0x0}, + 956: {region: 0x88, script: 0x52, flags: 0x0}, + 957: {region: 0x68, script: 0x52, flags: 0x0}, + 958: {region: 0x164, script: 0x52, flags: 0x0}, + 959: {region: 0x98, script: 0x20, flags: 0x0}, + 960: {region: 0x164, script: 0x52, flags: 0x0}, + 961: {region: 0x101, script: 0x52, flags: 0x0}, + 962: {region: 0x94, script: 0x52, flags: 0x0}, + 963: {region: 0x164, script: 0x52, flags: 0x0}, + 964: {region: 0x164, script: 0x52, flags: 0x0}, + 965: {region: 0x9d, script: 0x52, flags: 0x0}, + 966: {region: 0x164, script: 0x5, flags: 0x0}, + 967: {region: 0x98, script: 0x52, flags: 0x0}, + 968: {region: 0x33, script: 0x2, flags: 0x1}, + 969: {region: 0xda, script: 0x20, flags: 0x0}, + 970: {region: 0x34, script: 0xe, flags: 0x0}, + 971: {region: 0x4d, script: 0x52, flags: 0x0}, + 972: {region: 0x71, script: 0x52, flags: 0x0}, + 973: {region: 0x4d, script: 0x52, flags: 0x0}, + 974: {region: 0x9b, script: 0x5, flags: 0x0}, + 975: {region: 0x10b, script: 0x52, flags: 0x0}, + 976: {region: 0x39, script: 0x52, flags: 0x0}, + 977: {region: 0x164, script: 0x52, flags: 0x0}, + 978: {region: 0xd0, script: 0x52, flags: 0x0}, + 979: {region: 0x103, script: 0x52, flags: 0x0}, + 980: {region: 0x94, script: 0x52, flags: 0x0}, + 981: {region: 0x12e, script: 0x52, flags: 0x0}, + 982: {region: 0x164, script: 0x52, flags: 0x0}, + 983: {region: 0x164, script: 0x52, flags: 0x0}, + 984: {region: 0x72, script: 0x52, flags: 0x0}, + 985: {region: 0x105, script: 0x1e, flags: 0x0}, + 986: {region: 0x12f, script: 0x1e, flags: 0x0}, + 987: {region: 0x108, script: 0x52, flags: 0x0}, + 988: {region: 0x106, script: 0x52, flags: 0x0}, + 989: {region: 0x12e, script: 0x52, flags: 0x0}, + 990: {region: 0x164, script: 0x52, flags: 0x0}, + 991: {region: 0xa1, script: 0x44, flags: 0x0}, + 992: {region: 0x98, script: 0x20, flags: 0x0}, + 993: {region: 0x7f, script: 0x52, flags: 0x0}, + 994: {region: 0x105, script: 0x1e, flags: 0x0}, + 995: {region: 0xa3, script: 0x52, flags: 0x0}, + 996: {region: 0x94, script: 0x52, flags: 0x0}, + 997: {region: 0x98, script: 0x52, flags: 0x0}, + 998: {region: 0x98, script: 0xbb, flags: 0x0}, + 999: {region: 0x164, script: 0x52, flags: 0x0}, + 1000: {region: 0x164, script: 0x52, flags: 0x0}, + 1001: {region: 0x12e, script: 0x52, flags: 0x0}, + 1002: {region: 0x9d, script: 0x52, flags: 0x0}, + 1003: {region: 0x98, script: 0x20, flags: 0x0}, + 1004: {region: 0x164, script: 0x5, flags: 0x0}, + 1005: {region: 0x9d, script: 0x52, flags: 0x0}, + 1006: {region: 0x7a, script: 0x52, flags: 0x0}, + 1007: {region: 0x48, script: 0x52, flags: 0x0}, + 1008: {region: 0x35, script: 0x4, flags: 0x1}, + 1009: {region: 0x9d, script: 0x52, flags: 0x0}, + 1010: {region: 0x9b, script: 0x5, flags: 0x0}, + 1011: {region: 0xd9, script: 0x52, flags: 0x0}, + 1012: {region: 0x4e, script: 0x52, flags: 0x0}, + 1013: {region: 0xd0, script: 0x52, flags: 0x0}, + 1014: {region: 0xce, script: 0x52, flags: 0x0}, + 1015: {region: 0xc2, script: 0x52, flags: 0x0}, + 1016: {region: 0x4b, script: 0x52, flags: 0x0}, + 1017: {region: 0x95, script: 0x72, flags: 0x0}, + 1018: {region: 0xb5, script: 0x52, flags: 0x0}, + 1019: {region: 0x164, script: 0x27, flags: 0x0}, + 1020: {region: 0x164, script: 0x52, flags: 0x0}, + 1022: {region: 0xb9, script: 0xd2, flags: 0x0}, + 1023: {region: 0x164, script: 0x52, flags: 0x0}, + 1024: {region: 0xc3, script: 0x6b, flags: 0x0}, + 1025: {region: 0x164, script: 0x5, flags: 0x0}, + 1026: {region: 0xb2, script: 0xc1, flags: 0x0}, + 1027: {region: 0x6e, script: 0x52, flags: 0x0}, + 1028: {region: 0x164, script: 0x52, flags: 0x0}, + 1029: {region: 0x164, script: 0x52, flags: 0x0}, + 1030: {region: 0x164, script: 0x52, flags: 0x0}, + 1031: {region: 0x164, script: 0x52, flags: 0x0}, + 1032: {region: 0x110, script: 0x52, flags: 0x0}, + 1033: {region: 0x164, script: 0x52, flags: 0x0}, + 1034: {region: 0xe7, script: 0x5, flags: 0x0}, + 1035: {region: 0x164, script: 0x52, flags: 0x0}, + 1036: {region: 0x10e, script: 0x52, flags: 0x0}, + 1037: {region: 0x164, script: 0x52, flags: 0x0}, + 1038: {region: 0xe8, script: 0x52, flags: 0x0}, + 1039: {region: 0x164, script: 0x52, flags: 0x0}, + 1040: {region: 0x94, script: 0x52, flags: 0x0}, + 1041: {region: 0x141, script: 0x52, flags: 0x0}, + 1042: {region: 0x10b, script: 0x52, flags: 0x0}, + 1044: {region: 0x10b, script: 0x52, flags: 0x0}, + 1045: {region: 0x71, script: 0x52, flags: 0x0}, + 1046: {region: 0x96, script: 0xb8, flags: 0x0}, + 1047: {region: 0x164, script: 0x52, flags: 0x0}, + 1048: {region: 0x71, script: 0x52, flags: 0x0}, + 1049: {region: 0x163, script: 0x52, flags: 0x0}, + 1050: {region: 0x164, script: 0x52, flags: 0x0}, + 1051: {region: 0xc2, script: 0x52, flags: 0x0}, + 1052: {region: 0x164, script: 0x52, flags: 0x0}, + 1053: {region: 0x164, script: 0x52, flags: 0x0}, + 1054: {region: 0x164, script: 0x52, flags: 0x0}, + 1055: {region: 0x114, script: 0x52, flags: 0x0}, + 1056: {region: 0x164, script: 0x52, flags: 0x0}, + 1057: {region: 0x164, script: 0x52, flags: 0x0}, + 1058: {region: 0x122, script: 0xd5, flags: 0x0}, + 1059: {region: 0x164, script: 0x52, flags: 0x0}, + 1060: {region: 0x164, script: 0x52, flags: 0x0}, + 1061: {region: 0x164, script: 0x52, flags: 0x0}, + 1062: {region: 0x164, script: 0x52, flags: 0x0}, + 1063: {region: 0x26, script: 0x52, flags: 0x0}, + 1064: {region: 0x39, script: 0x5, flags: 0x1}, + 1065: {region: 0x98, script: 0xc2, flags: 0x0}, + 1066: {region: 0x115, script: 0x52, flags: 0x0}, + 1067: {region: 0x113, script: 0x52, flags: 0x0}, + 1068: {region: 0x98, script: 0x20, flags: 0x0}, + 1069: {region: 0x160, script: 0x52, flags: 0x0}, + 1070: {region: 0x164, script: 0x52, flags: 0x0}, + 1071: {region: 0x164, script: 0x52, flags: 0x0}, + 1072: {region: 0x6c, script: 0x52, flags: 0x0}, + 1073: {region: 0x160, script: 0x52, flags: 0x0}, + 1074: {region: 0x164, script: 0x52, flags: 0x0}, + 1075: {region: 0x5f, script: 0x52, flags: 0x0}, + 1076: {region: 0x94, script: 0x52, flags: 0x0}, + 1077: {region: 0x164, script: 0x52, flags: 0x0}, + 1078: {region: 0x164, script: 0x52, flags: 0x0}, + 1079: {region: 0x12e, script: 0x52, flags: 0x0}, + 1080: {region: 0x164, script: 0x52, flags: 0x0}, + 1081: {region: 0x83, script: 0x52, flags: 0x0}, + 1082: {region: 0x10b, script: 0x52, flags: 0x0}, + 1083: {region: 0x12e, script: 0x52, flags: 0x0}, + 1084: {region: 0x15e, script: 0x5, flags: 0x0}, + 1085: {region: 0x4a, script: 0x52, flags: 0x0}, + 1086: {region: 0x5f, script: 0x52, flags: 0x0}, + 1087: {region: 0x164, script: 0x52, flags: 0x0}, + 1088: {region: 0x98, script: 0x20, flags: 0x0}, + 1089: {region: 0x94, script: 0x52, flags: 0x0}, + 1090: {region: 0x164, script: 0x52, flags: 0x0}, + 1091: {region: 0x34, script: 0xe, flags: 0x0}, + 1092: {region: 0x9a, script: 0xc5, flags: 0x0}, + 1093: {region: 0xe8, script: 0x52, flags: 0x0}, + 1094: {region: 0x98, script: 0xcd, flags: 0x0}, + 1095: {region: 0xda, script: 0x20, flags: 0x0}, + 1096: {region: 0x164, script: 0x52, flags: 0x0}, + 1097: {region: 0x164, script: 0x52, flags: 0x0}, + 1098: {region: 0x164, script: 0x52, flags: 0x0}, + 1099: {region: 0x164, script: 0x52, flags: 0x0}, + 1100: {region: 0x164, script: 0x52, flags: 0x0}, + 1101: {region: 0x164, script: 0x52, flags: 0x0}, + 1102: {region: 0x164, script: 0x52, flags: 0x0}, + 1103: {region: 0x164, script: 0x52, flags: 0x0}, + 1104: {region: 0xe6, script: 0x52, flags: 0x0}, + 1105: {region: 0x164, script: 0x52, flags: 0x0}, + 1106: {region: 0x164, script: 0x52, flags: 0x0}, + 1107: {region: 0x98, script: 0x4a, flags: 0x0}, + 1108: {region: 0x52, script: 0xcb, flags: 0x0}, + 1109: {region: 0xda, script: 0x20, flags: 0x0}, + 1110: {region: 0xda, script: 0x20, flags: 0x0}, + 1111: {region: 0x98, script: 0xd0, flags: 0x0}, + 1112: {region: 0x164, script: 0x52, flags: 0x0}, + 1113: {region: 0x111, script: 0x52, flags: 0x0}, + 1114: {region: 0x130, script: 0x52, flags: 0x0}, + 1115: {region: 0x125, script: 0x52, flags: 0x0}, + 1116: {region: 0x164, script: 0x52, flags: 0x0}, + 1117: {region: 0x3e, script: 0x3, flags: 0x1}, + 1118: {region: 0x164, script: 0x52, flags: 0x0}, + 1119: {region: 0x164, script: 0x52, flags: 0x0}, + 1120: {region: 0x164, script: 0x52, flags: 0x0}, + 1121: {region: 0x122, script: 0xd5, flags: 0x0}, + 1122: {region: 0xda, script: 0x20, flags: 0x0}, + 1123: {region: 0xda, script: 0x20, flags: 0x0}, + 1124: {region: 0xda, script: 0x20, flags: 0x0}, + 1125: {region: 0x6e, script: 0x27, flags: 0x0}, + 1126: {region: 0x164, script: 0x52, flags: 0x0}, + 1127: {region: 0x6c, script: 0x27, flags: 0x0}, + 1128: {region: 0x164, script: 0x52, flags: 0x0}, + 1129: {region: 0x164, script: 0x52, flags: 0x0}, + 1130: {region: 0x164, script: 0x52, flags: 0x0}, + 1131: {region: 0xd5, script: 0x52, flags: 0x0}, + 1132: {region: 0x126, script: 0x52, flags: 0x0}, + 1133: {region: 0x124, script: 0x52, flags: 0x0}, + 1134: {region: 0x31, script: 0x52, flags: 0x0}, + 1135: {region: 0xda, script: 0x20, flags: 0x0}, + 1136: {region: 0xe6, script: 0x52, flags: 0x0}, + 1137: {region: 0x164, script: 0x52, flags: 0x0}, + 1138: {region: 0x164, script: 0x52, flags: 0x0}, + 1139: {region: 0x31, script: 0x52, flags: 0x0}, + 1140: {region: 0xd3, script: 0x52, flags: 0x0}, + 1141: {region: 0x164, script: 0x52, flags: 0x0}, + 1142: {region: 0x160, script: 0x52, flags: 0x0}, + 1143: {region: 0x164, script: 0x52, flags: 0x0}, + 1144: {region: 0x128, script: 0x52, flags: 0x0}, + 1145: {region: 0x164, script: 0x52, flags: 0x0}, + 1146: {region: 0xcd, script: 0x52, flags: 0x0}, + 1147: {region: 0x164, script: 0x52, flags: 0x0}, + 1148: {region: 0xe5, script: 0x52, flags: 0x0}, + 1149: {region: 0x164, script: 0x52, flags: 0x0}, + 1150: {region: 0x164, script: 0x52, flags: 0x0}, + 1151: {region: 0x164, script: 0x52, flags: 0x0}, + 1152: {region: 0x12a, script: 0x52, flags: 0x0}, + 1153: {region: 0x12a, script: 0x52, flags: 0x0}, + 1154: {region: 0x12d, script: 0x52, flags: 0x0}, + 1155: {region: 0x164, script: 0x5, flags: 0x0}, + 1156: {region: 0x160, script: 0x52, flags: 0x0}, + 1157: {region: 0x86, script: 0x2d, flags: 0x0}, + 1158: {region: 0xda, script: 0x20, flags: 0x0}, + 1159: {region: 0xe6, script: 0x52, flags: 0x0}, + 1160: {region: 0x42, script: 0xd6, flags: 0x0}, + 1161: {region: 0x164, script: 0x52, flags: 0x0}, + 1162: {region: 0x105, script: 0x1e, flags: 0x0}, + 1163: {region: 0x164, script: 0x52, flags: 0x0}, + 1164: {region: 0x164, script: 0x52, flags: 0x0}, + 1165: {region: 0x130, script: 0x52, flags: 0x0}, + 1166: {region: 0x164, script: 0x52, flags: 0x0}, + 1167: {region: 0x122, script: 0xd5, flags: 0x0}, + 1168: {region: 0x31, script: 0x52, flags: 0x0}, + 1169: {region: 0x164, script: 0x52, flags: 0x0}, + 1170: {region: 0x164, script: 0x52, flags: 0x0}, + 1171: {region: 0xcd, script: 0x52, flags: 0x0}, + 1172: {region: 0x164, script: 0x52, flags: 0x0}, + 1173: {region: 0x164, script: 0x52, flags: 0x0}, + 1174: {region: 0x12c, script: 0x52, flags: 0x0}, + 1175: {region: 0x164, script: 0x52, flags: 0x0}, + 1177: {region: 0x164, script: 0x52, flags: 0x0}, + 1178: {region: 0xd3, script: 0x52, flags: 0x0}, + 1179: {region: 0x52, script: 0xce, flags: 0x0}, + 1180: {region: 0xe4, script: 0x52, flags: 0x0}, + 1181: {region: 0x164, script: 0x52, flags: 0x0}, + 1182: {region: 0x105, script: 0x1e, flags: 0x0}, + 1183: {region: 0xb9, script: 0x52, flags: 0x0}, + 1184: {region: 0x164, script: 0x52, flags: 0x0}, + 1185: {region: 0x105, script: 0x1e, flags: 0x0}, + 1186: {region: 0x41, script: 0x4, flags: 0x1}, + 1187: {region: 0x11b, script: 0xd8, flags: 0x0}, + 1188: {region: 0x12f, script: 0x1e, flags: 0x0}, + 1189: {region: 0x74, script: 0x52, flags: 0x0}, + 1190: {region: 0x29, script: 0x52, flags: 0x0}, + 1192: {region: 0x45, script: 0x3, flags: 0x1}, + 1193: {region: 0x98, script: 0xe, flags: 0x0}, + 1194: {region: 0xe7, script: 0x5, flags: 0x0}, + 1195: {region: 0x164, script: 0x52, flags: 0x0}, + 1196: {region: 0x164, script: 0x52, flags: 0x0}, + 1197: {region: 0x164, script: 0x52, flags: 0x0}, + 1198: {region: 0x164, script: 0x52, flags: 0x0}, + 1199: {region: 0x164, script: 0x52, flags: 0x0}, + 1200: {region: 0x164, script: 0x52, flags: 0x0}, + 1201: {region: 0x164, script: 0x52, flags: 0x0}, + 1202: {region: 0x48, script: 0x4, flags: 0x1}, + 1203: {region: 0x164, script: 0x52, flags: 0x0}, + 1204: {region: 0xb3, script: 0xd9, flags: 0x0}, + 1205: {region: 0x164, script: 0x52, flags: 0x0}, + 1206: {region: 0x160, script: 0x52, flags: 0x0}, + 1207: {region: 0x9d, script: 0x52, flags: 0x0}, + 1208: {region: 0x105, script: 0x52, flags: 0x0}, + 1209: {region: 0x13d, script: 0x52, flags: 0x0}, + 1210: {region: 0x11a, script: 0x52, flags: 0x0}, + 1211: {region: 0x164, script: 0x52, flags: 0x0}, + 1212: {region: 0x35, script: 0x52, flags: 0x0}, + 1213: {region: 0x5f, script: 0x52, flags: 0x0}, + 1214: {region: 0xd0, script: 0x52, flags: 0x0}, + 1215: {region: 0x1, script: 0x52, flags: 0x0}, + 1216: {region: 0x105, script: 0x52, flags: 0x0}, + 1217: {region: 0x69, script: 0x52, flags: 0x0}, + 1218: {region: 0x12e, script: 0x52, flags: 0x0}, + 1219: {region: 0x164, script: 0x52, flags: 0x0}, + 1220: {region: 0x35, script: 0x52, flags: 0x0}, + 1221: {region: 0x4d, script: 0x52, flags: 0x0}, + 1222: {region: 0x164, script: 0x52, flags: 0x0}, + 1223: {region: 0x6e, script: 0x27, flags: 0x0}, + 1224: {region: 0x164, script: 0x52, flags: 0x0}, + 1225: {region: 0xe6, script: 0x52, flags: 0x0}, + 1226: {region: 0x2e, script: 0x52, flags: 0x0}, + 1227: {region: 0x98, script: 0xd0, flags: 0x0}, + 1228: {region: 0x98, script: 0x20, flags: 0x0}, + 1229: {region: 0x164, script: 0x52, flags: 0x0}, + 1230: {region: 0x164, script: 0x52, flags: 0x0}, + 1231: {region: 0x164, script: 0x52, flags: 0x0}, + 1232: {region: 0x164, script: 0x52, flags: 0x0}, + 1233: {region: 0x164, script: 0x52, flags: 0x0}, + 1234: {region: 0x164, script: 0x52, flags: 0x0}, + 1235: {region: 0x164, script: 0x52, flags: 0x0}, + 1236: {region: 0x164, script: 0x52, flags: 0x0}, + 1237: {region: 0x164, script: 0x52, flags: 0x0}, + 1238: {region: 0x13f, script: 0x52, flags: 0x0}, + 1239: {region: 0x164, script: 0x52, flags: 0x0}, + 1240: {region: 0x164, script: 0x52, flags: 0x0}, + 1241: {region: 0xa7, script: 0x5, flags: 0x0}, + 1242: {region: 0x164, script: 0x52, flags: 0x0}, + 1243: {region: 0x113, script: 0x52, flags: 0x0}, + 1244: {region: 0x164, script: 0x52, flags: 0x0}, + 1245: {region: 0x164, script: 0x52, flags: 0x0}, + 1246: {region: 0x164, script: 0x52, flags: 0x0}, + 1247: {region: 0x164, script: 0x52, flags: 0x0}, + 1248: {region: 0x98, script: 0x20, flags: 0x0}, + 1249: {region: 0x52, script: 0x34, flags: 0x0}, + 1250: {region: 0x164, script: 0x52, flags: 0x0}, + 1251: {region: 0x164, script: 0x52, flags: 0x0}, + 1252: {region: 0x40, script: 0x52, flags: 0x0}, + 1253: {region: 0x164, script: 0x52, flags: 0x0}, + 1254: {region: 0x12a, script: 0x18, flags: 0x0}, + 1255: {region: 0x164, script: 0x52, flags: 0x0}, + 1256: {region: 0x160, script: 0x52, flags: 0x0}, + 1257: {region: 0x164, script: 0x52, flags: 0x0}, + 1258: {region: 0x12a, script: 0x5a, flags: 0x0}, + 1259: {region: 0x12a, script: 0x5b, flags: 0x0}, + 1260: {region: 0x7c, script: 0x29, flags: 0x0}, + 1261: {region: 0x52, script: 0x5e, flags: 0x0}, + 1262: {region: 0x10a, script: 0x62, flags: 0x0}, + 1263: {region: 0x107, script: 0x6c, flags: 0x0}, + 1264: {region: 0x98, script: 0x20, flags: 0x0}, + 1265: {region: 0x130, script: 0x52, flags: 0x0}, + 1266: {region: 0x164, script: 0x52, flags: 0x0}, + 1267: {region: 0x9b, script: 0x82, flags: 0x0}, + 1268: {region: 0x164, script: 0x52, flags: 0x0}, + 1269: {region: 0x15d, script: 0xba, flags: 0x0}, + 1270: {region: 0x164, script: 0x52, flags: 0x0}, + 1271: {region: 0x164, script: 0x52, flags: 0x0}, + 1272: {region: 0xda, script: 0x20, flags: 0x0}, + 1273: {region: 0x164, script: 0x52, flags: 0x0}, + 1274: {region: 0x164, script: 0x52, flags: 0x0}, + 1275: {region: 0xd0, script: 0x52, flags: 0x0}, + 1276: {region: 0x74, script: 0x52, flags: 0x0}, + 1277: {region: 0x164, script: 0x52, flags: 0x0}, + 1278: {region: 0x164, script: 0x52, flags: 0x0}, + 1279: {region: 0x51, script: 0x52, flags: 0x0}, + 1280: {region: 0x164, script: 0x52, flags: 0x0}, + 1281: {region: 0x164, script: 0x52, flags: 0x0}, + 1282: {region: 0x164, script: 0x52, flags: 0x0}, + 1283: {region: 0x51, script: 0x52, flags: 0x0}, + 1284: {region: 0x164, script: 0x52, flags: 0x0}, + 1285: {region: 0x164, script: 0x52, flags: 0x0}, + 1286: {region: 0x164, script: 0x52, flags: 0x0}, + 1287: {region: 0x164, script: 0x52, flags: 0x0}, + 1288: {region: 0x1, script: 0x37, flags: 0x0}, + 1289: {region: 0x164, script: 0x52, flags: 0x0}, + 1290: {region: 0x164, script: 0x52, flags: 0x0}, + 1291: {region: 0x164, script: 0x52, flags: 0x0}, + 1292: {region: 0x164, script: 0x52, flags: 0x0}, + 1293: {region: 0x164, script: 0x52, flags: 0x0}, + 1294: {region: 0xd5, script: 0x52, flags: 0x0}, + 1295: {region: 0x164, script: 0x52, flags: 0x0}, + 1296: {region: 0x164, script: 0x52, flags: 0x0}, + 1297: {region: 0x164, script: 0x52, flags: 0x0}, + 1298: {region: 0x40, script: 0x52, flags: 0x0}, + 1299: {region: 0x164, script: 0x52, flags: 0x0}, + 1300: {region: 0xce, script: 0x52, flags: 0x0}, + 1301: {region: 0x4c, script: 0x3, flags: 0x1}, + 1302: {region: 0x164, script: 0x52, flags: 0x0}, + 1303: {region: 0x164, script: 0x52, flags: 0x0}, + 1304: {region: 0x164, script: 0x52, flags: 0x0}, + 1305: {region: 0x52, script: 0x52, flags: 0x0}, + 1306: {region: 0x10a, script: 0x52, flags: 0x0}, + 1308: {region: 0xa7, script: 0x5, flags: 0x0}, + 1309: {region: 0xd8, script: 0x52, flags: 0x0}, + 1310: {region: 0xb9, script: 0xd2, flags: 0x0}, + 1311: {region: 0x4f, script: 0x14, flags: 0x1}, + 1312: {region: 0x164, script: 0x52, flags: 0x0}, + 1313: {region: 0x121, script: 0x52, flags: 0x0}, + 1314: {region: 0xcf, script: 0x52, flags: 0x0}, + 1315: {region: 0x164, script: 0x52, flags: 0x0}, + 1316: {region: 0x160, script: 0x52, flags: 0x0}, + 1318: {region: 0x12a, script: 0x52, flags: 0x0}, +} + +// likelyLangList holds lists info associated with likelyLang. +// Size: 396 bytes, 99 elements +var likelyLangList = [99]likelyScriptRegion{ + 0: {region: 0x9b, script: 0x7, flags: 0x0}, + 1: {region: 0xa0, script: 0x6d, flags: 0x2}, + 2: {region: 0x11b, script: 0x78, flags: 0x2}, + 3: {region: 0x31, script: 0x52, flags: 0x0}, + 4: {region: 0x9a, script: 0x5, flags: 0x4}, + 5: {region: 0x9b, script: 0x5, flags: 0x4}, + 6: {region: 0x105, script: 0x1e, flags: 0x4}, + 7: {region: 0x9b, script: 0x5, flags: 0x2}, + 8: {region: 0x98, script: 0xe, flags: 0x0}, + 9: {region: 0x34, script: 0x16, flags: 0x2}, + 10: {region: 0x105, script: 0x1e, flags: 0x0}, + 11: {region: 0x37, script: 0x2a, flags: 0x2}, + 12: {region: 0x134, script: 0x52, flags: 0x0}, + 13: {region: 0x7a, script: 0xbd, flags: 0x2}, + 14: {region: 0x113, script: 0x52, flags: 0x0}, + 15: {region: 0x83, script: 0x1, flags: 0x2}, + 16: {region: 0x5c, script: 0x1d, flags: 0x0}, + 17: {region: 0x86, script: 0x57, flags: 0x2}, + 18: {region: 0xd5, script: 0x52, flags: 0x0}, + 19: {region: 0x51, script: 0x5, flags: 0x4}, + 20: {region: 0x10a, script: 0x5, flags: 0x4}, + 21: {region: 0xad, script: 0x1e, flags: 0x0}, + 22: {region: 0x23, script: 0x5, flags: 0x4}, + 23: {region: 0x52, script: 0x5, flags: 0x4}, + 24: {region: 0x9b, script: 0x5, flags: 0x4}, + 25: {region: 0xc4, script: 0x5, flags: 0x4}, + 26: {region: 0x52, script: 0x5, flags: 0x2}, + 27: {region: 0x12a, script: 0x52, flags: 0x0}, + 28: {region: 0xaf, script: 0x5, flags: 0x4}, + 29: {region: 0x9a, script: 0x5, flags: 0x2}, + 30: {region: 0xa4, script: 0x1e, flags: 0x0}, + 31: {region: 0x52, script: 0x5, flags: 0x4}, + 32: {region: 0x12a, script: 0x52, flags: 0x4}, + 33: {region: 0x52, script: 0x5, flags: 0x2}, + 34: {region: 0x12a, script: 0x52, flags: 0x2}, + 35: {region: 0xda, script: 0x20, flags: 0x0}, + 36: {region: 0x98, script: 0x55, flags: 0x2}, + 37: {region: 0x82, script: 0x52, flags: 0x0}, + 38: {region: 0x83, script: 0x70, flags: 0x4}, + 39: {region: 0x83, script: 0x70, flags: 0x2}, + 40: {region: 0xc4, script: 0x1e, flags: 0x0}, + 41: {region: 0x52, script: 0x66, flags: 0x4}, + 42: {region: 0x52, script: 0x66, flags: 0x2}, + 43: {region: 0xcf, script: 0x52, flags: 0x0}, + 44: {region: 0x49, script: 0x5, flags: 0x4}, + 45: {region: 0x94, script: 0x5, flags: 0x4}, + 46: {region: 0x98, script: 0x2f, flags: 0x0}, + 47: {region: 0xe7, script: 0x5, flags: 0x4}, + 48: {region: 0xe7, script: 0x5, flags: 0x2}, + 49: {region: 0x9b, script: 0x7c, flags: 0x0}, + 50: {region: 0x52, script: 0x7d, flags: 0x2}, + 51: {region: 0xb9, script: 0xd2, flags: 0x0}, + 52: {region: 0xd8, script: 0x52, flags: 0x4}, + 53: {region: 0xe7, script: 0x5, flags: 0x0}, + 54: {region: 0x98, script: 0x20, flags: 0x2}, + 55: {region: 0x98, script: 0x47, flags: 0x2}, + 56: {region: 0x98, script: 0xc0, flags: 0x2}, + 57: {region: 0x104, script: 0x1e, flags: 0x0}, + 58: {region: 0xbc, script: 0x52, flags: 0x4}, + 59: {region: 0x103, script: 0x52, flags: 0x4}, + 60: {region: 0x105, script: 0x52, flags: 0x4}, + 61: {region: 0x12a, script: 0x52, flags: 0x4}, + 62: {region: 0x123, script: 0x1e, flags: 0x0}, + 63: {region: 0xe7, script: 0x5, flags: 0x4}, + 64: {region: 0xe7, script: 0x5, flags: 0x2}, + 65: {region: 0x52, script: 0x5, flags: 0x0}, + 66: {region: 0xad, script: 0x1e, flags: 0x4}, + 67: {region: 0xc4, script: 0x1e, flags: 0x4}, + 68: {region: 0xad, script: 0x1e, flags: 0x2}, + 69: {region: 0x98, script: 0xe, flags: 0x0}, + 70: {region: 0xda, script: 0x20, flags: 0x4}, + 71: {region: 0xda, script: 0x20, flags: 0x2}, + 72: {region: 0x136, script: 0x52, flags: 0x0}, + 73: {region: 0x23, script: 0x5, flags: 0x4}, + 74: {region: 0x52, script: 0x1e, flags: 0x4}, + 75: {region: 0x23, script: 0x5, flags: 0x2}, + 76: {region: 0x8c, script: 0x35, flags: 0x0}, + 77: {region: 0x52, script: 0x34, flags: 0x4}, + 78: {region: 0x52, script: 0x34, flags: 0x2}, + 79: {region: 0x52, script: 0x34, flags: 0x0}, + 80: {region: 0x2e, script: 0x35, flags: 0x4}, + 81: {region: 0x3d, script: 0x35, flags: 0x4}, + 82: {region: 0x7a, script: 0x35, flags: 0x4}, + 83: {region: 0x7d, script: 0x35, flags: 0x4}, + 84: {region: 0x8c, script: 0x35, flags: 0x4}, + 85: {region: 0x94, script: 0x35, flags: 0x4}, + 86: {region: 0xc5, script: 0x35, flags: 0x4}, + 87: {region: 0xcf, script: 0x35, flags: 0x4}, + 88: {region: 0xe1, script: 0x35, flags: 0x4}, + 89: {region: 0xe4, script: 0x35, flags: 0x4}, + 90: {region: 0xe6, script: 0x35, flags: 0x4}, + 91: {region: 0x115, script: 0x35, flags: 0x4}, + 92: {region: 0x122, script: 0x35, flags: 0x4}, + 93: {region: 0x12d, script: 0x35, flags: 0x4}, + 94: {region: 0x134, script: 0x35, flags: 0x4}, + 95: {region: 0x13d, script: 0x35, flags: 0x4}, + 96: {region: 0x12d, script: 0x11, flags: 0x2}, + 97: {region: 0x12d, script: 0x30, flags: 0x2}, + 98: {region: 0x12d, script: 0x35, flags: 0x2}, +} + +type likelyLangScript struct { + lang uint16 + script uint8 + flags uint8 +} + +// likelyRegion is a lookup table, indexed by regionID, for the most likely +// languages and scripts given incomplete information. If more entries exist +// for a given regionID, lang and script are the index and size respectively +// of the list in likelyRegionList. +// TODO: exclude containers and user-definable regions from the list. +// Size: 1428 bytes, 357 elements +var likelyRegion = [357]likelyLangScript{ + 33: {lang: 0xd5, script: 0x52, flags: 0x0}, + 34: {lang: 0x39, script: 0x5, flags: 0x0}, + 35: {lang: 0x0, script: 0x2, flags: 0x1}, + 38: {lang: 0x2, script: 0x2, flags: 0x1}, + 39: {lang: 0x4, script: 0x2, flags: 0x1}, + 41: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 42: {lang: 0x0, script: 0x52, flags: 0x0}, + 43: {lang: 0x139, script: 0x52, flags: 0x0}, + 44: {lang: 0x411, script: 0x52, flags: 0x0}, + 45: {lang: 0x109, script: 0x52, flags: 0x0}, + 47: {lang: 0x35e, script: 0x52, flags: 0x0}, + 48: {lang: 0x43a, script: 0x52, flags: 0x0}, + 49: {lang: 0x57, script: 0x52, flags: 0x0}, + 50: {lang: 0x6, script: 0x2, flags: 0x1}, + 52: {lang: 0xa3, script: 0xe, flags: 0x0}, + 53: {lang: 0x35e, script: 0x52, flags: 0x0}, + 54: {lang: 0x159, script: 0x52, flags: 0x0}, + 55: {lang: 0x7d, script: 0x1e, flags: 0x0}, + 56: {lang: 0x39, script: 0x5, flags: 0x0}, + 57: {lang: 0x3d0, script: 0x52, flags: 0x0}, + 58: {lang: 0x159, script: 0x52, flags: 0x0}, + 59: {lang: 0x159, script: 0x52, flags: 0x0}, + 61: {lang: 0x316, script: 0x52, flags: 0x0}, + 62: {lang: 0x139, script: 0x52, flags: 0x0}, + 63: {lang: 0x398, script: 0x52, flags: 0x0}, + 64: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 66: {lang: 0x8, script: 0x2, flags: 0x1}, + 68: {lang: 0x0, script: 0x52, flags: 0x0}, + 70: {lang: 0x70, script: 0x1e, flags: 0x0}, + 72: {lang: 0x508, script: 0x37, flags: 0x2}, + 73: {lang: 0x316, script: 0x5, flags: 0x2}, + 74: {lang: 0x43b, script: 0x52, flags: 0x0}, + 75: {lang: 0x159, script: 0x52, flags: 0x0}, + 76: {lang: 0x159, script: 0x52, flags: 0x0}, + 77: {lang: 0x109, script: 0x52, flags: 0x0}, + 78: {lang: 0x159, script: 0x52, flags: 0x0}, + 80: {lang: 0x139, script: 0x52, flags: 0x0}, + 81: {lang: 0x159, script: 0x52, flags: 0x0}, + 82: {lang: 0xa, script: 0x5, flags: 0x1}, + 83: {lang: 0x139, script: 0x52, flags: 0x0}, + 84: {lang: 0x0, script: 0x52, flags: 0x0}, + 85: {lang: 0x139, script: 0x52, flags: 0x0}, + 88: {lang: 0x139, script: 0x52, flags: 0x0}, + 89: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 90: {lang: 0x398, script: 0x52, flags: 0x0}, + 92: {lang: 0xf, script: 0x2, flags: 0x1}, + 93: {lang: 0xf6, script: 0x52, flags: 0x0}, + 95: {lang: 0x109, script: 0x52, flags: 0x0}, + 97: {lang: 0x1, script: 0x52, flags: 0x0}, + 98: {lang: 0xfd, script: 0x52, flags: 0x0}, + 100: {lang: 0x139, script: 0x52, flags: 0x0}, + 102: {lang: 0x11, script: 0x2, flags: 0x1}, + 103: {lang: 0x139, script: 0x52, flags: 0x0}, + 104: {lang: 0x139, script: 0x52, flags: 0x0}, + 105: {lang: 0x13b, script: 0x52, flags: 0x0}, + 106: {lang: 0x39, script: 0x5, flags: 0x0}, + 107: {lang: 0x39, script: 0x5, flags: 0x0}, + 108: {lang: 0x465, script: 0x27, flags: 0x0}, + 109: {lang: 0x139, script: 0x52, flags: 0x0}, + 110: {lang: 0x13, script: 0x2, flags: 0x1}, + 112: {lang: 0x109, script: 0x52, flags: 0x0}, + 113: {lang: 0x14c, script: 0x52, flags: 0x0}, + 114: {lang: 0x1b9, script: 0x20, flags: 0x2}, + 117: {lang: 0x153, script: 0x52, flags: 0x0}, + 119: {lang: 0x159, script: 0x52, flags: 0x0}, + 121: {lang: 0x159, script: 0x52, flags: 0x0}, + 122: {lang: 0x15, script: 0x2, flags: 0x1}, + 124: {lang: 0x17, script: 0x3, flags: 0x1}, + 125: {lang: 0x159, script: 0x52, flags: 0x0}, + 127: {lang: 0x20, script: 0x52, flags: 0x0}, + 129: {lang: 0x23d, script: 0x52, flags: 0x0}, + 131: {lang: 0x159, script: 0x52, flags: 0x0}, + 132: {lang: 0x159, script: 0x52, flags: 0x0}, + 133: {lang: 0x139, script: 0x52, flags: 0x0}, + 134: {lang: 0x1a, script: 0x2, flags: 0x1}, + 135: {lang: 0x0, script: 0x52, flags: 0x0}, + 136: {lang: 0x139, script: 0x52, flags: 0x0}, + 138: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 140: {lang: 0x51f, script: 0x35, flags: 0x0}, + 141: {lang: 0x0, script: 0x52, flags: 0x0}, + 142: {lang: 0x139, script: 0x52, flags: 0x0}, + 143: {lang: 0x1ca, script: 0x52, flags: 0x0}, + 144: {lang: 0x1cd, script: 0x52, flags: 0x0}, + 145: {lang: 0x1ce, script: 0x52, flags: 0x0}, + 147: {lang: 0x139, script: 0x52, flags: 0x0}, + 148: {lang: 0x1c, script: 0x2, flags: 0x1}, + 150: {lang: 0x1b5, script: 0x37, flags: 0x0}, + 152: {lang: 0x1e, script: 0x3, flags: 0x1}, + 154: {lang: 0x39, script: 0x5, flags: 0x0}, + 155: {lang: 0x21, script: 0x2, flags: 0x1}, + 156: {lang: 0x1f0, script: 0x52, flags: 0x0}, + 157: {lang: 0x1f1, script: 0x52, flags: 0x0}, + 160: {lang: 0x39, script: 0x5, flags: 0x0}, + 161: {lang: 0x1f8, script: 0x41, flags: 0x0}, + 163: {lang: 0x43b, script: 0x52, flags: 0x0}, + 164: {lang: 0x281, script: 0x1e, flags: 0x0}, + 165: {lang: 0x23, script: 0x3, flags: 0x1}, + 167: {lang: 0x26, script: 0x2, flags: 0x1}, + 169: {lang: 0x24b, script: 0x4b, flags: 0x0}, + 170: {lang: 0x24b, script: 0x4b, flags: 0x0}, + 171: {lang: 0x39, script: 0x5, flags: 0x0}, + 173: {lang: 0x3d9, script: 0x1e, flags: 0x0}, + 174: {lang: 0x28, script: 0x2, flags: 0x1}, + 175: {lang: 0x39, script: 0x5, flags: 0x0}, + 177: {lang: 0x109, script: 0x52, flags: 0x0}, + 178: {lang: 0x402, script: 0xc1, flags: 0x0}, + 180: {lang: 0x431, script: 0x52, flags: 0x0}, + 181: {lang: 0x2b7, script: 0x52, flags: 0x0}, + 182: {lang: 0x159, script: 0x52, flags: 0x0}, + 183: {lang: 0x2be, script: 0x52, flags: 0x0}, + 184: {lang: 0x39, script: 0x5, flags: 0x0}, + 185: {lang: 0x2a, script: 0x2, flags: 0x1}, + 186: {lang: 0x159, script: 0x52, flags: 0x0}, + 187: {lang: 0x2c, script: 0x2, flags: 0x1}, + 188: {lang: 0x428, script: 0x52, flags: 0x0}, + 189: {lang: 0x159, script: 0x52, flags: 0x0}, + 190: {lang: 0x2e8, script: 0x52, flags: 0x0}, + 193: {lang: 0x2e, script: 0x2, flags: 0x1}, + 194: {lang: 0x9e, script: 0x52, flags: 0x0}, + 195: {lang: 0x30, script: 0x2, flags: 0x1}, + 196: {lang: 0x32, script: 0x2, flags: 0x1}, + 197: {lang: 0x34, script: 0x2, flags: 0x1}, + 199: {lang: 0x159, script: 0x52, flags: 0x0}, + 200: {lang: 0x36, script: 0x2, flags: 0x1}, + 202: {lang: 0x317, script: 0x52, flags: 0x0}, + 203: {lang: 0x38, script: 0x3, flags: 0x1}, + 204: {lang: 0x124, script: 0xd4, flags: 0x0}, + 206: {lang: 0x139, script: 0x52, flags: 0x0}, + 207: {lang: 0x316, script: 0x52, flags: 0x0}, + 208: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 209: {lang: 0x15, script: 0x52, flags: 0x0}, + 210: {lang: 0x159, script: 0x52, flags: 0x0}, + 211: {lang: 0x1ad, script: 0x52, flags: 0x0}, + 213: {lang: 0x1ad, script: 0x5, flags: 0x2}, + 215: {lang: 0x139, script: 0x52, flags: 0x0}, + 216: {lang: 0x35e, script: 0x52, flags: 0x0}, + 217: {lang: 0x33e, script: 0x52, flags: 0x0}, + 218: {lang: 0x348, script: 0x20, flags: 0x0}, + 224: {lang: 0x39, script: 0x5, flags: 0x0}, + 225: {lang: 0x139, script: 0x52, flags: 0x0}, + 227: {lang: 0x139, script: 0x52, flags: 0x0}, + 228: {lang: 0x159, script: 0x52, flags: 0x0}, + 229: {lang: 0x47c, script: 0x52, flags: 0x0}, + 230: {lang: 0x14e, script: 0x52, flags: 0x0}, + 231: {lang: 0x3b, script: 0x3, flags: 0x1}, + 232: {lang: 0x3e, script: 0x2, flags: 0x1}, + 233: {lang: 0x159, script: 0x52, flags: 0x0}, + 235: {lang: 0x139, script: 0x52, flags: 0x0}, + 236: {lang: 0x39, script: 0x5, flags: 0x0}, + 237: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 239: {lang: 0x399, script: 0x52, flags: 0x0}, + 240: {lang: 0x18e, script: 0x52, flags: 0x0}, + 242: {lang: 0x39, script: 0x5, flags: 0x0}, + 257: {lang: 0x159, script: 0x52, flags: 0x0}, + 259: {lang: 0x40, script: 0x2, flags: 0x1}, + 260: {lang: 0x428, script: 0x1e, flags: 0x0}, + 261: {lang: 0x42, script: 0x2, flags: 0x1}, + 262: {lang: 0x3dc, script: 0x52, flags: 0x0}, + 263: {lang: 0x39, script: 0x5, flags: 0x0}, + 265: {lang: 0x159, script: 0x52, flags: 0x0}, + 266: {lang: 0x39, script: 0x5, flags: 0x0}, + 267: {lang: 0x44, script: 0x2, flags: 0x1}, + 270: {lang: 0x40c, script: 0x52, flags: 0x0}, + 271: {lang: 0x33e, script: 0x52, flags: 0x0}, + 272: {lang: 0x46, script: 0x2, flags: 0x1}, + 274: {lang: 0x1f1, script: 0x52, flags: 0x0}, + 275: {lang: 0x159, script: 0x52, flags: 0x0}, + 276: {lang: 0x41f, script: 0x52, flags: 0x0}, + 277: {lang: 0x35e, script: 0x52, flags: 0x0}, + 279: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 281: {lang: 0x139, script: 0x52, flags: 0x0}, + 283: {lang: 0x48, script: 0x2, flags: 0x1}, + 287: {lang: 0x159, script: 0x52, flags: 0x0}, + 288: {lang: 0x159, script: 0x52, flags: 0x0}, + 289: {lang: 0x4a, script: 0x2, flags: 0x1}, + 290: {lang: 0x4c, script: 0x3, flags: 0x1}, + 291: {lang: 0x4f, script: 0x2, flags: 0x1}, + 292: {lang: 0x46d, script: 0x52, flags: 0x0}, + 293: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 294: {lang: 0x46c, script: 0x52, flags: 0x0}, + 295: {lang: 0x51, script: 0x2, flags: 0x1}, + 296: {lang: 0x478, script: 0x52, flags: 0x0}, + 298: {lang: 0x53, script: 0x4, flags: 0x1}, + 300: {lang: 0x496, script: 0x52, flags: 0x0}, + 301: {lang: 0x57, script: 0x2, flags: 0x1}, + 302: {lang: 0x43b, script: 0x52, flags: 0x0}, + 303: {lang: 0x59, script: 0x3, flags: 0x1}, + 304: {lang: 0x43b, script: 0x52, flags: 0x0}, + 308: {lang: 0x508, script: 0x37, flags: 0x2}, + 309: {lang: 0x139, script: 0x52, flags: 0x0}, + 310: {lang: 0x4b2, script: 0x52, flags: 0x0}, + 311: {lang: 0x1f1, script: 0x52, flags: 0x0}, + 314: {lang: 0x139, script: 0x52, flags: 0x0}, + 317: {lang: 0x4b9, script: 0x52, flags: 0x0}, + 318: {lang: 0x89, script: 0x52, flags: 0x0}, + 319: {lang: 0x159, script: 0x52, flags: 0x0}, + 321: {lang: 0x411, script: 0x52, flags: 0x0}, + 332: {lang: 0x5c, script: 0x2, flags: 0x1}, + 349: {lang: 0x39, script: 0x5, flags: 0x0}, + 350: {lang: 0x5e, script: 0x2, flags: 0x1}, + 355: {lang: 0x419, script: 0x52, flags: 0x0}, +} + +// likelyRegionList holds lists info associated with likelyRegion. +// Size: 384 bytes, 96 elements +var likelyRegionList = [96]likelyLangScript{ + 0: {lang: 0x143, script: 0x5, flags: 0x0}, + 1: {lang: 0x46c, script: 0x52, flags: 0x0}, + 2: {lang: 0x427, script: 0x52, flags: 0x0}, + 3: {lang: 0x2f6, script: 0x1e, flags: 0x0}, + 4: {lang: 0x1d0, script: 0x8, flags: 0x0}, + 5: {lang: 0x26b, script: 0x52, flags: 0x0}, + 6: {lang: 0xb5, script: 0x52, flags: 0x0}, + 7: {lang: 0x428, script: 0x1e, flags: 0x0}, + 8: {lang: 0x129, script: 0xd6, flags: 0x0}, + 9: {lang: 0x348, script: 0x20, flags: 0x0}, + 10: {lang: 0x51f, script: 0x34, flags: 0x0}, + 11: {lang: 0x4a2, script: 0x5, flags: 0x0}, + 12: {lang: 0x515, script: 0x35, flags: 0x0}, + 13: {lang: 0x519, script: 0x52, flags: 0x0}, + 14: {lang: 0x291, script: 0xd5, flags: 0x0}, + 15: {lang: 0x131, script: 0x2d, flags: 0x0}, + 16: {lang: 0x480, script: 0x52, flags: 0x0}, + 17: {lang: 0x39, script: 0x5, flags: 0x0}, + 18: {lang: 0x159, script: 0x52, flags: 0x0}, + 19: {lang: 0x26, script: 0x27, flags: 0x0}, + 20: {lang: 0x134, script: 0x52, flags: 0x0}, + 21: {lang: 0x261, script: 0x5, flags: 0x2}, + 22: {lang: 0x508, script: 0x37, flags: 0x2}, + 23: {lang: 0x208, script: 0x29, flags: 0x0}, + 24: {lang: 0x5, script: 0x1e, flags: 0x0}, + 25: {lang: 0x26b, script: 0x52, flags: 0x0}, + 26: {lang: 0x131, script: 0x2d, flags: 0x0}, + 27: {lang: 0x2f6, script: 0x1e, flags: 0x0}, + 28: {lang: 0x1da, script: 0x52, flags: 0x0}, + 29: {lang: 0x316, script: 0x5, flags: 0x0}, + 30: {lang: 0x1b7, script: 0x20, flags: 0x0}, + 31: {lang: 0x4aa, script: 0x5, flags: 0x0}, + 32: {lang: 0x22e, script: 0x6b, flags: 0x0}, + 33: {lang: 0x143, script: 0x5, flags: 0x0}, + 34: {lang: 0x46c, script: 0x52, flags: 0x0}, + 35: {lang: 0x242, script: 0x46, flags: 0x0}, + 36: {lang: 0xe4, script: 0x5, flags: 0x0}, + 37: {lang: 0x21e, script: 0xd5, flags: 0x0}, + 38: {lang: 0x39, script: 0x5, flags: 0x0}, + 39: {lang: 0x159, script: 0x52, flags: 0x0}, + 40: {lang: 0x2af, script: 0x4f, flags: 0x0}, + 41: {lang: 0x21e, script: 0xd5, flags: 0x0}, + 42: {lang: 0x39, script: 0x5, flags: 0x0}, + 43: {lang: 0x159, script: 0x52, flags: 0x0}, + 44: {lang: 0x3d3, script: 0x52, flags: 0x0}, + 45: {lang: 0x4a4, script: 0x1e, flags: 0x0}, + 46: {lang: 0x2f6, script: 0x1e, flags: 0x0}, + 47: {lang: 0x427, script: 0x52, flags: 0x0}, + 48: {lang: 0x328, script: 0x6b, flags: 0x0}, + 49: {lang: 0x20b, script: 0x52, flags: 0x0}, + 50: {lang: 0x302, script: 0x1e, flags: 0x0}, + 51: {lang: 0x23a, script: 0x5, flags: 0x0}, + 52: {lang: 0x51f, script: 0x35, flags: 0x0}, + 53: {lang: 0x3b7, script: 0x52, flags: 0x0}, + 54: {lang: 0x39, script: 0x5, flags: 0x0}, + 55: {lang: 0x159, script: 0x52, flags: 0x0}, + 56: {lang: 0x2e4, script: 0x52, flags: 0x0}, + 57: {lang: 0x4aa, script: 0x5, flags: 0x0}, + 58: {lang: 0x87, script: 0x20, flags: 0x0}, + 59: {lang: 0x4aa, script: 0x5, flags: 0x0}, + 60: {lang: 0x4aa, script: 0x5, flags: 0x0}, + 61: {lang: 0xbc, script: 0x20, flags: 0x0}, + 62: {lang: 0x3aa, script: 0x52, flags: 0x0}, + 63: {lang: 0x70, script: 0x1e, flags: 0x0}, + 64: {lang: 0x3d3, script: 0x52, flags: 0x0}, + 65: {lang: 0x7d, script: 0x1e, flags: 0x0}, + 66: {lang: 0x3d9, script: 0x1e, flags: 0x0}, + 67: {lang: 0x25e, script: 0x52, flags: 0x0}, + 68: {lang: 0x43a, script: 0x52, flags: 0x0}, + 69: {lang: 0x508, script: 0x37, flags: 0x0}, + 70: {lang: 0x408, script: 0x52, flags: 0x0}, + 71: {lang: 0x4a4, script: 0x1e, flags: 0x0}, + 72: {lang: 0x39, script: 0x5, flags: 0x0}, + 73: {lang: 0x159, script: 0x52, flags: 0x0}, + 74: {lang: 0x159, script: 0x52, flags: 0x0}, + 75: {lang: 0x34, script: 0x5, flags: 0x0}, + 76: {lang: 0x461, script: 0xd5, flags: 0x0}, + 77: {lang: 0x2e3, script: 0x5, flags: 0x0}, + 78: {lang: 0x306, script: 0x6b, flags: 0x0}, + 79: {lang: 0x45d, script: 0x1e, flags: 0x0}, + 80: {lang: 0x143, script: 0x5, flags: 0x0}, + 81: {lang: 0x39, script: 0x5, flags: 0x0}, + 82: {lang: 0x159, script: 0x52, flags: 0x0}, + 83: {lang: 0x480, script: 0x52, flags: 0x0}, + 84: {lang: 0x57, script: 0x5, flags: 0x0}, + 85: {lang: 0x211, script: 0x1e, flags: 0x0}, + 86: {lang: 0x80, script: 0x2d, flags: 0x0}, + 87: {lang: 0x51f, script: 0x35, flags: 0x0}, + 88: {lang: 0x482, script: 0x52, flags: 0x0}, + 89: {lang: 0x4a4, script: 0x1e, flags: 0x0}, + 90: {lang: 0x508, script: 0x37, flags: 0x0}, + 91: {lang: 0x3aa, script: 0x52, flags: 0x0}, + 92: {lang: 0x427, script: 0x52, flags: 0x0}, + 93: {lang: 0x428, script: 0x1e, flags: 0x0}, + 94: {lang: 0x159, script: 0x52, flags: 0x0}, + 95: {lang: 0x43c, script: 0x5, flags: 0x0}, +} + +type likelyTag struct { + lang uint16 + region uint16 + script uint8 +} + +// Size: 192 bytes, 32 elements +var likelyRegionGroup = [32]likelyTag{ + 1: {lang: 0x134, region: 0xd5, script: 0x52}, + 2: {lang: 0x134, region: 0x134, script: 0x52}, + 3: {lang: 0x3b7, region: 0x40, script: 0x52}, + 4: {lang: 0x134, region: 0x2e, script: 0x52}, + 5: {lang: 0x134, region: 0xd5, script: 0x52}, + 6: {lang: 0x139, region: 0xce, script: 0x52}, + 7: {lang: 0x43b, region: 0x12e, script: 0x52}, + 8: {lang: 0x39, region: 0x6a, script: 0x5}, + 9: {lang: 0x43b, region: 0x4a, script: 0x52}, + 10: {lang: 0x134, region: 0x160, script: 0x52}, + 11: {lang: 0x134, region: 0x134, script: 0x52}, + 12: {lang: 0x134, region: 0x134, script: 0x52}, + 13: {lang: 0x139, region: 0x58, script: 0x52}, + 14: {lang: 0x51f, region: 0x52, script: 0x34}, + 15: {lang: 0x1b7, region: 0x98, script: 0x20}, + 16: {lang: 0x1da, region: 0x94, script: 0x52}, + 17: {lang: 0x1f1, region: 0x9d, script: 0x52}, + 18: {lang: 0x134, region: 0x2e, script: 0x52}, + 19: {lang: 0x134, region: 0xe5, script: 0x52}, + 20: {lang: 0x134, region: 0x89, script: 0x52}, + 21: {lang: 0x411, region: 0x141, script: 0x52}, + 22: {lang: 0x51f, region: 0x52, script: 0x34}, + 23: {lang: 0x4b2, region: 0x136, script: 0x52}, + 24: {lang: 0x39, region: 0x107, script: 0x5}, + 25: {lang: 0x3d9, region: 0x105, script: 0x1e}, + 26: {lang: 0x3d9, region: 0x105, script: 0x1e}, + 27: {lang: 0x134, region: 0x7a, script: 0x52}, + 28: {lang: 0x109, region: 0x5f, script: 0x52}, + 29: {lang: 0x139, region: 0x1e, script: 0x52}, + 30: {lang: 0x134, region: 0x99, script: 0x52}, + 31: {lang: 0x134, region: 0x7a, script: 0x52}, +} + +type mutualIntelligibility struct { + want uint16 + have uint16 + conf uint8 + oneway bool +} + +type scriptIntelligibility struct { + lang uint16 + want uint8 + have uint8 + conf uint8 +} + +// matchLang holds pairs of langIDs of base languages that are typically +// mutually intelligible. Each pair is associated with a confidence and +// whether the intelligibility goes one or both ways. +// Size: 708 bytes, 118 elements +var matchLang = [118]mutualIntelligibility{ + 0: {want: 0x366, have: 0x33e, conf: 0x2, oneway: false}, + 1: {want: 0x26b, have: 0xe7, conf: 0x2, oneway: false}, + 2: {want: 0x1ca, have: 0xb5, conf: 0x2, oneway: false}, + 3: {want: 0x3fd, have: 0xb5, conf: 0x2, oneway: false}, + 4: {want: 0x428, have: 0xb5, conf: 0x2, oneway: false}, + 5: {want: 0x3fd, have: 0x1ca, conf: 0x2, oneway: false}, + 6: {want: 0x428, have: 0x1ca, conf: 0x2, oneway: false}, + 7: {want: 0x3fd, have: 0x428, conf: 0x2, oneway: false}, + 8: {want: 0x430, have: 0x1, conf: 0x2, oneway: false}, + 9: {want: 0x19c, have: 0x109, conf: 0x2, oneway: true}, + 10: {want: 0x28c, have: 0x109, conf: 0x2, oneway: true}, + 11: {want: 0xfd, have: 0x366, conf: 0x2, oneway: false}, + 12: {want: 0xfd, have: 0x33e, conf: 0x2, oneway: false}, + 13: {want: 0xe7, have: 0x26b, conf: 0x2, oneway: false}, + 14: {want: 0x5, have: 0x3d9, conf: 0x2, oneway: true}, + 15: {want: 0xc, have: 0x134, conf: 0x2, oneway: true}, + 16: {want: 0x15, have: 0x35e, conf: 0x2, oneway: true}, + 17: {want: 0x20, have: 0x134, conf: 0x2, oneway: true}, + 18: {want: 0x55, have: 0x139, conf: 0x2, oneway: true}, + 19: {want: 0x57, have: 0x3d9, conf: 0x2, oneway: true}, + 20: {want: 0x70, have: 0x3d9, conf: 0x2, oneway: true}, + 21: {want: 0x74, have: 0x134, conf: 0x2, oneway: true}, + 22: {want: 0x81, have: 0x1b7, conf: 0x2, oneway: true}, + 23: {want: 0xa3, have: 0x134, conf: 0x2, oneway: true}, + 24: {want: 0xb0, have: 0x159, conf: 0x2, oneway: true}, + 25: {want: 0xdb, have: 0x14e, conf: 0x2, oneway: true}, + 26: {want: 0xe3, have: 0x134, conf: 0x2, oneway: true}, + 27: {want: 0xe7, have: 0x39, conf: 0x2, oneway: true}, + 28: {want: 0xed, have: 0x159, conf: 0x2, oneway: true}, + 29: {want: 0xf5, have: 0x159, conf: 0x2, oneway: true}, + 30: {want: 0xfc, have: 0x134, conf: 0x2, oneway: true}, + 31: {want: 0x12c, have: 0x134, conf: 0x2, oneway: true}, + 32: {want: 0x137, have: 0x134, conf: 0x2, oneway: true}, + 33: {want: 0x13b, have: 0x14c, conf: 0x2, oneway: true}, + 34: {want: 0x140, have: 0x139, conf: 0x2, oneway: true}, + 35: {want: 0x153, have: 0xfd, conf: 0x2, oneway: true}, + 36: {want: 0x168, have: 0x35e, conf: 0x2, oneway: true}, + 37: {want: 0x169, have: 0x134, conf: 0x2, oneway: true}, + 38: {want: 0x16a, have: 0x134, conf: 0x2, oneway: true}, + 39: {want: 0x178, have: 0x134, conf: 0x2, oneway: true}, + 40: {want: 0x18a, have: 0x139, conf: 0x2, oneway: true}, + 41: {want: 0x18e, have: 0x139, conf: 0x2, oneway: true}, + 42: {want: 0x19d, have: 0x1b7, conf: 0x2, oneway: true}, + 43: {want: 0x1ad, have: 0x134, conf: 0x2, oneway: true}, + 44: {want: 0x1b1, have: 0x134, conf: 0x2, oneway: true}, + 45: {want: 0x1cd, have: 0x159, conf: 0x2, oneway: true}, + 46: {want: 0x1d0, have: 0x3d9, conf: 0x2, oneway: true}, + 47: {want: 0x1d2, have: 0x134, conf: 0x2, oneway: true}, + 48: {want: 0x1df, have: 0x134, conf: 0x2, oneway: true}, + 49: {want: 0x1f0, have: 0x134, conf: 0x2, oneway: true}, + 50: {want: 0x206, have: 0x1da, conf: 0x2, oneway: true}, + 51: {want: 0x208, have: 0x134, conf: 0x2, oneway: true}, + 52: {want: 0x225, have: 0x159, conf: 0x2, oneway: true}, + 53: {want: 0x23a, have: 0x3d9, conf: 0x2, oneway: true}, + 54: {want: 0x242, have: 0x134, conf: 0x2, oneway: true}, + 55: {want: 0x249, have: 0x134, conf: 0x2, oneway: true}, + 56: {want: 0x25c, have: 0x134, conf: 0x2, oneway: true}, + 57: {want: 0x26b, have: 0x480, conf: 0x2, oneway: true}, + 58: {want: 0x281, have: 0x3d9, conf: 0x2, oneway: true}, + 59: {want: 0x285, have: 0x1f1, conf: 0x2, oneway: true}, + 60: {want: 0x29a, have: 0x134, conf: 0x2, oneway: true}, + 61: {want: 0x2ac, have: 0x159, conf: 0x2, oneway: true}, + 62: {want: 0x2af, have: 0x134, conf: 0x2, oneway: true}, + 63: {want: 0x2b5, have: 0x134, conf: 0x2, oneway: true}, + 64: {want: 0x2ba, have: 0x159, conf: 0x2, oneway: true}, + 65: {want: 0x2e4, have: 0x134, conf: 0x2, oneway: true}, + 66: {want: 0x2e8, have: 0x159, conf: 0x2, oneway: true}, + 67: {want: 0x2f1, have: 0x134, conf: 0x2, oneway: true}, + 68: {want: 0x2f6, have: 0x7d, conf: 0x2, oneway: true}, + 69: {want: 0x2fb, have: 0x134, conf: 0x2, oneway: true}, + 70: {want: 0x302, have: 0x3d9, conf: 0x2, oneway: true}, + 71: {want: 0x312, have: 0x1b7, conf: 0x2, oneway: true}, + 72: {want: 0x316, have: 0x1da, conf: 0x2, oneway: true}, + 73: {want: 0x317, have: 0x134, conf: 0x2, oneway: true}, + 74: {want: 0x328, have: 0x134, conf: 0x2, oneway: true}, + 75: {want: 0x348, have: 0x134, conf: 0x2, oneway: true}, + 76: {want: 0x361, have: 0x33e, conf: 0x2, oneway: false}, + 77: {want: 0x361, have: 0x366, conf: 0x2, oneway: true}, + 78: {want: 0x371, have: 0x134, conf: 0x2, oneway: true}, + 79: {want: 0x37e, have: 0x134, conf: 0x2, oneway: true}, + 80: {want: 0x380, have: 0x134, conf: 0x2, oneway: true}, + 81: {want: 0x382, have: 0x159, conf: 0x2, oneway: true}, + 82: {want: 0x387, have: 0x134, conf: 0x2, oneway: true}, + 83: {want: 0x38c, have: 0x134, conf: 0x2, oneway: true}, + 84: {want: 0x394, have: 0x134, conf: 0x2, oneway: true}, + 85: {want: 0x39c, have: 0x134, conf: 0x2, oneway: true}, + 86: {want: 0x3b5, have: 0x134, conf: 0x2, oneway: true}, + 87: {want: 0x3bb, have: 0x139, conf: 0x2, oneway: true}, + 88: {want: 0x3cb, have: 0x109, conf: 0x2, oneway: true}, + 89: {want: 0x3d0, have: 0x134, conf: 0x2, oneway: true}, + 90: {want: 0x3dc, have: 0x159, conf: 0x2, oneway: true}, + 91: {want: 0x3e0, have: 0x1b7, conf: 0x2, oneway: true}, + 92: {want: 0x3f0, have: 0x134, conf: 0x2, oneway: true}, + 93: {want: 0x402, have: 0x134, conf: 0x2, oneway: true}, + 94: {want: 0x419, have: 0x134, conf: 0x2, oneway: true}, + 95: {want: 0x41f, have: 0x134, conf: 0x2, oneway: true}, + 96: {want: 0x427, have: 0x134, conf: 0x2, oneway: true}, + 97: {want: 0x431, have: 0x134, conf: 0x2, oneway: true}, + 98: {want: 0x434, have: 0x1da, conf: 0x2, oneway: true}, + 99: {want: 0x43b, have: 0x134, conf: 0x2, oneway: true}, + 100: {want: 0x446, have: 0x134, conf: 0x2, oneway: true}, + 101: {want: 0x457, have: 0x134, conf: 0x2, oneway: true}, + 102: {want: 0x45d, have: 0x3d9, conf: 0x2, oneway: true}, + 103: {want: 0x465, have: 0x134, conf: 0x2, oneway: true}, + 104: {want: 0x46c, have: 0x3d9, conf: 0x2, oneway: true}, + 105: {want: 0x3878, have: 0x134, conf: 0x2, oneway: true}, + 106: {want: 0x476, have: 0x134, conf: 0x2, oneway: true}, + 107: {want: 0x478, have: 0x134, conf: 0x2, oneway: true}, + 108: {want: 0x48a, have: 0x3d9, conf: 0x2, oneway: true}, + 109: {want: 0x493, have: 0x134, conf: 0x2, oneway: true}, + 110: {want: 0x4a2, have: 0x51f, conf: 0x2, oneway: true}, + 111: {want: 0x4aa, have: 0x134, conf: 0x2, oneway: true}, + 112: {want: 0x4b2, have: 0x3d9, conf: 0x2, oneway: true}, + 113: {want: 0x4db, have: 0x159, conf: 0x2, oneway: true}, + 114: {want: 0x4e8, have: 0x134, conf: 0x2, oneway: true}, + 115: {want: 0x508, have: 0x134, conf: 0x2, oneway: true}, + 116: {want: 0x50e, have: 0x134, conf: 0x2, oneway: true}, + 117: {want: 0x524, have: 0x134, conf: 0x2, oneway: true}, +} + +// matchScript holds pairs of scriptIDs where readers of one script +// can typically also read the other. Each is associated with a confidence. +// Size: 24 bytes, 4 elements +var matchScript = [4]scriptIntelligibility{ + 0: {lang: 0x428, want: 0x52, have: 0x1e, conf: 0x2}, + 1: {lang: 0x428, want: 0x1e, have: 0x52, conf: 0x2}, + 2: {lang: 0x0, want: 0x34, have: 0x35, conf: 0x1}, + 3: {lang: 0x0, want: 0x35, have: 0x34, conf: 0x1}, +} + +// Size: 128 bytes, 32 elements +var regionContainment = [32]uint32{ + 0xffffffff, 0x000007a2, 0x00003044, 0x00000008, + 0x403c0010, 0x00000020, 0x00000040, 0x00000080, + 0x00000100, 0x00000200, 0x00000400, 0x2000384c, + 0x00001000, 0x00002000, 0x00004000, 0x00008000, + 0x00010000, 0x00020000, 0x00040000, 0x00080000, + 0x00100000, 0x00200000, 0x01c1c000, 0x00800000, + 0x01000000, 0x1e020000, 0x04000000, 0x08000000, + 0x10000000, 0x20002048, 0x40000000, 0x80000000, +} + +// regionInclusion maps region identifiers to sets of regions in regionInclusionBits, +// where each set holds all groupings that are directly connected in a region +// containment graph. +// Size: 357 bytes, 357 elements +var regionInclusion = [357]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x20, + 0x21, 0x22, 0x23, 0x24, 0x25, 0x25, 0x22, 0x23, + 0x25, 0x26, 0x21, 0x27, 0x28, 0x29, 0x2a, 0x25, + 0x2b, 0x23, 0x22, 0x25, 0x24, 0x29, 0x2c, 0x2d, + 0x23, 0x2e, 0x2c, 0x25, 0x2f, 0x30, 0x27, 0x25, + // Entry 40 - 7F + 0x27, 0x25, 0x24, 0x30, 0x21, 0x31, 0x32, 0x33, + 0x2f, 0x21, 0x26, 0x26, 0x26, 0x34, 0x2c, 0x28, + 0x27, 0x26, 0x35, 0x27, 0x21, 0x33, 0x22, 0x20, + 0x25, 0x2c, 0x25, 0x21, 0x36, 0x2d, 0x34, 0x29, + 0x21, 0x2e, 0x37, 0x25, 0x25, 0x20, 0x38, 0x38, + 0x27, 0x37, 0x38, 0x38, 0x2e, 0x39, 0x2e, 0x1f, + 0x20, 0x37, 0x3a, 0x27, 0x3b, 0x2b, 0x20, 0x29, + 0x34, 0x26, 0x37, 0x25, 0x23, 0x27, 0x2b, 0x2c, + // Entry 80 - BF + 0x22, 0x2f, 0x2c, 0x2c, 0x25, 0x26, 0x39, 0x21, + 0x33, 0x3b, 0x2c, 0x27, 0x35, 0x21, 0x33, 0x39, + 0x25, 0x2d, 0x20, 0x38, 0x30, 0x37, 0x23, 0x2b, + 0x24, 0x21, 0x23, 0x24, 0x2b, 0x39, 0x2b, 0x25, + 0x23, 0x35, 0x20, 0x2e, 0x3c, 0x30, 0x3b, 0x2e, + 0x25, 0x35, 0x35, 0x23, 0x25, 0x3c, 0x30, 0x23, + 0x25, 0x34, 0x24, 0x2c, 0x31, 0x37, 0x29, 0x37, + 0x38, 0x38, 0x34, 0x32, 0x22, 0x25, 0x2e, 0x3b, + // Entry C0 - FF + 0x20, 0x22, 0x2c, 0x30, 0x35, 0x35, 0x3b, 0x25, + 0x2c, 0x25, 0x39, 0x2e, 0x24, 0x2e, 0x33, 0x30, + 0x2e, 0x31, 0x3a, 0x2c, 0x2a, 0x2c, 0x20, 0x33, + 0x29, 0x2b, 0x24, 0x20, 0x3b, 0x23, 0x28, 0x2a, + 0x23, 0x33, 0x20, 0x27, 0x28, 0x3a, 0x30, 0x24, + 0x2d, 0x2f, 0x28, 0x25, 0x23, 0x39, 0x20, 0x3b, + 0x27, 0x20, 0x23, 0x20, 0x20, 0x1e, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + // Entry 100 - 13F + 0x20, 0x2e, 0x20, 0x2d, 0x22, 0x32, 0x2e, 0x23, + 0x3a, 0x2e, 0x38, 0x37, 0x30, 0x2c, 0x39, 0x2b, + 0x2d, 0x2c, 0x22, 0x2c, 0x2e, 0x27, 0x2e, 0x26, + 0x32, 0x33, 0x25, 0x23, 0x31, 0x21, 0x25, 0x26, + 0x21, 0x2c, 0x30, 0x3c, 0x28, 0x30, 0x3c, 0x38, + 0x28, 0x30, 0x23, 0x25, 0x28, 0x35, 0x2e, 0x32, + 0x2e, 0x20, 0x21, 0x20, 0x2f, 0x27, 0x3c, 0x22, + 0x25, 0x20, 0x27, 0x25, 0x25, 0x30, 0x3a, 0x28, + // Entry 140 - 17F + 0x20, 0x28, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x22, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x23, 0x23, 0x2e, 0x22, + 0x31, 0x2e, 0x26, 0x2e, 0x20, +} + +// regionInclusionBits is an array of bit vectors where every vector represents +// a set of region groupings. These sets are used to compute the distance +// between two regions for the purpose of language matching. +// Size: 288 bytes, 72 elements +var regionInclusionBits = [72]uint32{ + // Entry 0 - 1F + 0x82400813, 0x000007a3, 0x00003844, 0x20000808, + 0x403c0011, 0x00000022, 0x20000844, 0x00000082, + 0x00000102, 0x00000202, 0x00000402, 0x2000384d, + 0x00001804, 0x20002804, 0x00404000, 0x00408000, + 0x00410000, 0x02020000, 0x00040010, 0x00080010, + 0x00100010, 0x00200010, 0x01c1c001, 0x00c00000, + 0x01400000, 0x1e020001, 0x06000000, 0x0a000000, + 0x12000000, 0x20002848, 0x40000010, 0x80000001, + // Entry 20 - 3F + 0x00000001, 0x40000000, 0x00020000, 0x01000000, + 0x00008000, 0x00002000, 0x00000200, 0x00000008, + 0x00200000, 0x90000000, 0x00040000, 0x08000000, + 0x00000020, 0x84000000, 0x00000080, 0x00001000, + 0x00010000, 0x00000400, 0x04000000, 0x00000040, + 0x10000000, 0x00004000, 0x81000000, 0x88000000, + 0x00000100, 0x80020000, 0x00080000, 0x00100000, + 0x00800000, 0xffffffff, 0x82400fb3, 0xc27c0813, + // Entry 40 - 5F + 0xa240385f, 0x83c1c813, 0x9e420813, 0x92000001, + 0x86000001, 0x81400001, 0x8a000001, 0x82020001, +} + +// regionInclusionNext marks, for each entry in regionInclusionBits, the set of +// all groups that are reachable from the groups set in the respective entry. +// Size: 72 bytes, 72 elements +var regionInclusionNext = [72]uint8{ + // Entry 0 - 3F + 0x3d, 0x3e, 0x0b, 0x0b, 0x3f, 0x01, 0x0b, 0x01, + 0x01, 0x01, 0x01, 0x40, 0x0b, 0x0b, 0x16, 0x16, + 0x16, 0x19, 0x04, 0x04, 0x04, 0x04, 0x41, 0x16, + 0x16, 0x42, 0x19, 0x19, 0x19, 0x0b, 0x04, 0x00, + 0x00, 0x1e, 0x11, 0x18, 0x0f, 0x0d, 0x09, 0x03, + 0x15, 0x43, 0x12, 0x1b, 0x05, 0x44, 0x07, 0x0c, + 0x10, 0x0a, 0x1a, 0x06, 0x1c, 0x0e, 0x45, 0x46, + 0x08, 0x47, 0x13, 0x14, 0x17, 0x3d, 0x3d, 0x3d, + // Entry 40 - 7F + 0x3d, 0x3d, 0x3d, 0x42, 0x42, 0x41, 0x42, 0x42, +} + +type parentRel struct { + lang uint16 + script uint8 + maxScript uint8 + toRegion uint16 + fromRegion []uint16 +} + +// Size: 412 bytes, 5 elements +var parents = [5]parentRel{ + 0: {lang: 0x134, script: 0x0, maxScript: 0x52, toRegion: 0x1, fromRegion: []uint16{0x1a, 0x24, 0x25, 0x2e, 0x33, 0x35, 0x3c, 0x41, 0x45, 0x47, 0x48, 0x49, 0x4f, 0x51, 0x5b, 0x5c, 0x60, 0x63, 0x6c, 0x72, 0x73, 0x74, 0x7a, 0x7b, 0x7e, 0x7f, 0x80, 0x82, 0x8b, 0x8c, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9e, 0x9f, 0xa3, 0xa6, 0xa8, 0xac, 0xb0, 0xb3, 0xb4, 0xbe, 0xc5, 0xc9, 0xca, 0xcb, 0xcd, 0xcf, 0xd1, 0xd4, 0xd5, 0xdc, 0xde, 0xdf, 0xe5, 0xe6, 0xe7, 0xea, 0xef, 0x106, 0x108, 0x109, 0x10a, 0x10c, 0x10d, 0x111, 0x116, 0x11a, 0x11c, 0x11e, 0x124, 0x128, 0x12b, 0x12c, 0x12e, 0x130, 0x138, 0x13b, 0x13e, 0x141, 0x160, 0x161, 0x163}}, + 1: {lang: 0x134, script: 0x0, maxScript: 0x52, toRegion: 0x1a, fromRegion: []uint16{0x2d, 0x4d, 0x5f, 0x62, 0x71, 0xd8, 0x10b, 0x10e}}, + 2: {lang: 0x139, script: 0x0, maxScript: 0x52, toRegion: 0x1e, fromRegion: []uint16{0x2b, 0x3e, 0x40, 0x50, 0x53, 0x55, 0x58, 0x64, 0x68, 0x88, 0x8e, 0xce, 0xd7, 0xe1, 0xe3, 0xeb, 0xf0, 0x119, 0x134, 0x135, 0x13a}}, + 3: {lang: 0x3b7, script: 0x0, maxScript: 0x52, toRegion: 0xed, fromRegion: []uint16{0x29, 0x4d, 0x59, 0x85, 0x8a, 0xb6, 0xc5, 0xd0, 0x117, 0x125}}, + 4: {lang: 0x51f, script: 0x35, maxScript: 0x35, toRegion: 0x8c, fromRegion: []uint16{0xc5}}, +} + +// Total table size 25825 bytes (25KiB); checksum: 4E97CC5E diff --git a/Godeps/_workspace/src/golang.org/x/text/language/tags.go b/vendor/golang.org/x/text/language/tags.go similarity index 100% rename from Godeps/_workspace/src/golang.org/x/text/language/tags.go rename to vendor/golang.org/x/text/language/tags.go diff --git a/Godeps/_workspace/src/golang.org/x/text/runes/cond.go b/vendor/golang.org/x/text/runes/cond.go similarity index 63% rename from Godeps/_workspace/src/golang.org/x/text/runes/cond.go rename to vendor/golang.org/x/text/runes/cond.go index ae7a921585..df7aa02db6 100644 --- a/Godeps/_workspace/src/golang.org/x/text/runes/cond.go +++ b/vendor/golang.org/x/text/runes/cond.go @@ -41,20 +41,35 @@ func If(s Set, tIn, tNotIn transform.Transformer) Transformer { if tNotIn == nil { tNotIn = transform.Nop } + sIn, ok := tIn.(transform.SpanningTransformer) + if !ok { + sIn = dummySpan{tIn} + } + sNotIn, ok := tNotIn.(transform.SpanningTransformer) + if !ok { + sNotIn = dummySpan{tNotIn} + } + a := &cond{ - tIn: tIn, - tNotIn: tNotIn, + tIn: sIn, + tNotIn: sNotIn, f: s.Contains, } a.Reset() return Transformer{a} } +type dummySpan struct{ transform.Transformer } + +func (d dummySpan) Span(src []byte, atEOF bool) (n int, err error) { + return 0, transform.ErrEndOfSpan +} + type cond struct { - tIn, tNotIn transform.Transformer + tIn, tNotIn transform.SpanningTransformer f func(rune) bool - check func(rune) bool // current check to perform - t transform.Transformer // current transformer to use + check func(rune) bool // current check to perform + t transform.SpanningTransformer // current transformer to use } // Reset implements transform.Transformer. @@ -84,6 +99,51 @@ func (t *cond) isNot(r rune) bool { return false } +// This implementation of Span doesn't help all too much, but it needs to be +// there to satisfy this package's Transformer interface. +// TODO: there are certainly room for improvements, though. For example, if +// t.t == transform.Nop (which will a common occurrence) it will save a bundle +// to special-case that loop. +func (t *cond) Span(src []byte, atEOF bool) (n int, err error) { + p := 0 + for n < len(src) && err == nil { + // Don't process too much at a time as the Spanner that will be + // called on this block may terminate early. + const maxChunk = 4096 + max := len(src) + if v := n + maxChunk; v < max { + max = v + } + atEnd := false + size := 0 + current := t.t + for ; p < max; p += size { + r := rune(src[p]) + if r < utf8.RuneSelf { + size = 1 + } else if r, size = utf8.DecodeRune(src[p:]); size == 1 { + if !atEOF && !utf8.FullRune(src[p:]) { + err = transform.ErrShortSrc + break + } + } + if !t.check(r) { + // The next rune will be the start of a new run. + atEnd = true + break + } + } + n2, err2 := current.Span(src[n:p], atEnd || (atEOF && p == len(src))) + n += n2 + if err2 != nil { + return n, err2 + } + // At this point either err != nil or t.check will pass for the rune at p. + p = n + size + } + return n, err +} + func (t *cond) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { p := 0 for nSrc < len(src) && err == nil { @@ -99,9 +159,10 @@ func (t *cond) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error size := 0 current := t.t for ; p < max; p += size { - var r rune - r, size = utf8.DecodeRune(src[p:]) - if r == utf8.RuneError && size == 1 { + r := rune(src[p]) + if r < utf8.RuneSelf { + size = 1 + } else if r, size = utf8.DecodeRune(src[p:]); size == 1 { if !atEOF && !utf8.FullRune(src[p:]) { err = transform.ErrShortSrc break diff --git a/Godeps/_workspace/src/golang.org/x/text/runes/runes.go b/vendor/golang.org/x/text/runes/runes.go similarity index 69% rename from Godeps/_workspace/src/golang.org/x/text/runes/runes.go rename to vendor/golang.org/x/text/runes/runes.go index 291de656b2..71933696f5 100644 --- a/Godeps/_workspace/src/golang.org/x/text/runes/runes.go +++ b/vendor/golang.org/x/text/runes/runes.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package runes provide transforms for UTF-8 encoded text. -package runes +package runes // import "golang.org/x/text/runes" import ( "unicode" @@ -46,9 +46,19 @@ func Predicate(f func(rune) bool) Set { // Transformer implements the transform.Transformer interface. type Transformer struct { - transform.Transformer + t transform.SpanningTransformer } +func (t Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + return t.t.Transform(dst, src, atEOF) +} + +func (t Transformer) Span(b []byte, atEOF bool) (n int, err error) { + return t.t.Span(b, atEOF) +} + +func (t Transformer) Reset() { t.t.Reset() } + // Bytes returns a new byte slice with the result of converting b using t. It // calls Reset on t. It returns nil if any error was found. This can only happen // if an error-producing Transformer is passed to If. @@ -96,39 +106,57 @@ type remove func(r rune) bool func (remove) Reset() {} +// Span implements transform.Spanner. +func (t remove) Span(src []byte, atEOF bool) (n int, err error) { + for r, size := rune(0), 0; n < len(src); { + if r = rune(src[n]); r < utf8.RuneSelf { + size = 1 + } else if r, size = utf8.DecodeRune(src[n:]); size == 1 { + // Invalid rune. + if !atEOF && !utf8.FullRune(src[n:]) { + err = transform.ErrShortSrc + } else { + err = transform.ErrEndOfSpan + } + break + } + if t(r) { + err = transform.ErrEndOfSpan + break + } + n += size + } + return +} + // Transform implements transform.Transformer. func (t remove) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { for r, size := rune(0), 0; nSrc < len(src); { if r = rune(src[nSrc]); r < utf8.RuneSelf { size = 1 - } else { - r, size = utf8.DecodeRune(src[nSrc:]) - - if size == 1 { - // Invalid rune. - if !atEOF && !utf8.FullRune(src[nSrc:]) { - err = transform.ErrShortSrc + } else if r, size = utf8.DecodeRune(src[nSrc:]); size == 1 { + // Invalid rune. + if !atEOF && !utf8.FullRune(src[nSrc:]) { + err = transform.ErrShortSrc + break + } + // We replace illegal bytes with RuneError. Not doing so might + // otherwise turn a sequence of invalid UTF-8 into valid UTF-8. + // The resulting byte sequence may subsequently contain runes + // for which t(r) is true that were passed unnoticed. + if !t(utf8.RuneError) { + if nDst+3 > len(dst) { + err = transform.ErrShortDst break } - // We replace illegal bytes with RuneError. Not doing so might - // otherwise turn a sequence of invalid UTF-8 into valid UTF-8. - // The resulting byte sequence may subsequently contain runes - // for which t(r) is true that were passed unnoticed. - if !t(utf8.RuneError) { - if nDst+3 > len(dst) { - err = transform.ErrShortDst - break - } - dst[nDst+0] = runeErrorString[0] - dst[nDst+1] = runeErrorString[1] - dst[nDst+2] = runeErrorString[2] - nDst += 3 - } - nSrc++ - continue + dst[nDst+0] = runeErrorString[0] + dst[nDst+1] = runeErrorString[1] + dst[nDst+2] = runeErrorString[2] + nDst += 3 } + nSrc++ + continue } - if t(r) { nSrc += size continue @@ -157,6 +185,28 @@ type mapper func(rune) rune func (mapper) Reset() {} +// Span implements transform.Spanner. +func (t mapper) Span(src []byte, atEOF bool) (n int, err error) { + for r, size := rune(0), 0; n < len(src); n += size { + if r = rune(src[n]); r < utf8.RuneSelf { + size = 1 + } else if r, size = utf8.DecodeRune(src[n:]); size == 1 { + // Invalid rune. + if !atEOF && !utf8.FullRune(src[n:]) { + err = transform.ErrShortSrc + } else { + err = transform.ErrEndOfSpan + } + break + } + if t(r) != r { + err = transform.ErrEndOfSpan + break + } + } + return n, err +} + // Transform implements transform.Transformer. func (t mapper) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { var replacement rune @@ -230,24 +280,51 @@ func ReplaceIllFormed() Transformer { type replaceIllFormed struct{ transform.NopResetter } +func (t replaceIllFormed) Span(src []byte, atEOF bool) (n int, err error) { + for n < len(src) { + // ASCII fast path. + if src[n] < utf8.RuneSelf { + n++ + continue + } + + r, size := utf8.DecodeRune(src[n:]) + + // Look for a valid non-ASCII rune. + if r != utf8.RuneError || size != 1 { + n += size + continue + } + + // Look for short source data. + if !atEOF && !utf8.FullRune(src[n:]) { + err = transform.ErrShortSrc + break + } + + // We have an invalid rune. + err = transform.ErrEndOfSpan + break + } + return n, err +} + func (t replaceIllFormed) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { for nSrc < len(src) { - r, size := utf8.DecodeRune(src[nSrc:]) - - // Look for an ASCII rune. - if r < utf8.RuneSelf { + // ASCII fast path. + if r := src[nSrc]; r < utf8.RuneSelf { if nDst == len(dst) { err = transform.ErrShortDst break } - dst[nDst] = byte(r) + dst[nDst] = r nDst++ nSrc++ continue } // Look for a valid non-ASCII rune. - if r != utf8.RuneError || size != 1 { + if _, size := utf8.DecodeRune(src[nSrc:]); size != 1 { if size != copy(dst[nDst:], src[nSrc:nSrc+size]) { err = transform.ErrShortDst break diff --git a/Godeps/_workspace/src/golang.org/x/text/transform/transform.go b/vendor/golang.org/x/text/transform/transform.go similarity index 89% rename from Godeps/_workspace/src/golang.org/x/text/transform/transform.go rename to vendor/golang.org/x/text/transform/transform.go index 51862b02bf..fe47b9b35f 100644 --- a/Godeps/_workspace/src/golang.org/x/text/transform/transform.go +++ b/vendor/golang.org/x/text/transform/transform.go @@ -6,7 +6,7 @@ // bytes passing through as well as various transformations. Example // transformations provided by other packages include normalization and // conversion between character sets. -package transform +package transform // import "golang.org/x/text/transform" import ( "bytes" @@ -24,6 +24,10 @@ var ( // complete the transformation. ErrShortSrc = errors.New("transform: short source buffer") + // ErrEndOfSpan means that the input and output (the transformed input) + // are not identical. + ErrEndOfSpan = errors.New("transform: input and output are not identical") + // errInconsistentByteCount means that Transform returned success (nil // error) but also returned nSrc inconsistent with the src argument. errInconsistentByteCount = errors.New("transform: inconsistent byte count returned") @@ -60,6 +64,41 @@ type Transformer interface { Reset() } +// SpanningTransformer extends the Transformer interface with a Span method +// that determines how much of the input already conforms to the Transformer. +type SpanningTransformer interface { + Transformer + + // Span returns a position in src such that transforming src[:n] results in + // identical output src[:n] for these bytes. It does not necessarily return + // the largest such n. The atEOF argument tells whether src represents the + // last bytes of the input. + // + // Callers should always account for the n bytes consumed before + // considering the error err. + // + // A nil error means that all input bytes are known to be identical to the + // output produced by the Transformer. A nil error can be be returned + // regardless of whether atEOF is true. If err is nil, then then n must + // equal len(src); the converse is not necessarily true. + // + // ErrEndOfSpan means that the Transformer output may differ from the + // input after n bytes. Note that n may be len(src), meaning that the output + // would contain additional bytes after otherwise identical output. + // ErrShortSrc means that src had insufficient data to determine whether the + // remaining bytes would change. Other than the error conditions listed + // here, implementations are free to report other errors that arise. + // + // Calling Span can modify the Transformer state as a side effect. In + // effect, it does the transformation just as calling Transform would, only + // without copying to a destination buffer and only up to a point it can + // determine the input and output bytes are the same. This is obviously more + // limited than calling Transform, but can be more efficient in terms of + // copying and allocating buffers. Calls to Span and Transform may be + // interleaved. + Span(src []byte, atEOF bool) (n int, err error) +} + // NopResetter can be embedded by implementations of Transformer to add a nop // Reset method. type NopResetter struct{} @@ -278,6 +317,10 @@ func (nop) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { return n, n, err } +func (nop) Span(src []byte, atEOF bool) (n int, err error) { + return len(src), nil +} + type discard struct{ NopResetter } func (discard) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -289,8 +332,8 @@ var ( // by consuming all bytes and writing nothing. Discard Transformer = discard{} - // Nop is a Transformer that copies src to dst. - Nop Transformer = nop{} + // Nop is a SpanningTransformer that copies src to dst. + Nop SpanningTransformer = nop{} ) // chain is a sequence of links. A chain with N Transformers has N+1 links and @@ -358,6 +401,8 @@ func (c *chain) Reset() { } } +// TODO: make chain use Span (is going to be fun to implement!) + // Transform applies the transformers of c in sequence. func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { // Set up src and dst in the chain. @@ -448,8 +493,7 @@ func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err erro return dstL.n, srcL.p, err } -// RemoveFunc returns a Transformer that removes from the input all runes r for -// which f(r) is true. Illegal bytes in the input are replaced by RuneError. +// Deprecated: use runes.Remove instead. func RemoveFunc(f func(r rune) bool) Transformer { return removeF(f) } diff --git a/vendor/golang.org/x/text/unicode/cldr/base.go b/vendor/golang.org/x/text/unicode/cldr/base.go new file mode 100644 index 0000000000..2382f4d6da --- /dev/null +++ b/vendor/golang.org/x/text/unicode/cldr/base.go @@ -0,0 +1,100 @@ +// 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 cldr + +import ( + "encoding/xml" + "regexp" + "strconv" +) + +// Elem is implemented by every XML element. +type Elem interface { + setEnclosing(Elem) + setName(string) + enclosing() Elem + + GetCommon() *Common +} + +type hidden struct { + CharData string `xml:",chardata"` + Alias *struct { + Common + Source string `xml:"source,attr"` + Path string `xml:"path,attr"` + } `xml:"alias"` + Def *struct { + Common + Choice string `xml:"choice,attr,omitempty"` + Type string `xml:"type,attr,omitempty"` + } `xml:"default"` +} + +// Common holds several of the most common attributes and sub elements +// of an XML element. +type Common struct { + XMLName xml.Name + name string + enclElem Elem + Type string `xml:"type,attr,omitempty"` + Reference string `xml:"reference,attr,omitempty"` + Alt string `xml:"alt,attr,omitempty"` + ValidSubLocales string `xml:"validSubLocales,attr,omitempty"` + Draft string `xml:"draft,attr,omitempty"` + hidden +} + +// Default returns the default type to select from the enclosed list +// or "" if no default value is specified. +func (e *Common) Default() string { + if e.Def == nil { + return "" + } + if e.Def.Choice != "" { + return e.Def.Choice + } else if e.Def.Type != "" { + // Type is still used by the default element in collation. + return e.Def.Type + } + return "" +} + +// GetCommon returns e. It is provided such that Common implements Elem. +func (e *Common) GetCommon() *Common { + return e +} + +// Data returns the character data accumulated for this element. +func (e *Common) Data() string { + e.CharData = charRe.ReplaceAllStringFunc(e.CharData, replaceUnicode) + return e.CharData +} + +func (e *Common) setName(s string) { + e.name = s +} + +func (e *Common) enclosing() Elem { + return e.enclElem +} + +func (e *Common) setEnclosing(en Elem) { + e.enclElem = en +} + +// Escape characters that can be escaped without further escaping the string. +var charRe = regexp.MustCompile(`&#x[0-9a-fA-F]*;|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\[abtnvfr]`) + +// replaceUnicode converts hexadecimal Unicode codepoint notations to a one-rune string. +// It assumes the input string is correctly formatted. +func replaceUnicode(s string) string { + if s[1] == '#' { + r, _ := strconv.ParseInt(s[3:len(s)-1], 16, 32) + return string(r) + } + r, _, _, _ := strconv.UnquoteChar(s, 0) + return string(r) +} diff --git a/vendor/golang.org/x/text/unicode/cldr/cldr.go b/vendor/golang.org/x/text/unicode/cldr/cldr.go new file mode 100644 index 0000000000..2197f8ac26 --- /dev/null +++ b/vendor/golang.org/x/text/unicode/cldr/cldr.go @@ -0,0 +1,130 @@ +// 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 makexml.go -output xml.go + +// Package cldr provides a parser for LDML and related XML formats. +// This package is intended to be used by the table generation tools +// for the various internationalization-related packages. +// As the XML types are generated from the CLDR DTD, and as the CLDR standard +// is periodically amended, this package may change considerably over time. +// This mostly means that data may appear and disappear between versions. +// That is, old code should keep compiling for newer versions, but data +// may have moved or changed. +// CLDR version 22 is the first version supported by this package. +// Older versions may not work. +package cldr // import "golang.org/x/text/unicode/cldr" + +import ( + "fmt" + "sort" +) + +// CLDR provides access to parsed data of the Unicode Common Locale Data Repository. +type CLDR struct { + parent map[string][]string + locale map[string]*LDML + resolved map[string]*LDML + bcp47 *LDMLBCP47 + supp *SupplementalData +} + +func makeCLDR() *CLDR { + return &CLDR{ + parent: make(map[string][]string), + locale: make(map[string]*LDML), + resolved: make(map[string]*LDML), + bcp47: &LDMLBCP47{}, + supp: &SupplementalData{}, + } +} + +// BCP47 returns the parsed BCP47 LDML data. If no such data was parsed, nil is returned. +func (cldr *CLDR) BCP47() *LDMLBCP47 { + return nil +} + +// Draft indicates the draft level of an element. +type Draft int + +const ( + Approved Draft = iota + Contributed + Provisional + Unconfirmed +) + +var drafts = []string{"unconfirmed", "provisional", "contributed", "approved", ""} + +// ParseDraft returns the Draft value corresponding to the given string. The +// empty string corresponds to Approved. +func ParseDraft(level string) (Draft, error) { + if level == "" { + return Approved, nil + } + for i, s := range drafts { + if level == s { + return Unconfirmed - Draft(i), nil + } + } + return Approved, fmt.Errorf("cldr: unknown draft level %q", level) +} + +func (d Draft) String() string { + return drafts[len(drafts)-1-int(d)] +} + +// SetDraftLevel sets which draft levels to include in the evaluated LDML. +// Any draft element for which the draft level is higher than lev will be excluded. +// If multiple draft levels are available for a single element, the one with the +// lowest draft level will be selected, unless preferDraft is true, in which case +// the highest draft will be chosen. +// It is assumed that the underlying LDML is canonicalized. +func (cldr *CLDR) SetDraftLevel(lev Draft, preferDraft bool) { + // TODO: implement + cldr.resolved = make(map[string]*LDML) +} + +// RawLDML returns the LDML XML for id in unresolved form. +// id must be one of the strings returned by Locales. +func (cldr *CLDR) RawLDML(loc string) *LDML { + return cldr.locale[loc] +} + +// LDML returns the fully resolved LDML XML for loc, which must be one of +// the strings returned by Locales. +func (cldr *CLDR) LDML(loc string) (*LDML, error) { + return cldr.resolve(loc) +} + +// Supplemental returns the parsed supplemental data. If no such data was parsed, +// nil is returned. +func (cldr *CLDR) Supplemental() *SupplementalData { + return cldr.supp +} + +// Locales returns the locales for which there exist files. +// Valid sublocales for which there is no file are not included. +// The root locale is always sorted first. +func (cldr *CLDR) Locales() []string { + loc := []string{"root"} + hasRoot := false + for l, _ := range cldr.locale { + if l == "root" { + hasRoot = true + continue + } + loc = append(loc, l) + } + sort.Strings(loc[1:]) + if !hasRoot { + return loc[1:] + } + return loc +} + +// Get fills in the fields of x based on the XPath path. +func Get(e Elem, path string) (res Elem, err error) { + return walkXPath(e, path) +} diff --git a/vendor/golang.org/x/text/unicode/cldr/collate.go b/vendor/golang.org/x/text/unicode/cldr/collate.go new file mode 100644 index 0000000000..80ee28d795 --- /dev/null +++ b/vendor/golang.org/x/text/unicode/cldr/collate.go @@ -0,0 +1,359 @@ +// 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 cldr + +import ( + "bufio" + "encoding/xml" + "errors" + "fmt" + "strconv" + "strings" + "unicode" + "unicode/utf8" +) + +// RuleProcessor can be passed to Collator's Process method, which +// parses the rules and calls the respective method for each rule found. +type RuleProcessor interface { + Reset(anchor string, before int) error + Insert(level int, str, context, extend string) error + Index(id string) +} + +const ( + // cldrIndex is a Unicode-reserved sentinel value used to mark the start + // of a grouping within an index. + // We ignore any rule that starts with this rune. + // See http://unicode.org/reports/tr35/#Collation_Elements for details. + cldrIndex = "\uFDD0" + + // specialAnchor is the format in which to represent logical reset positions, + // such as "first tertiary ignorable". + specialAnchor = "<%s/>" +) + +// Process parses the rules for the tailorings of this collation +// and calls the respective methods of p for each rule found. +func (c Collation) Process(p RuleProcessor) (err error) { + if len(c.Cr) > 0 { + if len(c.Cr) > 1 { + return fmt.Errorf("multiple cr elements, want 0 or 1") + } + return processRules(p, c.Cr[0].Data()) + } + if c.Rules.Any != nil { + return c.processXML(p) + } + return errors.New("no tailoring data") +} + +// processRules parses rules in the Collation Rule Syntax defined in +// http://www.unicode.org/reports/tr35/tr35-collation.html#Collation_Tailorings. +func processRules(p RuleProcessor, s string) (err error) { + chk := func(s string, e error) string { + if err == nil { + err = e + } + return s + } + i := 0 // Save the line number for use after the loop. + scanner := bufio.NewScanner(strings.NewReader(s)) + for ; scanner.Scan() && err == nil; i++ { + for s := skipSpace(scanner.Text()); s != "" && s[0] != '#'; s = skipSpace(s) { + level := 5 + var ch byte + switch ch, s = s[0], s[1:]; ch { + case '&': // followed by or '[' ']' + if s = skipSpace(s); consume(&s, '[') { + s = chk(parseSpecialAnchor(p, s)) + } else { + s = chk(parseAnchor(p, 0, s)) + } + case '<': // sort relation '<'{1,4}, optionally followed by '*'. + for level = 1; consume(&s, '<'); level++ { + } + if level > 4 { + err = fmt.Errorf("level %d > 4", level) + } + fallthrough + case '=': // identity relation, optionally followed by *. + if consume(&s, '*') { + s = chk(parseSequence(p, level, s)) + } else { + s = chk(parseOrder(p, level, s)) + } + default: + chk("", fmt.Errorf("illegal operator %q", ch)) + break + } + } + } + if chk("", scanner.Err()); err != nil { + return fmt.Errorf("%d: %v", i, err) + } + return nil +} + +// parseSpecialAnchor parses the anchor syntax which is either of the form +// ['before' ] +// or +// [