├── vendor ├── golang.org │ └── x │ │ └── sys │ │ ├── unix │ │ ├── .gitignore │ │ ├── endian_big.go │ │ ├── endian_little.go │ │ ├── constants.go │ │ ├── syscall_linux_amd64_gc.go │ │ ├── aliases.go │ │ ├── pagesize_unix.go │ │ ├── fcntl_linux_32bit.go │ │ ├── asm_aix_ppc64.s │ │ ├── asm_solaris_amd64.s │ │ ├── gccgo_linux_amd64.go │ │ ├── syscall_linux_gc.go │ │ ├── race0.go │ │ ├── syscall_solaris_amd64.go │ │ ├── syscall_linux_gc_386.go │ │ ├── fcntl_darwin.go │ │ ├── dirent.go │ │ ├── syscall_linux_gccgo_arm.go │ │ ├── syscall_unix_gc.go │ │ ├── str.go │ │ ├── race.go │ │ ├── env_unix.go │ │ ├── asm_freebsd_arm.s │ │ ├── asm_netbsd_arm.s │ │ ├── asm_openbsd_arm.s │ │ ├── asm_darwin_386.s │ │ ├── asm_freebsd_386.s │ │ ├── asm_netbsd_386.s │ │ ├── asm_openbsd_386.s │ │ ├── asm_darwin_amd64.s │ │ ├── asm_freebsd_amd64.s │ │ ├── asm_freebsd_arm64.s │ │ ├── asm_netbsd_amd64.s │ │ ├── asm_openbsd_amd64.s │ │ ├── asm_dragonfly_amd64.s │ │ ├── asm_darwin_arm.s │ │ ├── bluetooth_linux.go │ │ ├── asm_darwin_arm64.s │ │ ├── dev_darwin.go │ │ ├── dev_aix_ppc.go │ │ ├── syscall_netbsd_amd64.go │ │ ├── syscall_netbsd_386.go │ │ ├── syscall_netbsd_arm.go │ │ ├── syscall_unix_gc_ppc64x.go │ │ ├── dev_aix_ppc64.go │ │ ├── dev_netbsd.go │ │ ├── dev_openbsd.go │ │ ├── ioctl.go │ │ ├── syscall_openbsd_amd64.go │ │ ├── syscall_aix_ppc64.go │ │ ├── syscall_openbsd_386.go │ │ ├── syscall_openbsd_arm.go │ │ ├── fcntl.go │ │ ├── syscall_aix_ppc.go │ │ ├── asm_linux_ppc64x.s │ │ ├── syscall_linux_gccgo_386.go │ │ ├── dev_freebsd.go │ │ ├── dev_dragonfly.go │ │ ├── sockcmsg_linux.go │ │ ├── gccgo_c.c │ │ ├── openbsd_unveil.go │ │ ├── asm_linux_arm64.s │ │ ├── asm_linux_arm.s │ │ ├── asm_linux_s390x.s │ │ ├── zptracearm_linux.go │ │ ├── asm_linux_mipsx.s │ │ ├── asm_linux_mips64x.s │ │ ├── syscall_darwin_libSystem.go │ │ ├── syscall_dragonfly_amd64.go │ │ ├── syscall_freebsd_amd64.go │ │ ├── syscall_freebsd_arm64.go │ │ ├── asm_linux_amd64.s │ │ ├── syscall_freebsd_arm.go │ │ ├── syscall_freebsd_386.go │ │ ├── zptracemips_linux.go │ │ ├── zptracemipsle_linux.go │ │ ├── asm_linux_386.s │ │ ├── dev_linux.go │ │ ├── mkasm_darwin.go │ │ ├── syscall_darwin_arm.go │ │ ├── syscall_darwin_arm64.go │ │ ├── zptrace386_linux.go │ │ ├── syscall_darwin_amd64.go │ │ ├── syscall.go │ │ ├── gccgo.go │ │ ├── syscall_darwin_386.go │ │ └── timestruct.go │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── PATENTS │ │ └── LICENSE ├── github.com │ ├── pkg │ │ └── term │ │ │ ├── termios │ │ │ ├── termios_windows.go │ │ │ ├── ioctl_solaris.go │ │ │ ├── doc.go │ │ │ ├── termios_const.go │ │ │ ├── ioctl_darwin.go │ │ │ ├── ioctl.go │ │ │ ├── termios_const_solaris.go │ │ │ ├── pty_solaris.go │ │ │ ├── pty_linux.go │ │ │ ├── pty_netbsd.go │ │ │ ├── pty_bsd.go │ │ │ ├── pty_darwin.go │ │ │ ├── pty_freebsd.go │ │ │ ├── pty.go │ │ │ ├── termios.go │ │ │ ├── termios_linux.go │ │ │ └── termios_bsd.go │ │ │ └── LICENSE │ ├── mattn │ │ ├── go-tty │ │ │ ├── .travis.yml │ │ │ ├── tty_linux.go │ │ │ ├── tty_bsd.go │ │ │ ├── README.md │ │ │ ├── LICENSE │ │ │ ├── tty_plan9.go │ │ │ ├── tty.go │ │ │ └── tty_unix.go │ │ ├── go-isatty │ │ │ ├── doc.go │ │ │ ├── .travis.yml │ │ │ ├── isatty_others.go │ │ │ ├── isatty_solaris.go │ │ │ ├── isatty_linux.go │ │ │ ├── isatty_appengine.go │ │ │ ├── isatty_bsd.go │ │ │ ├── isatty_linux_ppc64x.go │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── isatty_windows.go │ │ ├── go-runewidth │ │ │ ├── runewidth_appengine.go │ │ │ ├── .travis.yml │ │ │ ├── runewidth_js.go │ │ │ ├── runewidth_windows.go │ │ │ ├── README.mkd │ │ │ ├── LICENSE │ │ │ └── runewidth_posix.go │ │ └── go-colorable │ │ │ ├── .travis.yml │ │ │ ├── colorable_appengine.go │ │ │ ├── colorable_others.go │ │ │ ├── LICENSE │ │ │ ├── noncolorable.go │ │ │ └── README.md │ ├── stretchr │ │ └── testify │ │ │ ├── assert │ │ │ ├── assertion_format.go.tmpl │ │ │ ├── assertion_forward.go.tmpl │ │ │ ├── errors.go │ │ │ ├── forward_assertions.go │ │ │ └── doc.go │ │ │ └── LICENSE │ ├── c-bata │ │ └── go-prompt │ │ │ ├── .gitignore │ │ │ ├── signal_windows.go │ │ │ ├── Makefile │ │ │ ├── Gopkg.toml │ │ │ ├── signal_posix.go │ │ │ ├── LICENSE │ │ │ ├── output_windows.go │ │ │ ├── shortcut.go │ │ │ ├── Gopkg.lock │ │ │ ├── key_bind.go │ │ │ ├── key_string.go │ │ │ ├── key_bind_func.go │ │ │ ├── output_posix.go │ │ │ ├── history.go │ │ │ ├── filter.go │ │ │ ├── input_windows.go │ │ │ ├── key.go │ │ │ ├── CHANGELOG.md │ │ │ └── emacs.go │ ├── davecgh │ │ └── go-spew │ │ │ ├── LICENSE │ │ │ └── spew │ │ │ └── bypasssafe.go │ └── pmezard │ │ └── go-difflib │ │ └── LICENSE └── modules.txt ├── test.scm ├── screenshots └── repl.gif ├── .gitignore ├── go.mod ├── cmd └── goscheme │ └── main.go ├── repl_test.go ├── parser.go ├── env_test.go ├── type_test.go ├── go.sum ├── .travis.yml ├── example.scm ├── lexer_test.go └── README.md /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /test.scm: -------------------------------------------------------------------------------- 1 | (define (test-method x) x) 2 | (displayln "load success") -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/termios_windows.go: -------------------------------------------------------------------------------- 1 | package termios 2 | -------------------------------------------------------------------------------- /screenshots/repl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrlin/goscheme/HEAD/screenshots/repl.gif -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-tty/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - tip 5 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-tty/tty_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | 3 | package tty 4 | 5 | const ( 6 | ioctlReadTermios = 0x5401 // syscall.TCGETS 7 | ioctlWriteTermios = 0x5402 // syscall.TCSETS 8 | ) 9 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package runewidth 4 | 5 | // IsEastAsian return true if the current locale is CJK 6 | func IsEastAsian() bool { 7 | return false 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/ioctl_solaris.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | import "golang.org/x/sys/unix" 4 | 5 | func ioctl(fd, request, argp uintptr) error { 6 | return unix.IoctlSetInt(int(fd), uint(request), int(argp)) 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/doc.go: -------------------------------------------------------------------------------- 1 | // Package termios implements the low level termios(3) terminal line discipline facilities. 2 | // 3 | // For a higher level interface please use the github.com/pkg/term package. 4 | package termios 5 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/termios_const.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!solaris 2 | 3 | package termios 4 | 5 | const ( 6 | TCIFLUSH = 0 7 | TCOFLUSH = 1 8 | TCIOFLUSH = 2 9 | 10 | TCSANOW = 0 11 | TCSADRAIN = 1 12 | TCSAFLUSH = 2 13 | ) 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | bin/ 8 | 9 | # Test binary, build with `go test -c` 10 | *.test 11 | 12 | # Output of the go coverage tool, specifically when used with LiteIDE 13 | *.out 14 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentFormat}} 2 | func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-tty/tty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin dragonfly freebsd netbsd openbsd 2 | 3 | package tty 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | const ( 10 | ioctlReadTermios = syscall.TIOCGETA 11 | ioctlWriteTermios = syscall.TIOCSETA 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | before_install: 5 | - go get github.com/mattn/goveralls 6 | - go get golang.org/x/tools/cmd/cover 7 | script: 8 | - $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL 9 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_js.go: -------------------------------------------------------------------------------- 1 | // +build js 2 | // +build !appengine 3 | 4 | package runewidth 5 | 6 | func IsEastAsian() bool { 7 | // TODO: Implement this for the web. Detect east asian in a compatible way, and return true. 8 | return false 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/ioctl_darwin.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | const ( 4 | _IOC_PARAM_SHIFT = 13 5 | _IOC_PARAM_MASK = (1 << _IOC_PARAM_SHIFT) - 1 6 | ) 7 | 8 | func _IOC_PARM_LEN(ioctl uintptr) uintptr { 9 | return (ioctl >> 16) & _IOC_PARAM_MASK 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | 5 | before_install: 6 | - go get github.com/mattn/goveralls 7 | - go get golang.org/x/tools/cmd/cover 8 | script: 9 | - $HOME/gopath/bin/goveralls -repotoken xnXqRGwgW3SXIguzxf90ZSK1GPYZPaGrw 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/ioctl.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!solaris 2 | 3 | package termios 4 | 5 | import "syscall" 6 | 7 | func ioctl(fd, request, argp uintptr) error { 8 | if _, _, e := syscall.Syscall6(syscall.SYS_IOCTL, fd, request, argp, 0, 0, 0); e != 0 { 9 | return e 10 | } 11 | return nil 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | before_install: 10 | - go get github.com/mattn/goveralls 11 | - go get golang.org/x/tools/cmd/cover 12 | script: 13 | - $HOME/gopath/bin/goveralls -repotoken 3gHdORO5k5ziZcWMBxnd9LrMZaJs8m9x5 14 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/termios_const_solaris.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | // #include 4 | import "C" 5 | 6 | const ( 7 | TCIFLUSH = C.TCIFLUSH 8 | TCOFLUSH = C.TCOFLUSH 9 | TCIOFLUSH = C.TCIOFLUSH 10 | 11 | TCSANOW = C.TCSANOW 12 | TCSADRAIN = C.TCSADRAIN 13 | TCSAFLUSH = C.TCSAFLUSH 14 | ) 15 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 7 | // terminal. This is also always false on this environment. 8 | func IsCygwinTerminal(fd uintptr) bool { 9 | return false 10 | } 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | pkg/ 8 | _obj 9 | _test 10 | 11 | # Architecture specific extensions/prefixes 12 | *.cgo1.go 13 | *.cgo2.c 14 | _cgo_defun.c 15 | _cgo_gotypes.go 16 | _cgo_export.* 17 | 18 | _testmain.go 19 | 20 | *.exe 21 | *.test 22 | *.prof 23 | 24 | # Glide 25 | vendor/ 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs 17 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/xrlin/goscheme 2 | 3 | require ( 4 | github.com/c-bata/go-prompt v0.2.3 5 | github.com/mattn/go-colorable v0.0.9 // indirect 6 | github.com/mattn/go-isatty v0.0.4 // indirect 7 | github.com/mattn/go-runewidth v0.0.4 // indirect 8 | github.com/mattn/go-tty v0.0.0-20181127064339-e4f871175a2f // indirect 9 | github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 // indirect 10 | github.com/stretchr/testify v1.3.0 11 | golang.org/x/sys v0.0.0-20190114130336-2be517255631 // indirect 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | var termio unix.Termio 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) 15 | return err == nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 11 | // 12 | 13 | TEXT ·syscall6(SB),NOSPLIT,$0-88 14 | JMP syscall·syscall6(SB) 15 | 16 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSyscall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | // +build !appengine,!ppc64,!ppc64le 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TCGETS 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package isatty 4 | 5 | // IsTerminal returns true if the file descriptor is terminal which 6 | // is always false on on appengine classic which is a sandboxed PaaS. 7 | func IsTerminal(fd uintptr) bool { 8 | return false 9 | } 10 | 11 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 12 | // terminal. This is also always false on this environment. 13 | func IsCygwinTerminal(fd uintptr) bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | // +build ppc64 ppc64le 3 | 4 | package isatty 5 | 6 | import ( 7 | "unsafe" 8 | 9 | syscall "golang.org/x/sys/unix" 10 | ) 11 | 12 | const ioctlReadTermios = syscall.TCGETS 13 | 14 | // IsTerminal return true if the file descriptor is terminal. 15 | func IsTerminal(fd uintptr) bool { 16 | var termios syscall.Termios 17 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 18 | return err == 0 19 | } 20 | -------------------------------------------------------------------------------- /cmd/goscheme/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/xrlin/goscheme" 6 | "os" 7 | ) 8 | 9 | func main() { 10 | var filePath string 11 | if len(os.Args) >= 2 { 12 | filePath = os.Args[1] 13 | } 14 | var interpreter *goscheme.Interpreter 15 | if filePath == "" { 16 | interpreter = goscheme.NewREPLInterpreter() 17 | } else { 18 | file, err := os.Open(filePath) 19 | if err != nil { 20 | fmt.Println(err) 21 | return 22 | } 23 | interpreter = goscheme.NewFileInterpreter(file) 24 | } 25 | interpreter.Run() 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /repl_test.go: -------------------------------------------------------------------------------- 1 | package goscheme 2 | 3 | import ( 4 | "bytes" 5 | "github.com/stretchr/testify/assert" 6 | "testing" 7 | ) 8 | 9 | func TestNeededIndents(t *testing.T) { 10 | testCases := []struct { 11 | input string 12 | expected int 13 | }{ 14 | {input: "fn", expected: 0}, 15 | {input: "(fn", expected: 1}, 16 | {input: "(fn x)", expected: 0}, 17 | {input: `(fn 18 | x)`, expected: 0}, 19 | } 20 | for _, c := range testCases { 21 | ret := neededIndents(bytes.NewReader([]byte(c.input))) 22 | assert.Equal(t, c.expected, ret) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build !appengine 3 | 4 | package runewidth 5 | 6 | import ( 7 | "syscall" 8 | ) 9 | 10 | var ( 11 | kernel32 = syscall.NewLazyDLL("kernel32") 12 | procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP") 13 | ) 14 | 15 | // IsEastAsian return true if the current locale is CJK 16 | func IsEastAsian() bool { 17 | r1, _, _ := procGetConsoleOutputCP.Call() 18 | if r1 == 0 { 19 | return false 20 | } 21 | 22 | switch int(r1) { 23 | case 932, 51932, 936, 949, 950: 24 | return true 25 | } 26 | 27 | return false 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (cmsg *Cmsghdr) SetLen(length int) { 22 | cmsg.Len = uint32(length) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo,386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import "unsafe" 8 | 9 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 10 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 11 | return fcntl(int(fd), cmd, arg) 12 | } 13 | 14 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 15 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 16 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/pty_solaris.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | // #include 4 | import "C" 5 | 6 | import "syscall" 7 | 8 | func open_pty_master() (uintptr, error) { 9 | return open_device("/dev/ptmx") 10 | } 11 | 12 | func Ptsname(fd uintptr) (string, error) { 13 | slavename := C.GoString(C.ptsname(C.int(fd))) 14 | return slavename, nil 15 | } 16 | 17 | func grantpt(fd uintptr) error { 18 | rc := C.grantpt(C.int(fd)) 19 | if rc == 0 { 20 | return nil 21 | } else { 22 | return syscall.Errno(rc) 23 | } 24 | } 25 | 26 | func unlockpt(fd uintptr) error { 27 | rc := C.unlockpt(C.int(fd)) 28 | if rc == 0 { 29 | return nil 30 | } else { 31 | return syscall.Errno(rc) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dirent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // ParseDirent parses up to max directory entries in buf, 12 | // appending the names to names. It returns the number of 13 | // bytes consumed from buf, the number of entries added 14 | // to names, and the new names slice. 15 | func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { 16 | return syscall.ParseDirent(buf, max, names) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo,!ppc64le,!ppc64 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/pty_linux.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | import ( 4 | "fmt" 5 | "syscall" 6 | "unsafe" 7 | ) 8 | 9 | func open_pty_master() (uintptr, error) { 10 | return open_device("/dev/ptmx") 11 | } 12 | 13 | func Ptsname(fd uintptr) (string, error) { 14 | var n uintptr 15 | err := ioctl(fd, syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n))) 16 | if err != nil { 17 | return "", err 18 | } 19 | return fmt.Sprintf("/dev/pts/%d", n), nil 20 | } 21 | 22 | func grantpt(fd uintptr) error { 23 | var n uintptr 24 | return ioctl(fd, syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n))) 25 | } 26 | 27 | func unlockpt(fd uintptr) error { 28 | var n uintptr 29 | return ioctl(fd, syscall.TIOCSPTLCK, uintptr(unsafe.Pointer(&n))) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/pty_netbsd.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | import ( 4 | "bytes" 5 | 6 | "golang.org/x/sys/unix" 7 | ) 8 | 9 | func open_pty_master() (uintptr, error) { 10 | fd, err := unix.Open("/dev/ptmx", unix.O_NOCTTY|unix.O_RDWR, 0666) 11 | if err != nil { 12 | return 0, err 13 | } 14 | return uintptr(fd), nil 15 | } 16 | 17 | func Ptsname(fd uintptr) (string, error) { 18 | ptm, err := unix.IoctlGetPtmget(int(fd), unix.TIOCPTSNAME) 19 | if err != nil { 20 | return "", err 21 | } 22 | return string(ptm.Sn[:bytes.IndexByte(ptm.Sn[:], 0)]), nil 23 | } 24 | 25 | func grantpt(fd uintptr) error { 26 | return unix.IoctlSetInt(int(fd), unix.TIOCGRANTPT, 0) 27 | } 28 | 29 | func unlockpt(fd uintptr) error { 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,race linux,race freebsd,race 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package colorable 4 | 5 | import ( 6 | "io" 7 | "os" 8 | 9 | _ "github.com/mattn/go-isatty" 10 | ) 11 | 12 | // NewColorable return new instance of Writer which handle escape sequence. 13 | func NewColorable(file *os.File) io.Writer { 14 | if file == nil { 15 | panic("nil passed instead of *os.File to NewColorable()") 16 | } 17 | 18 | return file 19 | } 20 | 21 | // NewColorableStdout return new instance of Writer which handle escape sequence for stdout. 22 | func NewColorableStdout() io.Writer { 23 | return os.Stdout 24 | } 25 | 26 | // NewColorableStderr return new instance of Writer which handle escape sequence for stderr. 27 | func NewColorableStderr() io.Writer { 28 | return os.Stderr 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !appengine 3 | 4 | package colorable 5 | 6 | import ( 7 | "io" 8 | "os" 9 | 10 | _ "github.com/mattn/go-isatty" 11 | ) 12 | 13 | // NewColorable return new instance of Writer which handle escape sequence. 14 | func NewColorable(file *os.File) io.Writer { 15 | if file == nil { 16 | panic("nil passed instead of *os.File to NewColorable()") 17 | } 18 | 19 | return file 20 | } 21 | 22 | // NewColorableStdout return new instance of Writer which handle escape sequence for stdout. 23 | func NewColorableStdout() io.Writer { 24 | return os.Stdout 25 | } 26 | 27 | // NewColorableStderr return new instance of Writer which handle escape sequence for stderr. 28 | func NewColorableStderr() io.Writer { 29 | return os.Stderr 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/c-bata/go-prompt v0.2.3 2 | github.com/c-bata/go-prompt 3 | # github.com/davecgh/go-spew v1.1.0 4 | github.com/davecgh/go-spew/spew 5 | # github.com/mattn/go-colorable v0.0.9 6 | github.com/mattn/go-colorable 7 | # github.com/mattn/go-isatty v0.0.4 8 | github.com/mattn/go-isatty 9 | # github.com/mattn/go-runewidth v0.0.4 10 | github.com/mattn/go-runewidth 11 | # github.com/mattn/go-tty v0.0.0-20181127064339-e4f871175a2f 12 | github.com/mattn/go-tty 13 | # github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 14 | github.com/pkg/term/termios 15 | # github.com/pmezard/go-difflib v1.0.0 16 | github.com/pmezard/go-difflib/difflib 17 | # github.com/stretchr/testify v1.3.0 18 | github.com/stretchr/testify/assert 19 | # golang.org/x/sys v0.0.0-20190114130336-2be517255631 20 | golang.org/x/sys/unix 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/pty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build dragonfly openbsd 2 | 3 | package termios 4 | 5 | // #include 6 | import "C" 7 | 8 | import "syscall" 9 | 10 | func open_pty_master() (uintptr, error) { 11 | rc := C.posix_openpt(syscall.O_NOCTTY | syscall.O_RDWR) 12 | if rc < 0 { 13 | return 0, syscall.Errno(rc) 14 | } 15 | return uintptr(rc), nil 16 | } 17 | 18 | func Ptsname(fd uintptr) (string, error) { 19 | slavename := C.GoString(C.ptsname(C.int(fd))) 20 | return slavename, nil 21 | } 22 | 23 | func grantpt(fd uintptr) error { 24 | rc := C.grantpt(C.int(fd)) 25 | if rc == 0 { 26 | return nil 27 | } 28 | return syscall.Errno(rc) 29 | } 30 | 31 | func unlockpt(fd uintptr) error { 32 | rc := C.unlockpt(C.int(fd)) 33 | if rc == 0 { 34 | return nil 35 | } 36 | return syscall.Errno(rc) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/pty_darwin.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | import ( 4 | "errors" 5 | "syscall" 6 | "unsafe" 7 | ) 8 | 9 | func open_pty_master() (uintptr, error) { 10 | return open_device("/dev/ptmx") 11 | } 12 | 13 | func Ptsname(fd uintptr) (string, error) { 14 | n := make([]byte, _IOC_PARM_LEN(syscall.TIOCPTYGNAME)) 15 | 16 | err := ioctl(fd, syscall.TIOCPTYGNAME, uintptr(unsafe.Pointer(&n[0]))) 17 | if err != nil { 18 | return "", err 19 | } 20 | 21 | for i, c := range n { 22 | if c == 0 { 23 | return string(n[:i]), nil 24 | } 25 | } 26 | return "", errors.New("TIOCPTYGNAME string not NUL-terminated") 27 | } 28 | 29 | func grantpt(fd uintptr) error { 30 | return ioctl(fd, syscall.TIOCPTYGRANT, 0) 31 | } 32 | 33 | func unlockpt(fd uintptr) error { 34 | return ioctl(fd, syscall.TIOCPTYUNLK, 0) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-tty/README.md: -------------------------------------------------------------------------------- 1 | # go-tty 2 | 3 | Simple tty utility 4 | 5 | ## Usage 6 | 7 | ```go 8 | tty, err := tty.Open() 9 | if err != nil { 10 | log.Fatal(err) 11 | } 12 | defer tty.Close() 13 | 14 | for { 15 | r, err := tty.ReadRune() 16 | if err != nil { 17 | log.Fatal(err) 18 | } 19 | // handle key event 20 | } 21 | ``` 22 | 23 | if you are on windows and want to display ANSI colors, use go-colorable. 24 | 25 | ```go 26 | tty, err := tty.Open() 27 | if err != nil { 28 | log.Fatal(err) 29 | } 30 | defer tty.Close() 31 | 32 | out := colorable.NewColorable(tty.Output()) 33 | 34 | fmt.Fprintln(out, "\x1b[2J") 35 | ``` 36 | 37 | ## Installation 38 | 39 | ``` 40 | $ go get github.com/mattn/go-tty 41 | ``` 42 | 43 | ## License 44 | 45 | MIT 46 | 47 | ## Author 48 | 49 | Yasuhiro Matsumoto (a.k.a mattn) 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used by AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev >> 16) & 0xffff) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32(dev & 0xffff) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | return uint64(((major) << 16) | (minor)) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64le ppc64 7 | // +build !gccgo 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 14 | return syscall.Syscall(trap, a1, a2, a3) 15 | } 16 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 17 | return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) 18 | } 19 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 20 | return syscall.RawSyscall(trap, a1, a2, a3) 21 | } 22 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 23 | return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/README.mkd: -------------------------------------------------------------------------------- 1 | go-runewidth 2 | ============ 3 | 4 | [![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth) 5 | [![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD) 6 | [![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth) 7 | [![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth) 8 | 9 | Provides functions to get fixed width of the character or string. 10 | 11 | Usage 12 | ----- 13 | 14 | ```go 15 | runewidth.StringWidth("つのだ☆HIRO") == 12 16 | ``` 17 | 18 | 19 | Author 20 | ------ 21 | 22 | Yasuhiro Matsumoto 23 | 24 | License 25 | ------- 26 | 27 | under the MIT License: http://mattn.mit-license.org/2013 28 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/signal_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package prompt 4 | 5 | import ( 6 | "log" 7 | "os" 8 | "os/signal" 9 | "syscall" 10 | ) 11 | 12 | func (p *Prompt) handleSignals(exitCh chan int, winSizeCh chan *WinSize, stop chan struct{}) { 13 | sigCh := make(chan os.Signal, 1) 14 | signal.Notify( 15 | sigCh, 16 | syscall.SIGINT, 17 | syscall.SIGTERM, 18 | syscall.SIGQUIT, 19 | ) 20 | 21 | for { 22 | select { 23 | case <-stop: 24 | log.Println("[INFO] stop handleSignals") 25 | return 26 | case s := <-sigCh: 27 | switch s { 28 | 29 | case syscall.SIGINT: // kill -SIGINT XXXX or Ctrl+c 30 | log.Println("[SIGNAL] Catch SIGINT") 31 | exitCh <- 0 32 | 33 | case syscall.SIGTERM: // kill -SIGTERM XXXX 34 | log.Println("[SIGNAL] Catch SIGTERM") 35 | exitCh <- 1 36 | 37 | case syscall.SIGQUIT: // kill -SIGQUIT XXXX 38 | log.Println("[SIGNAL] Catch SIGQUIT") 39 | exitCh <- 0 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/pty_freebsd.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | import ( 4 | "fmt" 5 | "syscall" 6 | "unsafe" 7 | ) 8 | 9 | func posix_openpt(oflag int) (fd uintptr, err error) { 10 | // Copied from debian-golang-pty/pty_freebsd.go. 11 | r0, _, e1 := syscall.Syscall(syscall.SYS_POSIX_OPENPT, uintptr(oflag), 0, 0) 12 | fd = uintptr(r0) 13 | if e1 != 0 { 14 | err = e1 15 | } 16 | return 17 | } 18 | 19 | func open_pty_master() (uintptr, error) { 20 | return posix_openpt(syscall.O_NOCTTY | syscall.O_RDWR | syscall.O_CLOEXEC) 21 | } 22 | 23 | func Ptsname(fd uintptr) (string, error) { 24 | var n uintptr 25 | err := ioctl(fd, syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n))) 26 | if err != nil { 27 | return "", err 28 | } 29 | return fmt.Sprintf("/dev/pts/%d", n), nil 30 | } 31 | 32 | func grantpt(fd uintptr) error { 33 | var n uintptr 34 | return ioctl(fd, syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n))) 35 | } 36 | 37 | func unlockpt(fd uintptr) error { 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/Makefile: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL := help 2 | 3 | .PHONY: setup 4 | setup: ## Setup for required tools. 5 | go get github.com/golang/lint/golint 6 | go get golang.org/x/tools/cmd/goimports 7 | go get golang.org/x/tools/cmd/stringer 8 | go get -u github.com/golang/dep/cmd/dep 9 | dep ensure 10 | 11 | .PHONY: fmt 12 | fmt: ## Formatting source codes. 13 | @goimports -w . 14 | 15 | .PHONY: lint 16 | lint: ## Run golint and go vet. 17 | @golint . 18 | @go vet . 19 | 20 | .PHONY: test 21 | test: ## Run the tests. 22 | @go test . 23 | 24 | .PHONY: coverage 25 | cover: ## Run the tests. 26 | @go test -coverprofile=coverage.o 27 | @go tool cover -func=coverage.o 28 | 29 | .PHONY: race-test 30 | race-test: ## Checking the race condition. 31 | @go test -race . 32 | 33 | .PHONY: help 34 | help: ## Show help text 35 | @echo "Commands:" 36 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-10s\033[0m %s\n", $$1, $$2}' 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev & 0x3fffffff00000000) >> 32) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32((dev & 0x00000000ffffffff) >> 0) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | var DEVNO64 uint64 27 | DEVNO64 = 0x8000000000000000 28 | return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/Gopkg.toml: -------------------------------------------------------------------------------- 1 | 2 | # Gopkg.toml example 3 | # 4 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 5 | # for detailed Gopkg.toml documentation. 6 | # 7 | # required = ["github.com/user/thing/cmd/thing"] 8 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 9 | # 10 | # [[constraint]] 11 | # name = "github.com/user/project" 12 | # version = "1.0.0" 13 | # 14 | # [[constraint]] 15 | # name = "github.com/user/project2" 16 | # branch = "dev" 17 | # source = "github.com/myfork/project2" 18 | # 19 | # [[override]] 20 | # name = "github.com/x/y" 21 | # version = "2.4.0" 22 | 23 | 24 | [[constraint]] 25 | name = "github.com/mattn/go-colorable" 26 | version = "0.0.9" 27 | 28 | [[constraint]] 29 | branch = "master" 30 | name = "github.com/mattn/go-tty" 31 | 32 | [[constraint]] 33 | branch = "master" 34 | name = "github.com/pkg/term" 35 | 36 | [[constraint]] 37 | branch = "master" 38 | name = "github.com/mattn/go-runewidth" 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "runtime" 10 | 11 | // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. 12 | // 13 | // To change fd's window size, the req argument should be TIOCSWINSZ. 14 | func IoctlSetWinsize(fd int, req uint, value *Winsize) error { 15 | // TODO: if we get the chance, remove the req parameter and 16 | // hardcode TIOCSWINSZ. 17 | err := ioctlSetWinsize(fd, req, value) 18 | runtime.KeepAlive(value) 19 | return err 20 | } 21 | 22 | // IoctlSetTermios performs an ioctl on fd with a *Termios. 23 | // 24 | // The req value will usually be TCSETA or TIOCSETA. 25 | func IoctlSetTermios(fd int, req uint, value *Termios) error { 26 | // TODO: if we get the chance, remove the req parameter. 27 | err := ioctlSetTermios(fd, req, value) 28 | runtime.KeepAlive(value) 29 | return err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/pty.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "syscall" 7 | ) 8 | 9 | func open_device(path string) (uintptr, error) { 10 | fd, err := syscall.Open(path, syscall.O_NOCTTY|syscall.O_RDWR|syscall.O_CLOEXEC, 0666) 11 | if err != nil { 12 | return 0, fmt.Errorf("unable to open %q: %v", path, err) 13 | } 14 | return uintptr(fd), nil 15 | } 16 | 17 | // Pty returns a UNIX 98 pseudoterminal device. 18 | // Pty returns a pair of fds representing the master and slave pair. 19 | func Pty() (*os.File, *os.File, error) { 20 | ptm, err := open_pty_master() 21 | if err != nil { 22 | return nil, nil, err 23 | } 24 | 25 | sname, err := Ptsname(ptm) 26 | if err != nil { 27 | return nil, nil, err 28 | } 29 | 30 | err = grantpt(ptm) 31 | if err != nil { 32 | return nil, nil, err 33 | } 34 | 35 | err = unlockpt(ptm) 36 | if err != nil { 37 | return nil, nil, err 38 | } 39 | 40 | pts, err := open_device(sname) 41 | if err != nil { 42 | return nil, nil, err 43 | } 44 | return os.NewFile(uintptr(ptm), "ptm"), os.NewFile(uintptr(pts), sname), nil 45 | } 46 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: sec, Nsec: nsec} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int64(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (cmsg *Cmsghdr) SetLen(length int) { 33 | cmsg.Len = uint32(length) 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/386 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/arm the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 16 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 17 | valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg)) 18 | var err error 19 | if errno != 0 { 20 | err = errno 21 | } 22 | return int(valptr), err 23 | } 24 | 25 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 26 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 27 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 28 | if errno == 0 { 29 | return nil 30 | } 31 | return errno 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (cmsg *Cmsghdr) SetLen(length int) { 33 | cmsg.Len = uint32(length) 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/signal_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package prompt 4 | 5 | import ( 6 | "log" 7 | "os" 8 | "os/signal" 9 | "syscall" 10 | ) 11 | 12 | func (p *Prompt) handleSignals(exitCh chan int, winSizeCh chan *WinSize, stop chan struct{}) { 13 | in := p.in 14 | sigCh := make(chan os.Signal, 1) 15 | signal.Notify( 16 | sigCh, 17 | syscall.SIGINT, 18 | syscall.SIGTERM, 19 | syscall.SIGQUIT, 20 | syscall.SIGWINCH, 21 | ) 22 | 23 | for { 24 | select { 25 | case <-stop: 26 | log.Println("[INFO] stop handleSignals") 27 | return 28 | case s := <-sigCh: 29 | switch s { 30 | case syscall.SIGINT: // kill -SIGINT XXXX or Ctrl+c 31 | log.Println("[SIGNAL] Catch SIGINT") 32 | exitCh <- 0 33 | 34 | case syscall.SIGTERM: // kill -SIGTERM XXXX 35 | log.Println("[SIGNAL] Catch SIGTERM") 36 | exitCh <- 1 37 | 38 | case syscall.SIGQUIT: // kill -SIGQUIT XXXX 39 | log.Println("[SIGNAL] Catch SIGQUIT") 40 | exitCh <- 0 41 | 42 | case syscall.SIGWINCH: 43 | log.Println("[SIGNAL] Catch SIGWINCH") 44 | winSizeCh <- in.GetWinSize() 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 19 | BL runtime·entersyscall(SB) 20 | MOVD a1+8(FP), R3 21 | MOVD a2+16(FP), R4 22 | MOVD a3+24(FP), R5 23 | MOVD R0, R6 24 | MOVD R0, R7 25 | MOVD R0, R8 26 | MOVD trap+0(FP), R9 // syscall entry 27 | SYSCALL R9 28 | MOVD R3, r1+32(FP) 29 | MOVD R4, r2+40(FP) 30 | BL runtime·exitsyscall(SB) 31 | RET 32 | 33 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 34 | MOVD a1+8(FP), R3 35 | MOVD a2+16(FP), R4 36 | MOVD a3+24(FP), R5 37 | MOVD R0, R6 38 | MOVD R0, R7 39 | MOVD R0, R8 40 | MOVD trap+0(FP), R9 // syscall entry 41 | SYSCALL R9 42 | MOVD R3, r1+32(FP) 43 | MOVD R4, r2+40(FP) 44 | RET 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,386 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | 22 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 23 | fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 24 | return int(fd), err 25 | } 26 | 27 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 28 | fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 29 | return int(fd), err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Masashi SHIBATA 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-tty/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2018 Mat Ryer and Tyler Bunnell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /parser.go: -------------------------------------------------------------------------------- 1 | package goscheme 2 | 3 | import "fmt" 4 | 5 | // Parse read and parse the tokens to construct a syntax tree represents in nested slices. 6 | func Parse(tokens *[]string) (ret []Expression, err error) { 7 | defer func() { 8 | if r := recover(); r != nil { 9 | err = fmt.Errorf("%s", r) 10 | } 11 | }() 12 | 13 | for len(*tokens) > 0 { 14 | ret = append(ret, readTokens(tokens)) 15 | } 16 | return 17 | } 18 | 19 | func readTokens(tokens *[]string) Expression { 20 | if len(*tokens) == 0 { 21 | return nil 22 | } 23 | token := (*tokens)[0] 24 | *tokens = (*tokens)[1:] 25 | 26 | switch token { 27 | case "(": 28 | ret := make([]Expression, 0) 29 | for len(*tokens) >= 0 && (*tokens)[0] != ")" { 30 | nextPart := readTokens(tokens) 31 | ret = append(ret, nextPart) 32 | } 33 | if len(*tokens) == 0 { 34 | panic("syntax error: missing ')'") 35 | } 36 | *tokens = (*tokens)[1:] 37 | return ret 38 | case ")": 39 | panic("syntax error: unexpected ')'") 40 | case "'": 41 | ret := make([]Expression, 0, 4) 42 | ret = append(ret, "quote") 43 | nextPart := readTokens(tokens) 44 | ret = append(ret, nextPart) 45 | return ret 46 | default: 47 | return token 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/noncolorable.go: -------------------------------------------------------------------------------- 1 | package colorable 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | ) 7 | 8 | // NonColorable hold writer but remove escape sequence. 9 | type NonColorable struct { 10 | out io.Writer 11 | } 12 | 13 | // NewNonColorable return new instance of Writer which remove escape sequence from Writer. 14 | func NewNonColorable(w io.Writer) io.Writer { 15 | return &NonColorable{out: w} 16 | } 17 | 18 | // Write write data on console 19 | func (w *NonColorable) Write(data []byte) (n int, err error) { 20 | er := bytes.NewReader(data) 21 | var bw [1]byte 22 | loop: 23 | for { 24 | c1, err := er.ReadByte() 25 | if err != nil { 26 | break loop 27 | } 28 | if c1 != 0x1b { 29 | bw[0] = c1 30 | w.out.Write(bw[:]) 31 | continue 32 | } 33 | c2, err := er.ReadByte() 34 | if err != nil { 35 | break loop 36 | } 37 | if c2 != 0x5b { 38 | continue 39 | } 40 | 41 | var buf bytes.Buffer 42 | for { 43 | c, err := er.ReadByte() 44 | if err != nil { 45 | break loop 46 | } 47 | if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { 48 | break 49 | } 50 | buf.Write([]byte(string(c))) 51 | } 52 | } 53 | 54 | return len(data), nil 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-tty/tty_plan9.go: -------------------------------------------------------------------------------- 1 | package tty 2 | 3 | import ( 4 | "bufio" 5 | "os" 6 | "syscall" 7 | ) 8 | 9 | type TTY struct { 10 | in *os.File 11 | bin *bufio.Reader 12 | out *os.File 13 | } 14 | 15 | func open() (*TTY, error) { 16 | tty := new(TTY) 17 | 18 | in, err := os.Open("/dev/cons") 19 | if err != nil { 20 | return nil, err 21 | } 22 | tty.in = in 23 | tty.bin = bufio.NewReader(in) 24 | 25 | out, err := os.OpenFile("/dev/cons", syscall.O_WRONLY, 0) 26 | if err != nil { 27 | return nil, err 28 | } 29 | tty.out = out 30 | 31 | return tty, nil 32 | } 33 | 34 | func (tty *TTY) buffered() bool { 35 | return tty.bin.Buffered() > 0 36 | } 37 | 38 | func (tty *TTY) readRune() (rune, error) { 39 | r, _, err := tty.bin.ReadRune() 40 | return r, err 41 | } 42 | 43 | func (tty *TTY) close() (err error) { 44 | if err2 := tty.in.Close(); err2 != nil { 45 | err = err2 46 | } 47 | if err2 := tty.out.Close(); err2 != nil { 48 | err = err2 49 | } 50 | return 51 | } 52 | 53 | func (tty *TTY) size() (int, int, error) { 54 | return 80, 24, nil 55 | } 56 | 57 | func (tty *TTY) input() *os.File { 58 | return tty.in 59 | } 60 | 61 | func (tty *TTY) output() *os.File { 62 | return tty.out 63 | } 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Socket control messages 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // UnixCredentials encodes credentials into a socket control message 12 | // for sending to another process. This can be used for 13 | // authentication. 14 | func UnixCredentials(ucred *Ucred) []byte { 15 | b := make([]byte, CmsgSpace(SizeofUcred)) 16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 17 | h.Level = SOL_SOCKET 18 | h.Type = SCM_CREDENTIALS 19 | h.SetLen(CmsgLen(SizeofUcred)) 20 | *((*Ucred)(cmsgData(h))) = *ucred 21 | return b 22 | } 23 | 24 | // ParseUnixCredentials decodes a socket control message that contains 25 | // credentials in a Ucred structure. To receive such a message, the 26 | // SO_PASSCRED option must be enabled on the socket. 27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { 28 | if m.Header.Level != SOL_SOCKET { 29 | return nil, EINVAL 30 | } 31 | if m.Header.Type != SCM_CREDENTIALS { 32 | return nil, EINVAL 33 | } 34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) 35 | return &ucred, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | // +build !aix 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #define _STRINGIFY2_(x) #x 13 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 14 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 15 | 16 | // Call syscall from C code because the gccgo support for calling from 17 | // Go to C does not support varargs functions. 18 | 19 | struct ret { 20 | uintptr_t r; 21 | uintptr_t err; 22 | }; 23 | 24 | struct ret 25 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 26 | { 27 | struct ret r; 28 | 29 | errno = 0; 30 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 31 | r.err = errno; 32 | return r; 33 | } 34 | 35 | uintptr_t 36 | gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 37 | { 38 | return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/output_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package prompt 4 | 5 | import ( 6 | "io" 7 | 8 | "github.com/mattn/go-colorable" 9 | ) 10 | 11 | // WindowsWriter is a ConsoleWriter implementation for Win32 console. 12 | // Output is converted from VT100 escape sequences by mattn/go-colorable. 13 | type WindowsWriter struct { 14 | VT100Writer 15 | out io.Writer 16 | } 17 | 18 | // Flush to flush buffer 19 | func (w *WindowsWriter) Flush() error { 20 | _, err := w.out.Write(w.buffer) 21 | if err != nil { 22 | return err 23 | } 24 | w.buffer = []byte{} 25 | return nil 26 | } 27 | 28 | var _ ConsoleWriter = &WindowsWriter{} 29 | 30 | var ( 31 | // Deprecated: Please use NewStdoutWriter 32 | NewStandardOutputWriter = NewStdoutWriter 33 | ) 34 | 35 | // NewStdoutWriter returns ConsoleWriter object to write to stdout. 36 | // This generates win32 control sequences. 37 | func NewStdoutWriter() ConsoleWriter { 38 | return &WindowsWriter{ 39 | out: colorable.NewColorableStdout(), 40 | } 41 | } 42 | 43 | // NewStderrWriter returns ConsoleWriter object to write to stderr. 44 | // This generates win32 control sequences. 45 | func NewStderrWriter() ConsoleWriter { 46 | return &WindowsWriter{ 47 | out: colorable.NewColorableStderr(), 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/openbsd_unveil.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build openbsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | // Unveil implements the unveil syscall. 15 | // For more information see unveil(2). 16 | // Note that the special case of blocking further 17 | // unveil calls is handled by UnveilBlock. 18 | func Unveil(path string, flags string) error { 19 | pathPtr, err := syscall.BytePtrFromString(path) 20 | if err != nil { 21 | return err 22 | } 23 | flagsPtr, err := syscall.BytePtrFromString(flags) 24 | if err != nil { 25 | return err 26 | } 27 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) 28 | if e != 0 { 29 | return e 30 | } 31 | return nil 32 | } 33 | 34 | // UnveilBlock blocks future unveil calls. 35 | // For more information see unveil(2). 36 | func UnveilBlock() error { 37 | // Both pointers must be nil. 38 | var pathUnsafe, flagsUnsafe unsafe.Pointer 39 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) 40 | if e != 0 { 41 | return e 42 | } 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/README.md: -------------------------------------------------------------------------------- 1 | # go-isatty 2 | 3 | [![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty) 4 | [![Build Status](https://travis-ci.org/mattn/go-isatty.svg?branch=master)](https://travis-ci.org/mattn/go-isatty) 5 | [![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master) 6 | [![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty) 7 | 8 | isatty for golang 9 | 10 | ## Usage 11 | 12 | ```go 13 | package main 14 | 15 | import ( 16 | "fmt" 17 | "github.com/mattn/go-isatty" 18 | "os" 19 | ) 20 | 21 | func main() { 22 | if isatty.IsTerminal(os.Stdout.Fd()) { 23 | fmt.Println("Is Terminal") 24 | } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) { 25 | fmt.Println("Is Cygwin/MSYS2 Terminal") 26 | } else { 27 | fmt.Println("Is Not Terminal") 28 | } 29 | } 30 | ``` 31 | 32 | ## Installation 33 | 34 | ``` 35 | $ go get github.com/mattn/go-isatty 36 | ``` 37 | 38 | ## License 39 | 40 | MIT 41 | 42 | ## Author 43 | 44 | Yasuhiro Matsumoto (a.k.a mattn) 45 | 46 | ## Thanks 47 | 48 | * k-takata: base idea for IsCygwinTerminal 49 | 50 | https://github.com/k-takata/go-iscygpty 51 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, David Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | 2. 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. 9 | 10 | 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 HOLDER 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. 11 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/shortcut.go: -------------------------------------------------------------------------------- 1 | package prompt 2 | 3 | func dummyExecutor(in string) { return } 4 | 5 | // Input get the input data from the user and return it. 6 | func Input(prefix string, completer Completer, opts ...Option) string { 7 | pt := New(dummyExecutor, completer) 8 | pt.renderer.prefixTextColor = DefaultColor 9 | pt.renderer.prefix = prefix 10 | 11 | for _, opt := range opts { 12 | if err := opt(pt); err != nil { 13 | panic(err) 14 | } 15 | } 16 | return pt.Input() 17 | } 18 | 19 | // Choose to the shortcut of input function to select from string array. 20 | // Deprecated: Maybe anyone want to use this. 21 | func Choose(prefix string, choices []string, opts ...Option) string { 22 | completer := newChoiceCompleter(choices, FilterHasPrefix) 23 | pt := New(dummyExecutor, completer) 24 | pt.renderer.prefixTextColor = DefaultColor 25 | pt.renderer.prefix = prefix 26 | 27 | for _, opt := range opts { 28 | if err := opt(pt); err != nil { 29 | panic(err) 30 | } 31 | } 32 | return pt.Input() 33 | } 34 | 35 | func newChoiceCompleter(choices []string, filter Filter) Completer { 36 | s := make([]Suggest, len(choices)) 37 | for i := range choices { 38 | s[i] = Suggest{Text: choices[i]} 39 | } 40 | return func(x Document) []Suggest { 41 | return filter(s, x.GetWordBeforeCursor(), true) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 21 | BL runtime·entersyscall(SB) 22 | MOVD a1+8(FP), R0 23 | MOVD a2+16(FP), R1 24 | MOVD a3+24(FP), R2 25 | MOVD $0, R3 26 | MOVD $0, R4 27 | MOVD $0, R5 28 | MOVD trap+0(FP), R8 // syscall entry 29 | SVC 30 | MOVD R0, r1+32(FP) // r1 31 | MOVD R1, r2+40(FP) // r2 32 | BL runtime·exitsyscall(SB) 33 | RET 34 | 35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 36 | B syscall·RawSyscall(SB) 37 | 38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 39 | B syscall·RawSyscall6(SB) 40 | 41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 42 | MOVD a1+8(FP), R0 43 | MOVD a2+16(FP), R1 44 | MOVD a3+24(FP), R2 45 | MOVD $0, R3 46 | MOVD $0, R4 47 | MOVD $0, R5 48 | MOVD trap+0(FP), R8 // syscall entry 49 | SVC 50 | MOVD R0, r1+32(FP) 51 | MOVD R1, r2+40(FP) 52 | RET 53 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | name = "github.com/mattn/go-colorable" 6 | packages = ["."] 7 | revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072" 8 | version = "v0.0.9" 9 | 10 | [[projects]] 11 | name = "github.com/mattn/go-isatty" 12 | packages = ["."] 13 | revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" 14 | version = "v0.0.3" 15 | 16 | [[projects]] 17 | branch = "master" 18 | name = "github.com/mattn/go-runewidth" 19 | packages = ["."] 20 | revision = "ce7b0b5c7b45a81508558cd1dba6bb1e4ddb51bb" 21 | 22 | [[projects]] 23 | branch = "master" 24 | name = "github.com/mattn/go-tty" 25 | packages = ["."] 26 | revision = "931426f7535ac39720c8909d70ece5a41a2502a6" 27 | 28 | [[projects]] 29 | branch = "master" 30 | name = "github.com/pkg/term" 31 | packages = ["termios"] 32 | revision = "cda20d4ac917ad418d86e151eff439648b06185b" 33 | 34 | [[projects]] 35 | branch = "master" 36 | name = "golang.org/x/sys" 37 | packages = ["unix"] 38 | revision = "ad87a3a340fa7f3bed189293fbfa7a9b7e021ae1" 39 | 40 | [solve-meta] 41 | analyzer-name = "dep" 42 | analyzer-version = 1 43 | inputs-digest = "d6a0ea9e49092cfd8cb3d6077c97a938de7c39195b83828dae2a0befdd207ffd" 44 | solver-name = "gps-cdcl" 45 | solver-version = 1 46 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/key_bind.go: -------------------------------------------------------------------------------- 1 | package prompt 2 | 3 | // KeyBindFunc receives buffer and processed it. 4 | type KeyBindFunc func(*Buffer) 5 | 6 | // KeyBind represents which key should do what operation. 7 | type KeyBind struct { 8 | Key Key 9 | Fn KeyBindFunc 10 | } 11 | 12 | // ASCIICodeBind represents which []byte should do what operation 13 | type ASCIICodeBind struct { 14 | ASCIICode []byte 15 | Fn KeyBindFunc 16 | } 17 | 18 | // KeyBindMode to switch a key binding flexibly. 19 | type KeyBindMode string 20 | 21 | const ( 22 | // CommonKeyBind is a mode without any keyboard shortcut 23 | CommonKeyBind KeyBindMode = "common" 24 | // EmacsKeyBind is a mode to use emacs-like keyboard shortcut 25 | EmacsKeyBind KeyBindMode = "emacs" 26 | ) 27 | 28 | var commonKeyBindings = []KeyBind{ 29 | // Go to the End of the line 30 | { 31 | Key: End, 32 | Fn: GoLineEnd, 33 | }, 34 | // Go to the beginning of the line 35 | { 36 | Key: Home, 37 | Fn: GoLineBeginning, 38 | }, 39 | // Delete character under the cursor 40 | { 41 | Key: Delete, 42 | Fn: DeleteChar, 43 | }, 44 | // Backspace 45 | { 46 | Key: Backspace, 47 | Fn: DeleteBeforeChar, 48 | }, 49 | // Right allow: Forward one character 50 | { 51 | Key: Right, 52 | Fn: GoRightChar, 53 | }, 54 | // Left allow: Backward one character 55 | { 56 | Key: Left, 57 | Fn: GoLeftChar, 58 | }, 59 | } 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 23 | BL runtime·entersyscall(SB) 24 | MOVW trap+0(FP), R7 25 | MOVW a1+4(FP), R0 26 | MOVW a2+8(FP), R1 27 | MOVW a3+12(FP), R2 28 | MOVW $0, R3 29 | MOVW $0, R4 30 | MOVW $0, R5 31 | SWI $0 32 | MOVW R0, r1+16(FP) 33 | MOVW $0, R0 34 | MOVW R0, r2+20(FP) 35 | BL runtime·exitsyscall(SB) 36 | RET 37 | 38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 39 | B syscall·RawSyscall(SB) 40 | 41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 42 | B syscall·RawSyscall6(SB) 43 | 44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 45 | MOVW trap+0(FP), R7 // syscall entry 46 | MOVW a1+4(FP), R0 47 | MOVW a2+8(FP), R1 48 | MOVW a3+12(FP), R2 49 | SWI $0 50 | MOVW R0, r1+16(FP) 51 | MOVW $0, R0 52 | MOVW R0, r2+20(FP) 53 | RET 54 | 55 | TEXT ·seek(SB),NOSPLIT,$0-28 56 | B syscall·seek(SB) 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | BL runtime·entersyscall(SB) 26 | MOVD a1+8(FP), R2 27 | MOVD a2+16(FP), R3 28 | MOVD a3+24(FP), R4 29 | MOVD $0, R5 30 | MOVD $0, R6 31 | MOVD $0, R7 32 | MOVD trap+0(FP), R1 // syscall entry 33 | SYSCALL 34 | MOVD R2, r1+32(FP) 35 | MOVD R3, r2+40(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | BR syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | BR syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVD a1+8(FP), R2 47 | MOVD a2+16(FP), R3 48 | MOVD a3+24(FP), R4 49 | MOVD $0, R5 50 | MOVD $0, R6 51 | MOVD $0, R7 52 | MOVD trap+0(FP), R1 // syscall entry 53 | SYSCALL 54 | MOVD R2, r1+32(FP) 55 | MOVD R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracearm_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build arm arm64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsArm is the registers used by arm binaries. 11 | type PtraceRegsArm struct { 12 | Uregs [18]uint32 13 | } 14 | 15 | // PtraceGetRegsArm fetches the registers used by arm binaries. 16 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 17 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 18 | } 19 | 20 | // PtraceSetRegsArm sets the registers used by arm binaries. 21 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 22 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 23 | } 24 | 25 | // PtraceRegsArm64 is the registers used by arm64 binaries. 26 | type PtraceRegsArm64 struct { 27 | Regs [31]uint64 28 | Sp uint64 29 | Pc uint64 30 | Pstate uint64 31 | } 32 | 33 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 34 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 35 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 36 | } 37 | 38 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 39 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 40 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 28 | JAL runtime·entersyscall(SB) 29 | MOVW a1+4(FP), R4 30 | MOVW a2+8(FP), R5 31 | MOVW a3+12(FP), R6 32 | MOVW R0, R7 33 | MOVW trap+0(FP), R2 // syscall entry 34 | SYSCALL 35 | MOVW R2, r1+16(FP) // r1 36 | MOVW R3, r2+20(FP) // r2 37 | JAL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVW a1+4(FP), R4 48 | MOVW a2+8(FP), R5 49 | MOVW a3+12(FP), R6 50 | MOVW trap+0(FP), R2 // syscall entry 51 | SYSCALL 52 | MOVW R2, r1+16(FP) 53 | MOVW R3, r2+20(FP) 54 | RET 55 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/key_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=Key"; DO NOT EDIT. 2 | 3 | package prompt 4 | 5 | import "strconv" 6 | 7 | const _Key_name = "EscapeControlAControlBControlCControlDControlEControlFControlGControlHControlIControlJControlKControlLControlMControlNControlOControlPControlQControlRControlSControlTControlUControlVControlWControlXControlYControlZControlSpaceControlBackslashControlSquareCloseControlCircumflexControlUnderscoreControlLeftControlRightControlUpControlDownUpDownRightLeftShiftLeftShiftUpShiftDownShiftRightHomeEndDeleteShiftDeleteControlDeletePageUpPageDownBackTabInsertBackspaceTabEnterF1F2F3F4F5F6F7F8F9F10F11F12F13F14F15F16F17F18F19F20F21F22F23F24AnyCPRResponseVt100MouseEventWindowsMouseEventBracketedPasteIgnoreNotDefined" 8 | 9 | var _Key_index = [...]uint16{0, 6, 14, 22, 30, 38, 46, 54, 62, 70, 78, 86, 94, 102, 110, 118, 126, 134, 142, 150, 158, 166, 174, 182, 190, 198, 206, 214, 226, 242, 260, 277, 294, 305, 317, 326, 337, 339, 343, 348, 352, 361, 368, 377, 387, 391, 394, 400, 411, 424, 430, 438, 445, 451, 460, 463, 468, 470, 472, 474, 476, 478, 480, 482, 484, 486, 489, 492, 495, 498, 501, 504, 507, 510, 513, 516, 519, 522, 525, 528, 531, 534, 545, 560, 577, 591, 597, 607} 10 | 11 | func (i Key) String() string { 12 | if i < 0 || i >= Key(len(_Key_index)-1) { 13 | return "Key(" + strconv.FormatInt(int64(i), 10) + ")" 14 | } 15 | return _Key_name[_Key_index[i]:_Key_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | JAL runtime·entersyscall(SB) 26 | MOVV a1+8(FP), R4 27 | MOVV a2+16(FP), R5 28 | MOVV a3+24(FP), R6 29 | MOVV R0, R7 30 | MOVV R0, R8 31 | MOVV R0, R9 32 | MOVV trap+0(FP), R2 // syscall entry 33 | SYSCALL 34 | MOVV R2, r1+32(FP) 35 | MOVV R3, r2+40(FP) 36 | JAL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | JMP syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | JMP syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVV a1+8(FP), R4 47 | MOVV a2+16(FP), R5 48 | MOVV a3+24(FP), R6 49 | MOVV R0, R7 50 | MOVV R0, R8 51 | MOVV R0, R9 52 | MOVV trap+0(FP), R2 // syscall entry 53 | SYSCALL 54 | MOVV R2, r1+32(FP) 55 | MOVV R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,go1.12 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // Implemented in the runtime package (runtime/sys_darwin.go) 12 | func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 13 | func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 14 | func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 15 | func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only 16 | func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 17 | func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 18 | 19 | //go:linkname syscall_syscall syscall.syscall 20 | //go:linkname syscall_syscall6 syscall.syscall6 21 | //go:linkname syscall_syscall6X syscall.syscall6X 22 | //go:linkname syscall_syscall9 syscall.syscall9 23 | //go:linkname syscall_rawSyscall syscall.rawSyscall 24 | //go:linkname syscall_rawSyscall6 syscall.rawSyscall6 25 | 26 | // Find the entry point for f. See comments in runtime/proc.go for the 27 | // function of the same name. 28 | //go:nosplit 29 | func funcPC(f func()) uintptr { 30 | return **(**uintptr)(unsafe.Pointer(&f)) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/key_bind_func.go: -------------------------------------------------------------------------------- 1 | package prompt 2 | 3 | // GoLineEnd Go to the End of the line 4 | func GoLineEnd(buf *Buffer) { 5 | x := []rune(buf.Document().TextAfterCursor()) 6 | buf.CursorRight(len(x)) 7 | } 8 | 9 | // GoLineBeginning Go to the beginning of the line 10 | func GoLineBeginning(buf *Buffer) { 11 | x := []rune(buf.Document().TextBeforeCursor()) 12 | buf.CursorLeft(len(x)) 13 | } 14 | 15 | // DeleteChar Delete character under the cursor 16 | func DeleteChar(buf *Buffer) { 17 | buf.Delete(1) 18 | } 19 | 20 | // DeleteWord Delete word before the cursor 21 | func DeleteWord(buf *Buffer) { 22 | buf.DeleteBeforeCursor(len([]rune(buf.Document().TextBeforeCursor())) - buf.Document().FindStartOfPreviousWordWithSpace()) 23 | } 24 | 25 | // DeleteBeforeChar Go to Backspace 26 | func DeleteBeforeChar(buf *Buffer) { 27 | buf.DeleteBeforeCursor(1) 28 | } 29 | 30 | // GoRightChar Forward one character 31 | func GoRightChar(buf *Buffer) { 32 | buf.CursorRight(1) 33 | } 34 | 35 | // GoLeftChar Backward one character 36 | func GoLeftChar(buf *Buffer) { 37 | buf.CursorLeft(1) 38 | } 39 | 40 | // GoRightWord Forward one word 41 | func GoRightWord(buf *Buffer) { 42 | buf.CursorRight(buf.Document().FindEndOfCurrentWordWithSpace()) 43 | } 44 | 45 | // GoLeftWord Backward one word 46 | func GoLeftWord(buf *Buffer) { 47 | buf.CursorLeft(len([]rune(buf.Document().TextBeforeCursor())) - buf.Document().FindStartOfPreviousWordWithSpace()) 48 | } 49 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 23 | CALL runtime·entersyscall(SB) 24 | MOVQ a1+8(FP), DI 25 | MOVQ a2+16(FP), SI 26 | MOVQ a3+24(FP), DX 27 | MOVQ $0, R10 28 | MOVQ $0, R8 29 | MOVQ $0, R9 30 | MOVQ trap+0(FP), AX // syscall entry 31 | SYSCALL 32 | MOVQ AX, r1+32(FP) 33 | MOVQ DX, r2+40(FP) 34 | CALL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOVQ a1+8(FP), DI 45 | MOVQ a2+16(FP), SI 46 | MOVQ a3+24(FP), DX 47 | MOVQ $0, R10 48 | MOVQ $0, R8 49 | MOVQ $0, R9 50 | MOVQ trap+0(FP), AX // syscall entry 51 | SYSCALL 52 | MOVQ AX, r1+32(FP) 53 | MOVQ DX, r2+40(FP) 54 | RET 55 | 56 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 57 | JMP syscall·gettimeofday(SB) 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/termios.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package termios 4 | 5 | import ( 6 | "syscall" 7 | "unsafe" 8 | ) 9 | 10 | // Tiocmget returns the state of the MODEM bits. 11 | func Tiocmget(fd uintptr, status *int) error { 12 | return ioctl(fd, syscall.TIOCMGET, uintptr(unsafe.Pointer(status))) 13 | } 14 | 15 | // Tiocmset sets the state of the MODEM bits. 16 | func Tiocmset(fd uintptr, status *int) error { 17 | return ioctl(fd, syscall.TIOCMSET, uintptr(unsafe.Pointer(status))) 18 | } 19 | 20 | // Tiocmbis sets the indicated modem bits. 21 | func Tiocmbis(fd uintptr, status *int) error { 22 | return ioctl(fd, syscall.TIOCMBIS, uintptr(unsafe.Pointer(status))) 23 | } 24 | 25 | // Tiocmbic clears the indicated modem bits. 26 | func Tiocmbic(fd uintptr, status *int) error { 27 | return ioctl(fd, syscall.TIOCMBIC, uintptr(unsafe.Pointer(status))) 28 | } 29 | 30 | // Cfmakecbreak modifies attr for cbreak mode. 31 | func Cfmakecbreak(attr *syscall.Termios) { 32 | attr.Lflag &^= syscall.ECHO | syscall.ICANON 33 | attr.Cc[syscall.VMIN] = 1 34 | attr.Cc[syscall.VTIME] = 0 35 | } 36 | 37 | // Cfmakeraw modifies attr for raw mode. 38 | func Cfmakeraw(attr *syscall.Termios) { 39 | attr.Iflag &^= syscall.BRKINT | syscall.ICRNL | syscall.INPCK | syscall.ISTRIP | syscall.IXON 40 | attr.Oflag &^= syscall.OPOST 41 | attr.Cflag &^= syscall.CSIZE | syscall.PARENB 42 | attr.Cflag |= syscall.CS8 43 | attr.Lflag &^= syscall.ECHO | syscall.ICANON | syscall.IEXTEN | syscall.ISIG 44 | attr.Cc[syscall.VMIN] = 1 45 | attr.Cc[syscall.VTIME] = 0 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/pmezard/go-difflib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/doc.go: -------------------------------------------------------------------------------- 1 | // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. 2 | // 3 | // Example Usage 4 | // 5 | // The following is a complete example using assert in a standard test function: 6 | // import ( 7 | // "testing" 8 | // "github.com/stretchr/testify/assert" 9 | // ) 10 | // 11 | // func TestSomething(t *testing.T) { 12 | // 13 | // var a string = "Hello" 14 | // var b string = "Hello" 15 | // 16 | // assert.Equal(t, a, b, "The two words should be the same.") 17 | // 18 | // } 19 | // 20 | // if you assert many times, use the format below: 21 | // 22 | // import ( 23 | // "testing" 24 | // "github.com/stretchr/testify/assert" 25 | // ) 26 | // 27 | // func TestSomething(t *testing.T) { 28 | // assert := assert.New(t) 29 | // 30 | // var a string = "Hello" 31 | // var b string = "Hello" 32 | // 33 | // assert.Equal(a, b, "The two words should be the same.") 34 | // } 35 | // 36 | // Assertions 37 | // 38 | // Assertions allow you to easily write test code, and are global funcs in the `assert` package. 39 | // All assertion functions take, as the first argument, the `*testing.T` object provided by the 40 | // testing framework. This allows the assertion funcs to write the failings and other details to 41 | // the correct place. 42 | // 43 | // Every assertion function also takes an optional string message as the final argument, 44 | // allowing custom error messages to be appended to the message the assertion method outputs. 45 | package assert 46 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/README.md: -------------------------------------------------------------------------------- 1 | # go-colorable 2 | 3 | [![Godoc Reference](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable) 4 | [![Build Status](https://travis-ci.org/mattn/go-colorable.svg?branch=master)](https://travis-ci.org/mattn/go-colorable) 5 | [![Coverage Status](https://coveralls.io/repos/github/mattn/go-colorable/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-colorable?branch=master) 6 | [![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable) 7 | 8 | Colorable writer for windows. 9 | 10 | For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) 11 | This package is possible to handle escape sequence for ansi color on windows. 12 | 13 | ## Too Bad! 14 | 15 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) 16 | 17 | 18 | ## So Good! 19 | 20 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) 21 | 22 | ## Usage 23 | 24 | ```go 25 | logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 26 | logrus.SetOutput(colorable.NewColorableStdout()) 27 | 28 | logrus.Info("succeeded") 29 | logrus.Warn("not correct") 30 | logrus.Error("something error") 31 | logrus.Fatal("panic") 32 | ``` 33 | 34 | You can compile above code on non-windows OSs. 35 | 36 | ## Installation 37 | 38 | ``` 39 | $ go get github.com/mattn/go-colorable 40 | ``` 41 | 42 | # License 43 | 44 | MIT 45 | 46 | # Author 47 | 48 | Yasuhiro Matsumoto (a.k.a mattn) 49 | -------------------------------------------------------------------------------- /env_test.go: -------------------------------------------------------------------------------- 1 | package goscheme 2 | 3 | import ( 4 | "github.com/stretchr/testify/assert" 5 | "testing" 6 | ) 7 | 8 | func TestEnv_Find(t *testing.T) { 9 | env := &Env{ 10 | outer: nil, 11 | frame: map[Symbol]Expression{"x": 1, "y": 1}, 12 | } 13 | ret, err := env.Find("x") 14 | assert.Equal(t, 1, ret) 15 | assert.Nil(t, err) 16 | 17 | // nested env 18 | 19 | env2 := &Env{ 20 | outer: env, 21 | frame: map[Symbol]Expression{"x": 2}, 22 | } 23 | ret, err = env2.Find("x") 24 | assert.Equal(t, 2, ret) 25 | assert.Nil(t, err) 26 | ret, err = env2.Find("y") 27 | assert.Equal(t, 1, ret) 28 | assert.Nil(t, err) 29 | _, err = env2.Find("unknown") 30 | assert.NotNil(t, err) 31 | 32 | } 33 | 34 | func Test_listImpl(t *testing.T) { 35 | testCases := []struct { 36 | input []Expression 37 | expected *Pair 38 | }{ 39 | {[]Expression{1, 2, 3}, &Pair{1, &Pair{2, &Pair{3, NilObj}}}}, 40 | {[]Expression{1, &Pair{Car: 2}, 3}, &Pair{1, &Pair{&Pair{Car: 2}, &Pair{3, NilObj}}}}, 41 | } 42 | for _, c := range testCases { 43 | p, _ := listImpl(c.input...) 44 | assert.Equal(t, c.expected, p) 45 | } 46 | } 47 | 48 | func Test_appendImpl(t *testing.T) { 49 | testCases := []struct { 50 | input []Expression 51 | expected *Pair 52 | }{ 53 | {[]Expression{&Pair{1, NilObj}, 2}, &Pair{1, &Pair{2, NilObj}}}, 54 | {[]Expression{&Pair{1, NilObj}, &Pair{2, NilObj}}, &Pair{1, &Pair{2, NilObj}}}, 55 | {[]Expression{&Pair{1, NilObj}, &Pair{2, NilObj}, 3}, &Pair{1, &Pair{2, &Pair{3, NilObj}}}}, 56 | } 57 | for _, c := range testCases { 58 | l, _ := appendImpl(c.input...) 59 | assert.Equal(t, c.expected, l) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemips_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mips, mips64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mips mips64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMips is the registers used by mips binaries. 11 | type PtraceRegsMips struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMips fetches the registers used by mips binaries. 22 | func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMips sets the registers used by mips binaries. 27 | func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64 is the registers used by mips64 binaries. 32 | type PtraceRegsMips64 struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64 fetches the registers used by mips64 binaries. 43 | func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64 sets the registers used by mips64 binaries. 48 | func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemipsle_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mipsle mips64le 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMipsle is the registers used by mipsle binaries. 11 | type PtraceRegsMipsle struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMipsle fetches the registers used by mipsle binaries. 22 | func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMipsle sets the registers used by mipsle binaries. 27 | func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64le is the registers used by mips64le binaries. 32 | type PtraceRegsMips64le struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64le fetches the registers used by mips64le binaries. 43 | func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64le sets the registers used by mips64le binaries. 48 | func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/output_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package prompt 4 | 5 | import ( 6 | "log" 7 | "syscall" 8 | ) 9 | 10 | const flushMaxRetryCount = 3 11 | 12 | // PosixWriter is a ConsoleWriter implementation for POSIX environment. 13 | // To control terminal emulator, this outputs VT100 escape sequences. 14 | type PosixWriter struct { 15 | VT100Writer 16 | fd int 17 | } 18 | 19 | // Flush to flush buffer 20 | func (w *PosixWriter) Flush() error { 21 | l := len(w.buffer) 22 | offset := 0 23 | retry := 0 24 | for { 25 | n, err := syscall.Write(w.fd, w.buffer[offset:]) 26 | if err != nil { 27 | log.Printf("[DEBUG] flush error: %s", err) 28 | if retry < flushMaxRetryCount { 29 | retry++ 30 | continue 31 | } 32 | return err 33 | } 34 | offset += n 35 | if offset == l { 36 | break 37 | } 38 | } 39 | w.buffer = []byte{} 40 | return nil 41 | } 42 | 43 | var _ ConsoleWriter = &PosixWriter{} 44 | 45 | var ( 46 | // Deprecated: Please use NewStdoutWriter 47 | NewStandardOutputWriter = NewStdoutWriter 48 | ) 49 | 50 | // NewStdoutWriter returns ConsoleWriter object to write to stdout. 51 | // This generates VT100 escape sequences because almost terminal emulators 52 | // in POSIX OS built on top of a VT100 specification. 53 | func NewStdoutWriter() ConsoleWriter { 54 | return &PosixWriter{ 55 | fd: syscall.Stdout, 56 | } 57 | } 58 | 59 | // NewStderrWriter returns ConsoleWriter object to write to stderr. 60 | // This generates VT100 escape sequences because almost terminal emulators 61 | // in POSIX OS built on top of a VT100 specification. 62 | func NewStderrWriter() ConsoleWriter { 63 | return &PosixWriter{ 64 | fd: syscall.Stderr, 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80 14 | // instead of the glibc-specific "CALL 0x10(GS)". 15 | #define INVOKE_SYSCALL INT $0x80 16 | 17 | // Just jump to package syscall's implementation for all these functions. 18 | // The runtime may know about them. 19 | 20 | TEXT ·Syscall(SB),NOSPLIT,$0-28 21 | JMP syscall·Syscall(SB) 22 | 23 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 24 | JMP syscall·Syscall6(SB) 25 | 26 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 27 | CALL runtime·entersyscall(SB) 28 | MOVL trap+0(FP), AX // syscall entry 29 | MOVL a1+4(FP), BX 30 | MOVL a2+8(FP), CX 31 | MOVL a3+12(FP), DX 32 | MOVL $0, SI 33 | MOVL $0, DI 34 | INVOKE_SYSCALL 35 | MOVL AX, r1+16(FP) 36 | MOVL DX, r2+20(FP) 37 | CALL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVL trap+0(FP), AX // syscall entry 48 | MOVL a1+4(FP), BX 49 | MOVL a2+8(FP), CX 50 | MOVL a3+12(FP), DX 51 | MOVL $0, SI 52 | MOVL $0, DI 53 | INVOKE_SYSCALL 54 | MOVL AX, r1+16(FP) 55 | MOVL DX, r2+20(FP) 56 | RET 57 | 58 | TEXT ·socketcall(SB),NOSPLIT,$0-36 59 | JMP syscall·socketcall(SB) 60 | 61 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 62 | JMP syscall·rawsocketcall(SB) 63 | 64 | TEXT ·seek(SB),NOSPLIT,$0-28 65 | JMP syscall·seek(SB) 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used by the Linux kernel and glibc. 7 | // 8 | // The information below is extracted and adapted from bits/sysmacros.h in the 9 | // glibc sources: 10 | // 11 | // dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's 12 | // default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major 13 | // number and m is a hex digit of the minor number. This is backward compatible 14 | // with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also 15 | // backward compatible with the Linux kernel, which for some architectures uses 16 | // 32-bit dev_t, encoded as mmmM MMmm. 17 | 18 | package unix 19 | 20 | // Major returns the major component of a Linux device number. 21 | func Major(dev uint64) uint32 { 22 | major := uint32((dev & 0x00000000000fff00) >> 8) 23 | major |= uint32((dev & 0xfffff00000000000) >> 32) 24 | return major 25 | } 26 | 27 | // Minor returns the minor component of a Linux device number. 28 | func Minor(dev uint64) uint32 { 29 | minor := uint32((dev & 0x00000000000000ff) >> 0) 30 | minor |= uint32((dev & 0x00000ffffff00000) >> 12) 31 | return minor 32 | } 33 | 34 | // Mkdev returns a Linux device number generated from the given major and minor 35 | // components. 36 | func Mkdev(major, minor uint32) uint64 { 37 | dev := (uint64(major) & 0x00000fff) << 8 38 | dev |= (uint64(major) & 0xfffff000) << 32 39 | dev |= (uint64(minor) & 0x000000ff) << 0 40 | dev |= (uint64(minor) & 0xffffff00) << 12 41 | return dev 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/history.go: -------------------------------------------------------------------------------- 1 | package prompt 2 | 3 | // History stores the texts that are entered. 4 | type History struct { 5 | histories []string 6 | tmp []string 7 | selected int 8 | } 9 | 10 | // Add to add text in history. 11 | func (h *History) Add(input string) { 12 | h.histories = append(h.histories, input) 13 | h.Clear() 14 | } 15 | 16 | // Clear to clear the history. 17 | func (h *History) Clear() { 18 | h.tmp = make([]string, len(h.histories)) 19 | for i := range h.histories { 20 | h.tmp[i] = h.histories[i] 21 | } 22 | h.tmp = append(h.tmp, "") 23 | h.selected = len(h.tmp) - 1 24 | } 25 | 26 | // Older saves a buffer of current line and get a buffer of previous line by up-arrow. 27 | // The changes of line buffers are stored until new history is created. 28 | func (h *History) Older(buf *Buffer) (new *Buffer, changed bool) { 29 | if len(h.tmp) == 1 || h.selected == 0 { 30 | return buf, false 31 | } 32 | h.tmp[h.selected] = buf.Text() 33 | 34 | h.selected-- 35 | new = NewBuffer() 36 | new.InsertText(h.tmp[h.selected], false, true) 37 | return new, true 38 | } 39 | 40 | // Newer saves a buffer of current line and get a buffer of next line by up-arrow. 41 | // The changes of line buffers are stored until new history is created. 42 | func (h *History) Newer(buf *Buffer) (new *Buffer, changed bool) { 43 | if h.selected >= len(h.tmp)-1 { 44 | return buf, false 45 | } 46 | h.tmp[h.selected] = buf.Text() 47 | 48 | h.selected++ 49 | new = NewBuffer() 50 | new.InsertText(h.tmp[h.selected], false, true) 51 | return new, true 52 | } 53 | 54 | // NewHistory returns new history object. 55 | func NewHistory() *History { 56 | return &History{ 57 | histories: []string{}, 58 | tmp: []string{""}, 59 | selected: 0, 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-runewidth/runewidth_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !js 3 | // +build !appengine 4 | 5 | package runewidth 6 | 7 | import ( 8 | "os" 9 | "regexp" 10 | "strings" 11 | ) 12 | 13 | var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`) 14 | 15 | var mblenTable = map[string]int{ 16 | "utf-8": 6, 17 | "utf8": 6, 18 | "jis": 8, 19 | "eucjp": 3, 20 | "euckr": 2, 21 | "euccn": 2, 22 | "sjis": 2, 23 | "cp932": 2, 24 | "cp51932": 2, 25 | "cp936": 2, 26 | "cp949": 2, 27 | "cp950": 2, 28 | "big5": 2, 29 | "gbk": 2, 30 | "gb2312": 2, 31 | } 32 | 33 | func isEastAsian(locale string) bool { 34 | charset := strings.ToLower(locale) 35 | r := reLoc.FindStringSubmatch(locale) 36 | if len(r) == 2 { 37 | charset = strings.ToLower(r[1]) 38 | } 39 | 40 | if strings.HasSuffix(charset, "@cjk_narrow") { 41 | return false 42 | } 43 | 44 | for pos, b := range []byte(charset) { 45 | if b == '@' { 46 | charset = charset[:pos] 47 | break 48 | } 49 | } 50 | max := 1 51 | if m, ok := mblenTable[charset]; ok { 52 | max = m 53 | } 54 | if max > 1 && (charset[0] != 'u' || 55 | strings.HasPrefix(locale, "ja") || 56 | strings.HasPrefix(locale, "ko") || 57 | strings.HasPrefix(locale, "zh")) { 58 | return true 59 | } 60 | return false 61 | } 62 | 63 | // IsEastAsian return true if the current locale is CJK 64 | func IsEastAsian() bool { 65 | locale := os.Getenv("LC_CTYPE") 66 | if locale == "" { 67 | locale = os.Getenv("LANG") 68 | } 69 | 70 | // ignore C locale 71 | if locale == "POSIX" || locale == "C" { 72 | return false 73 | } 74 | if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') { 75 | return false 76 | } 77 | 78 | return isEastAsian(locale) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/spew/bypasssafe.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016 Dave Collins 2 | // 3 | // Permission to use, copy, modify, and distribute this software for any 4 | // purpose with or without fee is hereby granted, provided that the above 5 | // copyright notice and this permission notice appear in all copies. 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | // NOTE: Due to the following build constraints, this file will only be compiled 16 | // when the code is running on Google App Engine, compiled by GopherJS, or 17 | // "-tags safe" is added to the go build command line. The "disableunsafe" 18 | // tag is deprecated and thus should not be used. 19 | // +build js appengine safe disableunsafe 20 | 21 | package spew 22 | 23 | import "reflect" 24 | 25 | const ( 26 | // UnsafeDisabled is a build-time constant which specifies whether or 27 | // not access to the unsafe package is available. 28 | UnsafeDisabled = true 29 | ) 30 | 31 | // unsafeReflectValue typically converts the passed reflect.Value into a one 32 | // that bypasses the typical safety restrictions preventing access to 33 | // unaddressable and unexported data. However, doing this relies on access to 34 | // the unsafe package. This is a stub version which simply returns the passed 35 | // reflect.Value when the unsafe package is not available. 36 | func unsafeReflectValue(v reflect.Value) reflect.Value { 37 | return v 38 | } 39 | -------------------------------------------------------------------------------- /type_test.go: -------------------------------------------------------------------------------- 1 | package goscheme 2 | 3 | import ( 4 | "github.com/stretchr/testify/assert" 5 | "testing" 6 | ) 7 | 8 | func TestPair_IsList(t *testing.T) { 9 | type testCase struct { 10 | Item *Pair 11 | Expected bool 12 | } 13 | 14 | testCases := []testCase{ 15 | {&Pair{NilObj, NilObj}, true}, 16 | {&Pair{Car: NilObj, Cdr: NilObj}, true}, 17 | {&Pair{1, NilObj}, true}, 18 | {&Pair{1, 1}, false}, 19 | {&Pair{1, &Pair{1, 2}}, false}, 20 | {&Pair{NilObj, &Pair{1, 2}}, false}, 21 | {&Pair{NilObj, &Pair{1, NilObj}}, true}, 22 | {&Pair{NilObj, &Pair{1, &Pair{3, NilObj}}}, true}, 23 | } 24 | for _, c := range testCases { 25 | assert.Equal(t, c.Expected, c.Item.IsList()) 26 | } 27 | } 28 | 29 | func TestPair_String(t *testing.T) { 30 | testCases := []struct { 31 | Item *Pair 32 | Expected string 33 | }{ 34 | {&Pair{NilObj, NilObj}, "(())"}, 35 | {&Pair{NilObj, 3}, "(() . 3)"}, 36 | {&Pair{1, &Pair{1, 2}}, "(1 1 . 2)"}, 37 | {&Pair{1, &Pair{2, &Pair{3, &Pair{4, NilObj}}}}, "(1 2 3 4)"}, 38 | {&Pair{1, &Pair{NilObj, &Pair{&Pair{2, 3}, &Pair{4, 5}}}}, "(1 () (2 . 3) 4 . 5)"}, 39 | } 40 | for _, c := range testCases { 41 | assert.Equal(t, c.Expected, c.Item.String()) 42 | } 43 | } 44 | 45 | func TestIsString(t *testing.T) { 46 | assert.Equal(t, true, IsString("\"sdfsdf\"")) 47 | assert.Equal(t, true, IsString("\"sdfdsf\n\"")) 48 | assert.Equal(t, true, IsString("\"sdfdsf\r\n\"")) 49 | } 50 | 51 | func TestShouldPrint(t *testing.T) { 52 | assert.Equal(t, false, shouldPrint(UndefObj)) 53 | assert.Equal(t, false, shouldPrint(nil)) 54 | assert.Equal(t, true, shouldPrint(NilObj)) 55 | } 56 | 57 | func TestIsTrue(t *testing.T) { 58 | assert.Equal(t, true, IsTrue("#t")) 59 | assert.Equal(t, false, IsTrue("#f")) 60 | assert.Equal(t, true, IsTrue(nil)) 61 | assert.Equal(t, true, IsTrue(NilObj)) 62 | assert.Equal(t, true, IsTrue(UndefObj)) 63 | assert.Equal(t, true, IsTrue(1)) 64 | assert.Equal(t, true, IsTrue("")) 65 | } 66 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/c-bata/go-prompt v0.2.3 h1:jjCS+QhG/sULBhAaBdjb2PlMRVaKXQgn+4yzaauvs2s= 2 | github.com/c-bata/go-prompt v0.2.3/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= 3 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 4 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 5 | github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= 6 | github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 7 | github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= 8 | github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 9 | github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= 10 | github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= 11 | github.com/mattn/go-tty v0.0.0-20181127064339-e4f871175a2f h1:4P7Ul+TAnk92vTeVkXs6VLjmf1EhrYtDRa03PCYY6VM= 12 | github.com/mattn/go-tty v0.0.0-20181127064339-e4f871175a2f/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= 13 | github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 h1:A7GG7zcGjl3jqAqGPmcNjd/D9hzL95SuoOQAaFNdLU0= 14 | github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= 15 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 16 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 17 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 18 | github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= 19 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 20 | golang.org/x/sys v0.0.0-20190114130336-2be517255631 h1:g/5trXm6f9Tm+ochb21RlFNnF63lt+elB9hVBqtPu5Y= 21 | golang.org/x/sys v0.0.0-20190114130336-2be517255631/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mkasm_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go. 8 | //This program must be run after mksyscall.go. 9 | package main 10 | 11 | import ( 12 | "bytes" 13 | "fmt" 14 | "io/ioutil" 15 | "log" 16 | "os" 17 | "strings" 18 | ) 19 | 20 | func main() { 21 | in1, err := ioutil.ReadFile("syscall_darwin.go") 22 | if err != nil { 23 | log.Fatalf("can't open syscall_darwin.go: %s", err) 24 | } 25 | arch := os.Args[1] 26 | in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch)) 27 | if err != nil { 28 | log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err) 29 | } 30 | in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch)) 31 | if err != nil { 32 | log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err) 33 | } 34 | in := string(in1) + string(in2) + string(in3) 35 | 36 | trampolines := map[string]bool{} 37 | 38 | var out bytes.Buffer 39 | 40 | fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " ")) 41 | fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n") 42 | fmt.Fprintf(&out, "\n") 43 | fmt.Fprintf(&out, "// +build go1.12\n") 44 | fmt.Fprintf(&out, "\n") 45 | fmt.Fprintf(&out, "#include \"textflag.h\"\n") 46 | for _, line := range strings.Split(in, "\n") { 47 | if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") { 48 | continue 49 | } 50 | fn := line[5 : len(line)-13] 51 | if !trampolines[fn] { 52 | trampolines[fn] = true 53 | fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) 54 | fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn) 55 | } 56 | } 57 | err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644) 58 | if err != nil { 59 | log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | # Only the last two Go releases are supported by the Go team with security 4 | # updates. Any versions older than that should be considered deprecated. 5 | # Don't bother testing with them. tip builds your code with the latest 6 | # development version of Go. This can warn you that your code will break 7 | # in the next version of Go. Don't worry! Later we declare that test runs 8 | # are allowed to fail on Go tip. 9 | go: 10 | - 1.11.4 11 | - master 12 | 13 | # Skip the install step. Don't `go get` dependencies. Only build with the 14 | # code in vendor/ 15 | install: true 16 | 17 | matrix: 18 | # It's ok if our code fails on unstable development versions of Go. 19 | allow_failures: 20 | - go: master 21 | # Don't wait for tip tests to finish. Mark the test run green if the 22 | # tests pass on the stable versions of Go. 23 | fast_finish: true 24 | 25 | # Don't email me the results of the test runs. 26 | notifications: 27 | email: false 28 | 29 | # Anything in before_script that returns a nonzero exit code will 30 | # flunk the build and immediately stop. It's sorta like having 31 | # set -e enabled in bash. 32 | before_script: 33 | - GO111MODULE=on 34 | - GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/) # All the .go files, excluding vendor/ 35 | - go get golang.org/x/lint/golint # Linter 36 | - go get honnef.co/go/tools/cmd/megacheck # Badass static analyzer/linter 37 | - go get github.com/fzipp/gocyclo 38 | 39 | # script always run to completion (set +e). All of these code checks are must haves 40 | # in a modern Go project. 41 | script: 42 | - go test -race -coverprofile=coverage.txt -covermode=atomic 43 | - go vet ./... # go vet is the official Go static analyzer 44 | - megacheck ./... # "go vet on steroids" + linter 45 | - gocyclo -over 19 $GO_FILES # forbid code with huge functions 46 | - golint -set_exit_status $(go list ./...) # one last linter 47 | 48 | after_success: 49 | - bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | ) 10 | 11 | func setTimespec(sec, nsec int64) Timespec { 12 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 13 | } 14 | 15 | func setTimeval(sec, usec int64) Timeval { 16 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 17 | } 18 | 19 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 20 | func Gettimeofday(tv *Timeval) (err error) { 21 | // The tv passed to gettimeofday must be non-nil 22 | // but is otherwise unused. The answers come back 23 | // in the two registers. 24 | sec, usec, err := gettimeofday(tv) 25 | tv.Sec = int32(sec) 26 | tv.Usec = int32(usec) 27 | return err 28 | } 29 | 30 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 31 | k.Ident = uint32(fd) 32 | k.Filter = int16(mode) 33 | k.Flags = uint16(flags) 34 | } 35 | 36 | func (iov *Iovec) SetLen(length int) { 37 | iov.Len = uint32(length) 38 | } 39 | 40 | func (msghdr *Msghdr) SetControllen(length int) { 41 | msghdr.Controllen = uint32(length) 42 | } 43 | 44 | func (cmsg *Cmsghdr) SetLen(length int) { 45 | cmsg.Len = uint32(length) 46 | } 47 | 48 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 49 | 50 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 51 | // of darwin/arm the syscall is called sysctl instead of __sysctl. 52 | const SYS___SYSCTL = SYS_SYSCTL 53 | 54 | //sys Fstat(fd int, stat *Stat_t) (err error) 55 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 56 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 57 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 58 | //sys Lstat(path string, stat *Stat_t) (err error) 59 | //sys Stat(path string, stat *Stat_t) (err error) 60 | //sys Statfs(path string, stat *Statfs_t) (err error) 61 | 62 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 63 | return 0, ENOSYS 64 | } 65 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: sec, Nsec: nsec} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: sec, Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = sec 28 | tv.Usec = usec 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint64(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint64(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 59 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 60 | //sys Lstat(path string, stat *Stat_t) (err error) 61 | //sys Stat(path string, stat *Stat_t) (err error) 62 | //sys Statfs(path string, stat *Statfs_t) (err error) 63 | 64 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 65 | return 0, ENOSYS 66 | } 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace386_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(386, amd64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build 386 amd64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegs386 is the registers used by 386 binaries. 11 | type PtraceRegs386 struct { 12 | Ebx int32 13 | Ecx int32 14 | Edx int32 15 | Esi int32 16 | Edi int32 17 | Ebp int32 18 | Eax int32 19 | Xds int32 20 | Xes int32 21 | Xfs int32 22 | Xgs int32 23 | Orig_eax int32 24 | Eip int32 25 | Xcs int32 26 | Eflags int32 27 | Esp int32 28 | Xss int32 29 | } 30 | 31 | // PtraceGetRegs386 fetches the registers used by 386 binaries. 32 | func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error { 33 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 34 | } 35 | 36 | // PtraceSetRegs386 sets the registers used by 386 binaries. 37 | func PtraceSetRegs386(pid int, regs *PtraceRegs386) error { 38 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 39 | } 40 | 41 | // PtraceRegsAmd64 is the registers used by amd64 binaries. 42 | type PtraceRegsAmd64 struct { 43 | R15 uint64 44 | R14 uint64 45 | R13 uint64 46 | R12 uint64 47 | Rbp uint64 48 | Rbx uint64 49 | R11 uint64 50 | R10 uint64 51 | R9 uint64 52 | R8 uint64 53 | Rax uint64 54 | Rcx uint64 55 | Rdx uint64 56 | Rsi uint64 57 | Rdi uint64 58 | Orig_rax uint64 59 | Rip uint64 60 | Cs uint64 61 | Eflags uint64 62 | Rsp uint64 63 | Ss uint64 64 | Fs_base uint64 65 | Gs_base uint64 66 | Ds uint64 67 | Es uint64 68 | Fs uint64 69 | Gs uint64 70 | } 71 | 72 | // PtraceGetRegsAmd64 fetches the registers used by amd64 binaries. 73 | func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error { 74 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 75 | } 76 | 77 | // PtraceSetRegsAmd64 sets the registers used by amd64 binaries. 78 | func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error { 79 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: sec, Nsec: nsec} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: sec, Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = sec 28 | tv.Usec = usec 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint64(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint64(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 59 | //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 60 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 61 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 62 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 63 | //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Package unix contains an interface to the low-level operating system 8 | // primitives. OS details vary depending on the underlying system, and 9 | // by default, godoc will display OS-specific documentation for the current 10 | // system. If you want godoc to display OS documentation for another 11 | // system, set $GOOS and $GOARCH to the desired system. For example, if 12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS 13 | // to freebsd and $GOARCH to arm. 14 | // 15 | // The primary use of this package is inside other packages that provide a more 16 | // portable interface to the system, such as "os", "time" and "net". Use 17 | // those packages rather than this one if you can. 18 | // 19 | // For details of the functions and data types in this package consult 20 | // the manuals for the appropriate operating system. 21 | // 22 | // These calls return err == nil to indicate success; otherwise 23 | // err represents an operating system error describing the failure and 24 | // holds a value of type syscall.Errno. 25 | package unix // import "golang.org/x/sys/unix" 26 | 27 | import "strings" 28 | 29 | // ByteSliceFromString returns a NUL-terminated slice of bytes 30 | // containing the text of s. If s contains a NUL byte at any 31 | // location, it returns (nil, EINVAL). 32 | func ByteSliceFromString(s string) ([]byte, error) { 33 | if strings.IndexByte(s, 0) != -1 { 34 | return nil, EINVAL 35 | } 36 | a := make([]byte, len(s)+1) 37 | copy(a, s) 38 | return a, nil 39 | } 40 | 41 | // BytePtrFromString returns a pointer to a NUL-terminated array of 42 | // bytes containing the text of s. If s contains a NUL byte at any 43 | // location, it returns (nil, EINVAL). 44 | func BytePtrFromString(s string) (*byte, error) { 45 | a, err := ByteSliceFromString(s) 46 | if err != nil { 47 | return nil, err 48 | } 49 | return &a[0], nil 50 | } 51 | 52 | // Single-word zero for use when we need a valid pointer to 0 bytes. 53 | // See mkunix.pl. 54 | var _zero uintptr 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | // +build !aix 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | // We can't use the gc-syntax .s files for gccgo. On the plus side 13 | // much of the functionality can be written directly in Go. 14 | 15 | //extern gccgoRealSyscallNoError 16 | func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) 17 | 18 | //extern gccgoRealSyscall 19 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 20 | 21 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { 22 | syscall.Entersyscall() 23 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 24 | syscall.Exitsyscall() 25 | return r, 0 26 | } 27 | 28 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 29 | syscall.Entersyscall() 30 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 31 | syscall.Exitsyscall() 32 | return r, 0, syscall.Errno(errno) 33 | } 34 | 35 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 36 | syscall.Entersyscall() 37 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 38 | syscall.Exitsyscall() 39 | return r, 0, syscall.Errno(errno) 40 | } 41 | 42 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 43 | syscall.Entersyscall() 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 45 | syscall.Exitsyscall() 46 | return r, 0, syscall.Errno(errno) 47 | } 48 | 49 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { 50 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 51 | return r, 0 52 | } 53 | 54 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 55 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 56 | return r, 0, syscall.Errno(errno) 57 | } 58 | 59 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 60 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 61 | return r, 0, syscall.Errno(errno) 62 | } 63 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = int32(sec) 28 | tv.Usec = int32(usec) 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint32(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint32(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 59 | //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 60 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 61 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 62 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 63 | //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 64 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/filter.go: -------------------------------------------------------------------------------- 1 | package prompt 2 | 3 | import "strings" 4 | 5 | // Filter is the type to filter the prompt.Suggestion array. 6 | type Filter func([]Suggest, string, bool) []Suggest 7 | 8 | // FilterHasPrefix checks whether the string completions.Text begins with sub. 9 | func FilterHasPrefix(completions []Suggest, sub string, ignoreCase bool) []Suggest { 10 | return filterSuggestions(completions, sub, ignoreCase, strings.HasPrefix) 11 | } 12 | 13 | // FilterHasSuffix checks whether the completion.Text ends with sub. 14 | func FilterHasSuffix(completions []Suggest, sub string, ignoreCase bool) []Suggest { 15 | return filterSuggestions(completions, sub, ignoreCase, strings.HasSuffix) 16 | } 17 | 18 | // FilterContains checks whether the completion.Text contains sub. 19 | func FilterContains(completions []Suggest, sub string, ignoreCase bool) []Suggest { 20 | return filterSuggestions(completions, sub, ignoreCase, strings.Contains) 21 | } 22 | 23 | // FilterFuzzy checks whether the completion.Text fuzzy matches sub. 24 | // Fuzzy searching for "dog" is equivalent to "*d*o*g*". This search term 25 | // would match, for example, "Good food is gone" 26 | // ^ ^ ^ 27 | func FilterFuzzy(completions []Suggest, sub string, ignoreCase bool) []Suggest { 28 | return filterSuggestions(completions, sub, ignoreCase, fuzzyMatch) 29 | } 30 | 31 | func fuzzyMatch(s, sub string) bool { 32 | sChars := []rune(s) 33 | subChars := []rune(sub) 34 | sIdx := 0 35 | 36 | for _, c := range subChars { 37 | found := false 38 | for ; sIdx < len(sChars); sIdx++ { 39 | if sChars[sIdx] == c { 40 | found = true 41 | sIdx++ 42 | break 43 | } 44 | } 45 | if !found { 46 | return false 47 | } 48 | } 49 | return true 50 | } 51 | 52 | func filterSuggestions(suggestions []Suggest, sub string, ignoreCase bool, function func(string, string) bool) []Suggest { 53 | if sub == "" { 54 | return suggestions 55 | } 56 | if ignoreCase { 57 | sub = strings.ToUpper(sub) 58 | } 59 | 60 | ret := make([]Suggest, 0, len(suggestions)) 61 | for i := range suggestions { 62 | c := suggestions[i].Text 63 | if ignoreCase { 64 | c = strings.ToUpper(c) 65 | } 66 | if function(c, sub) { 67 | ret = append(ret, suggestions[i]) 68 | } 69 | } 70 | return ret 71 | } 72 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/input_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package prompt 4 | 5 | import ( 6 | "bytes" 7 | "errors" 8 | "syscall" 9 | "unicode/utf8" 10 | "unsafe" 11 | 12 | "github.com/mattn/go-tty" 13 | ) 14 | 15 | const maxReadBytes = 1024 16 | 17 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 18 | 19 | var procGetNumberOfConsoleInputEvents = kernel32.NewProc("GetNumberOfConsoleInputEvents") 20 | 21 | // WindowsParser is a ConsoleParser implementation for Win32 console. 22 | type WindowsParser struct { 23 | tty *tty.TTY 24 | } 25 | 26 | // Setup should be called before starting input 27 | func (p *WindowsParser) Setup() error { 28 | t, err := tty.Open() 29 | if err != nil { 30 | return err 31 | } 32 | p.tty = t 33 | return nil 34 | } 35 | 36 | // TearDown should be called after stopping input 37 | func (p *WindowsParser) TearDown() error { 38 | return p.tty.Close() 39 | } 40 | 41 | // GetKey returns Key correspond to input byte codes. 42 | func (p *WindowsParser) GetKey(b []byte) Key { 43 | for _, k := range asciiSequences { 44 | if bytes.Compare(k.ASCIICode, b) == 0 { 45 | return k.Key 46 | } 47 | } 48 | return NotDefined 49 | } 50 | 51 | // Read returns byte array. 52 | func (p *WindowsParser) Read() ([]byte, error) { 53 | var ev uint32 54 | r0, _, err := procGetNumberOfConsoleInputEvents.Call(p.tty.Input().Fd(), uintptr(unsafe.Pointer(&ev))) 55 | if r0 == 0 { 56 | return nil, err 57 | } 58 | if ev == 0 { 59 | return nil, errors.New("EAGAIN") 60 | } 61 | 62 | r, err := p.tty.ReadRune() 63 | if err != nil { 64 | return nil, err 65 | } 66 | 67 | buf := make([]byte, maxReadBytes) 68 | n := utf8.EncodeRune(buf[:], r) 69 | for p.tty.Buffered() && n < maxReadBytes { 70 | r, err := p.tty.ReadRune() 71 | if err != nil { 72 | break 73 | } 74 | n += utf8.EncodeRune(buf[n:], r) 75 | } 76 | return buf[:n], nil 77 | } 78 | 79 | // GetWinSize returns WinSize object to represent width and height of terminal. 80 | func (p *WindowsParser) GetWinSize() *WinSize { 81 | w, h, err := p.tty.Size() 82 | if err != nil { 83 | panic(err) 84 | } 85 | return &WinSize{ 86 | Row: uint16(h), 87 | Col: uint16(w), 88 | } 89 | } 90 | 91 | // NewStandardInputParser returns ConsoleParser object to read from stdin. 92 | func NewStandardInputParser() *WindowsParser { 93 | return &WindowsParser{} 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/key.go: -------------------------------------------------------------------------------- 1 | // Code generated "This is a fake comment to avoid golint errors"; DO NOT EDIT. 2 | // FIXME: This is a little bit stupid, but there are many public constants which is no value for writing godoc comment. 3 | 4 | package prompt 5 | 6 | // Key is the type express the key inserted from user. 7 | type Key int 8 | 9 | // ASCIICode is the type contains Key and it's ascii byte array. 10 | type ASCIICode struct { 11 | Key Key 12 | ASCIICode []byte 13 | } 14 | 15 | const ( 16 | Escape Key = iota 17 | 18 | ControlA 19 | ControlB 20 | ControlC 21 | ControlD 22 | ControlE 23 | ControlF 24 | ControlG 25 | ControlH 26 | ControlI 27 | ControlJ 28 | ControlK 29 | ControlL 30 | ControlM 31 | ControlN 32 | ControlO 33 | ControlP 34 | ControlQ 35 | ControlR 36 | ControlS 37 | ControlT 38 | ControlU 39 | ControlV 40 | ControlW 41 | ControlX 42 | ControlY 43 | ControlZ 44 | 45 | ControlSpace 46 | ControlBackslash 47 | ControlSquareClose 48 | ControlCircumflex 49 | ControlUnderscore 50 | ControlLeft 51 | ControlRight 52 | ControlUp 53 | ControlDown 54 | 55 | Up 56 | Down 57 | Right 58 | Left 59 | 60 | ShiftLeft 61 | ShiftUp 62 | ShiftDown 63 | ShiftRight 64 | 65 | Home 66 | End 67 | Delete 68 | ShiftDelete 69 | ControlDelete 70 | PageUp 71 | PageDown 72 | BackTab 73 | Insert 74 | Backspace 75 | 76 | // Aliases. 77 | Tab 78 | Enter 79 | // Actually Enter equals ControlM, not ControlJ, 80 | // However, in prompt_toolkit, we made the mistake of translating 81 | // \r into \n during the input, so everyone is now handling the 82 | // enter key by binding ControlJ. 83 | 84 | // From now on, it's better to bind `ASCII_SEQUENCES.Enter` everywhere, 85 | // because that's future compatible, and will still work when we 86 | // stop replacing \r by \n. 87 | 88 | F1 89 | F2 90 | F3 91 | F4 92 | F5 93 | F6 94 | F7 95 | F8 96 | F9 97 | F10 98 | F11 99 | F12 100 | F13 101 | F14 102 | F15 103 | F16 104 | F17 105 | F18 106 | F19 107 | F20 108 | F21 109 | F22 110 | F23 111 | F24 112 | 113 | // Matches any key. 114 | Any 115 | 116 | // Special 117 | CPRResponse 118 | Vt100MouseEvent 119 | WindowsMouseEvent 120 | BracketedPaste 121 | 122 | // Key which is ignored. (The key binding for this key should not do anything.) 123 | Ignore 124 | 125 | // Key is not defined 126 | NotDefined 127 | ) 128 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "strings" 8 | "syscall" 9 | "unicode/utf16" 10 | "unsafe" 11 | ) 12 | 13 | const ( 14 | fileNameInfo uintptr = 2 15 | fileTypePipe = 3 16 | ) 17 | 18 | var ( 19 | kernel32 = syscall.NewLazyDLL("kernel32.dll") 20 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 21 | procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx") 22 | procGetFileType = kernel32.NewProc("GetFileType") 23 | ) 24 | 25 | func init() { 26 | // Check if GetFileInformationByHandleEx is available. 27 | if procGetFileInformationByHandleEx.Find() != nil { 28 | procGetFileInformationByHandleEx = nil 29 | } 30 | } 31 | 32 | // IsTerminal return true if the file descriptor is terminal. 33 | func IsTerminal(fd uintptr) bool { 34 | var st uint32 35 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) 36 | return r != 0 && e == 0 37 | } 38 | 39 | // Check pipe name is used for cygwin/msys2 pty. 40 | // Cygwin/MSYS2 PTY has a name like: 41 | // \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master 42 | func isCygwinPipeName(name string) bool { 43 | token := strings.Split(name, "-") 44 | if len(token) < 5 { 45 | return false 46 | } 47 | 48 | if token[0] != `\msys` && token[0] != `\cygwin` { 49 | return false 50 | } 51 | 52 | if token[1] == "" { 53 | return false 54 | } 55 | 56 | if !strings.HasPrefix(token[2], "pty") { 57 | return false 58 | } 59 | 60 | if token[3] != `from` && token[3] != `to` { 61 | return false 62 | } 63 | 64 | if token[4] != "master" { 65 | return false 66 | } 67 | 68 | return true 69 | } 70 | 71 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 72 | // terminal. 73 | func IsCygwinTerminal(fd uintptr) bool { 74 | if procGetFileInformationByHandleEx == nil { 75 | return false 76 | } 77 | 78 | // Cygwin/msys's pty is a pipe. 79 | ft, _, e := syscall.Syscall(procGetFileType.Addr(), 1, fd, 0, 0) 80 | if ft != fileTypePipe || e != 0 { 81 | return false 82 | } 83 | 84 | var buf [2 + syscall.MAX_PATH]uint16 85 | r, _, e := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 86 | 4, fd, fileNameInfo, uintptr(unsafe.Pointer(&buf)), 87 | uintptr(len(buf)*2), 0, 0) 88 | if r == 0 || e != 0 { 89 | return false 90 | } 91 | 92 | l := *(*uint32)(unsafe.Pointer(&buf)) 93 | return isCygwinPipeName(string(utf16.Decode(buf[2 : 2+l/2]))) 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-tty/tty.go: -------------------------------------------------------------------------------- 1 | package tty 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "unicode" 7 | ) 8 | 9 | func Open() (*TTY, error) { 10 | return open() 11 | } 12 | 13 | func (tty *TTY) Raw() (func() error, error) { 14 | return tty.raw() 15 | } 16 | 17 | func (tty *TTY) MustRaw() func() error { 18 | f, err := tty.raw() 19 | if err != nil { 20 | panic(err.Error()) 21 | } 22 | return f 23 | } 24 | 25 | func (tty *TTY) Buffered() bool { 26 | return tty.buffered() 27 | } 28 | 29 | func (tty *TTY) ReadRune() (rune, error) { 30 | return tty.readRune() 31 | } 32 | 33 | func (tty *TTY) Close() error { 34 | return tty.close() 35 | } 36 | 37 | func (tty *TTY) Size() (int, int, error) { 38 | return tty.size() 39 | } 40 | 41 | func (tty *TTY) Input() *os.File { 42 | return tty.input() 43 | } 44 | 45 | func (tty *TTY) Output() *os.File { 46 | return tty.output() 47 | } 48 | 49 | // Display types. 50 | const ( 51 | displayNone = iota 52 | displayRune 53 | displayMask 54 | ) 55 | 56 | func (tty *TTY) readString(displayType int) (string, error) { 57 | rs := []rune{} 58 | loop: 59 | for { 60 | r, err := tty.readRune() 61 | if err != nil { 62 | return "", err 63 | } 64 | switch r { 65 | case 13: 66 | break loop 67 | case 8, 127: 68 | if len(rs) > 0 { 69 | rs = rs[:len(rs)-1] 70 | if displayType != displayNone { 71 | tty.Output().WriteString("\b \b") 72 | } 73 | } 74 | default: 75 | if unicode.IsPrint(r) { 76 | rs = append(rs, r) 77 | switch displayType { 78 | case displayRune: 79 | tty.Output().WriteString(string(r)) 80 | case displayMask: 81 | tty.Output().WriteString("*") 82 | } 83 | } 84 | } 85 | } 86 | return string(rs), nil 87 | } 88 | 89 | func (tty *TTY) ReadString() (string, error) { 90 | defer tty.Output().WriteString("\n") 91 | return tty.readString(displayRune) 92 | } 93 | 94 | func (tty *TTY) ReadPassword() (string, error) { 95 | defer tty.Output().WriteString("\n") 96 | return tty.readString(displayMask) 97 | } 98 | 99 | func (tty *TTY) ReadPasswordNoEcho() (string, error) { 100 | defer tty.Output().WriteString("\n") 101 | return tty.readString(displayNone) 102 | } 103 | 104 | func (tty *TTY) ReadPasswordClear() (string, error) { 105 | s, err := tty.readString(displayMask) 106 | tty.Output().WriteString( 107 | strings.Repeat("\b", len(s)) + 108 | strings.Repeat(" ", len(s)) + 109 | strings.Repeat("\b", len(s))) 110 | return s, err 111 | } 112 | 113 | type WINSIZE struct { 114 | W int 115 | H int 116 | } 117 | 118 | func (tty *TTY) SIGWINCH() chan WINSIZE { 119 | return tty.sigwinch() 120 | } 121 | -------------------------------------------------------------------------------- /example.scm: -------------------------------------------------------------------------------- 1 | ; Created by xrlin 2 | ; Usage: (load "example") or (load "example.scm") 3 | ; This example file contains the procedures to calculate Fibonacci number, calculate and display pascal triangle number. 4 | (define (fib n) 5 | (if (<= n 2) 1 (+ (fib (- n 1)) (fib (- n 2))))) 6 | 7 | (define (fib2 n) 8 | (begin (define (fib-iter a b n) 9 | (if (= n 0) b (fib-iter b (+ a b) (- n 1)))) 10 | (fib-iter 0 1 (- n 1)))) 11 | 12 | (define (display-pascal n) 13 | (begin 14 | (define lst '()))) 15 | 16 | (define (add-num a b) 17 | (cond 18 | ((null? a) b) 19 | ((null? b) a) 20 | (else (+ a b)))) 21 | 22 | (define (calc-pascal lst k) 23 | (if (<= k 0) lst 24 | (begin (list-set! lst k (add-num (list-ref lst (- k 1)) (list-ref lst k))) 25 | (calc-pascal lst (- k 1))))) 26 | 27 | (define (generate-pascal-helper sequence k n) 28 | (cond ((= k n) sequence) 29 | (else (generate-pascal-helper (append (calc-pascal sequence (- k 1)) 1) (+ k 1) n)))) 30 | 31 | (define (generate-pascal n) 32 | (generate-pascal-helper '() 0 n)) 33 | 34 | (define (display-pascal-helper sequence current-level max-level width) 35 | (begin 36 | (display-pascal-indents (- max-level current-level) width) 37 | (display-pascal-sequence sequence width))) 38 | 39 | (define (display-blank n) 40 | (if (> n 0) (display " "))) 41 | 42 | (define (display-tab n) 43 | (if (> n 0) (begin (display "\t") (display-tab (- n 1))))) 44 | 45 | (define (display-pascal-indents indent-count width) 46 | (if (> indent-count 0) (begin (display-tab 1) (display-pascal-indents (- indent-count 1) width)))) 47 | 48 | (define (display-pascal-sequence sequence width) 49 | (if (null? sequence) (displayln "") (begin (display-pascal-num (car sequence) width) (display-pascal-sequence (cdr sequence) width)))) 50 | 51 | (define (max-pascal-number level) 52 | (reduce (lambda (x y) (if (> x y) x y)) (generate-pascal level))) 53 | 54 | (define (number-char-width num) 55 | (begin 56 | (define (number-width num) 57 | (if (< num 10) 1 (+ (number-width (/ num 10)) 1))) 58 | (number-width num))) 59 | 60 | (define (display-pascal-num num width) 61 | (if (<= (number-char-width num) width) 62 | (begin (display num) (display-blank (- width (number-char-width num))) (display-tab 2)))) 63 | 64 | (define (display-pascal-triangle-helper start-level max-level char-width) 65 | (if (<= start-level max-level) (begin 66 | (display-pascal-helper (generate-pascal start-level) start-level max-level char-width) 67 | (display-pascal-triangle-helper (+ start-level 1) max-level char-width)))) 68 | 69 | (define (display-pascal-triangle start-level max-level) 70 | (display-pascal-triangle-helper start-level max-level (number-char-width (max-pascal-number max-level)))) 71 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/termios_linux.go: -------------------------------------------------------------------------------- 1 | package termios 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | const ( 9 | TCSETS = 0x5402 10 | TCSETSW = 0x5403 11 | TCSETSF = 0x5404 12 | TCFLSH = 0x540B 13 | TCSBRK = 0x5409 14 | TCSBRKP = 0x5425 15 | 16 | IXON = 0x00000400 17 | IXANY = 0x00000800 18 | IXOFF = 0x00001000 19 | CRTSCTS = 0x80000000 20 | ) 21 | 22 | // Tcgetattr gets the current serial port settings. 23 | func Tcgetattr(fd uintptr, argp *syscall.Termios) error { 24 | return ioctl(fd, syscall.TCGETS, uintptr(unsafe.Pointer(argp))) 25 | } 26 | 27 | // Tcsetattr sets the current serial port settings. 28 | func Tcsetattr(fd, action uintptr, argp *syscall.Termios) error { 29 | var request uintptr 30 | switch action { 31 | case TCSANOW: 32 | request = TCSETS 33 | case TCSADRAIN: 34 | request = TCSETSW 35 | case TCSAFLUSH: 36 | request = TCSETSF 37 | default: 38 | return syscall.EINVAL 39 | } 40 | return ioctl(fd, request, uintptr(unsafe.Pointer(argp))) 41 | } 42 | 43 | // Tcsendbreak transmits a continuous stream of zero-valued bits for a specific 44 | // duration, if the terminal is using asynchronous serial data transmission. If 45 | // duration is zero, it transmits zero-valued bits for at least 0.25 seconds, and not more that 0.5 seconds. 46 | // If duration is not zero, it sends zero-valued bits for some 47 | // implementation-defined length of time. 48 | func Tcsendbreak(fd, duration uintptr) error { 49 | return ioctl(fd, TCSBRKP, duration) 50 | } 51 | 52 | // Tcdrain waits until all output written to the object referred to by fd has been transmitted. 53 | func Tcdrain(fd uintptr) error { 54 | // simulate drain with TCSADRAIN 55 | var attr syscall.Termios 56 | if err := Tcgetattr(fd, &attr); err != nil { 57 | return err 58 | } 59 | return Tcsetattr(fd, TCSADRAIN, &attr) 60 | } 61 | 62 | // Tcflush discards data written to the object referred to by fd but not transmitted, or data received but not read, depending on the value of selector. 63 | func Tcflush(fd, selector uintptr) error { 64 | return ioctl(fd, TCFLSH, selector) 65 | } 66 | 67 | // Tiocinq returns the number of bytes in the input buffer. 68 | func Tiocinq(fd uintptr, argp *int) error { 69 | return ioctl(fd, syscall.TIOCINQ, uintptr(unsafe.Pointer(argp))) 70 | } 71 | 72 | // Tiocoutq return the number of bytes in the output buffer. 73 | func Tiocoutq(fd uintptr, argp *int) error { 74 | return ioctl(fd, syscall.TIOCOUTQ, uintptr(unsafe.Pointer(argp))) 75 | } 76 | 77 | // Cfgetispeed returns the input baud rate stored in the termios structure. 78 | func Cfgetispeed(attr *syscall.Termios) uint32 { return attr.Ispeed } 79 | 80 | // Cfgetospeed returns the output baud rate stored in the termios structure. 81 | func Cfgetospeed(attr *syscall.Termios) uint32 { return attr.Ospeed } 82 | -------------------------------------------------------------------------------- /lexer_test.go: -------------------------------------------------------------------------------- 1 | package goscheme 2 | 3 | import ( 4 | "errors" 5 | "github.com/stretchr/testify/assert" 6 | "testing" 7 | ) 8 | 9 | func TestTokenize(t *testing.T) { 10 | testCases := []struct { 11 | input string 12 | expected []string 13 | }{ 14 | {"()", []string{"(", ")"}}, 15 | {"( )", []string{"(", ")"}}, 16 | {`"a string"`, []string{`"a string"`}}, 17 | {`"a string\n\\"`, []string{"\"a string\n\\\""}}, 18 | {`"paragraph 1 19 | paragraph 2"`, []string{`"paragraph 1 20 | paragraph 2"`}}, 21 | {`(display "string ")`, []string{"(", "display", `"string "`, ")"}}, 22 | {"3(display 1)", []string{"3", "(", "display", "1", ")"}}, 23 | {"(define x 3)", []string{"(", "define", "x", "3", ")"}}, 24 | {"(lambda (x y) (display x))", []string{"(", "lambda", "(", "x", "y", ")", "(", "display", "x", ")", ")"}}, 25 | {`(lambda (x y) 26 | (display x))`, []string{"(", "lambda", "(", "x", "y", ")", "(", "display", "x", ")", ")"}}, 27 | {"(define (func x) (define (intern x) (x)))", 28 | []string{"(", "define", "(", "func", "x", ")", "(", "define", "(", "intern", "x", ")", "(", "x", ")", ")", ")"}}, 29 | {"(quote x)", []string{"(", "quote", "x", ")"}}, 30 | {"'x", []string{"'", "x"}}, 31 | {"'x()", []string{"'", "x", "(", ")"}}, 32 | {"' x", []string{"'", "x"}}, 33 | {"\"'x\"", []string{`"'x"`}}, 34 | } 35 | for _, c := range testCases { 36 | assert.Equal(t, c.expected, Tokenize(c.input)) 37 | } 38 | } 39 | 40 | func TestParse(t *testing.T) { 41 | testCases := []struct { 42 | input []string 43 | expected Expression 44 | err error 45 | }{ 46 | {[]string{"(", ")"}, []Expression{[]Expression{}}, nil}, 47 | {[]string{"3"}, []Expression{"3"}, nil}, 48 | {[]string{"3", "(", "define", "x", "1", ")"}, []Expression{"3", []Expression{"define", "x", "1"}}, nil}, 49 | {[]string{"3", "(", "define", "x", "1"}, []Expression{"3", []Expression{"define", "x", 1}}, errors.New("syntax error")}, 50 | {[]string{"(", "define", "x", "3", ")"}, []Expression{[]Expression{"define", "x", "3"}}, nil}, 51 | {[]string{"(", "define", "(", "func", "x", ")", "(", "define", "(", "intern", "x", ")", "(", "x", ")", ")", ")"}, 52 | []Expression{[]Expression{"define", 53 | []Expression{"func", "x"}, []Expression{"define", []Expression{"intern", "x"}, []Expression{"x"}}}}, nil}, 54 | // test quote abbreviation 55 | {[]string{"'", "x"}, []Expression{[]Expression{"quote", "x"}}, nil}, 56 | {[]string{"'", "x", "(", ")"}, []Expression{[]Expression{"quote", "x"}, []Expression{}}, nil}, 57 | {[]string{"'", "(", "x", ")"}, []Expression{[]Expression{"quote", []Expression{"x"}}}, nil}, 58 | {[]string{"'", "(", "x", ")"}, []Expression{[]Expression{"quote", []Expression{"x"}}}, nil}, 59 | } 60 | for _, c := range testCases { 61 | ret, err := Parse(&c.input) 62 | if c.err != nil { 63 | assert.NotNil(t, err) 64 | continue 65 | } 66 | assert.Equal(t, c.expected, ret) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/term/termios/termios_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | 3 | package termios 4 | 5 | import ( 6 | "syscall" 7 | "time" 8 | "unsafe" 9 | ) 10 | 11 | const ( 12 | FREAD = 0x0001 13 | FWRITE = 0x0002 14 | 15 | IXON = 0x00000200 16 | IXOFF = 0x00000400 17 | IXANY = 0x00000800 18 | CCTS_OFLOW = 0x00010000 19 | CRTS_IFLOW = 0x00020000 20 | CRTSCTS = CCTS_OFLOW | CRTS_IFLOW 21 | ) 22 | 23 | // Tcgetattr gets the current serial port settings. 24 | func Tcgetattr(fd uintptr, argp *syscall.Termios) error { 25 | return ioctl(fd, syscall.TIOCGETA, uintptr(unsafe.Pointer(argp))) 26 | } 27 | 28 | // Tcsetattr sets the current serial port settings. 29 | func Tcsetattr(fd, opt uintptr, argp *syscall.Termios) error { 30 | switch opt { 31 | case TCSANOW: 32 | opt = syscall.TIOCSETA 33 | case TCSADRAIN: 34 | opt = syscall.TIOCSETAW 35 | case TCSAFLUSH: 36 | opt = syscall.TIOCSETAF 37 | default: 38 | return syscall.EINVAL 39 | } 40 | return ioctl(fd, opt, uintptr(unsafe.Pointer(argp))) 41 | } 42 | 43 | // Tcsendbreak function transmits a continuous stream of zero-valued bits for 44 | // four-tenths of a second to the terminal referenced by fildes. The duration 45 | // parameter is ignored in this implementation. 46 | func Tcsendbreak(fd, duration uintptr) error { 47 | if err := ioctl(fd, syscall.TIOCSBRK, 0); err != nil { 48 | return err 49 | } 50 | time.Sleep(4 / 10 * time.Second) 51 | return ioctl(fd, syscall.TIOCCBRK, 0) 52 | } 53 | 54 | // Tcdrain waits until all output written to the terminal referenced by fd has been transmitted to the terminal. 55 | func Tcdrain(fd uintptr) error { 56 | return ioctl(fd, syscall.TIOCDRAIN, 0) 57 | } 58 | 59 | // Tcflush discards data written to the object referred to by fd but not transmitted, or data received but not read, depending on the value of which. 60 | func Tcflush(fd, which uintptr) error { 61 | var com int 62 | switch which { 63 | case syscall.TCIFLUSH: 64 | com = FREAD 65 | case syscall.TCOFLUSH: 66 | com = FWRITE 67 | case syscall.TCIOFLUSH: 68 | com = FREAD | FWRITE 69 | default: 70 | return syscall.EINVAL 71 | } 72 | return ioctl(fd, syscall.TIOCFLUSH, uintptr(unsafe.Pointer(&com))) 73 | } 74 | 75 | // Cfgetispeed returns the input baud rate stored in the termios structure. 76 | func Cfgetispeed(attr *syscall.Termios) uint32 { return uint32(attr.Ispeed) } 77 | 78 | // Cfgetospeed returns the output baud rate stored in the termios structure. 79 | func Cfgetospeed(attr *syscall.Termios) uint32 { return uint32(attr.Ospeed) } 80 | 81 | // Tiocinq returns the number of bytes in the input buffer. 82 | func Tiocinq(fd uintptr, argp *int) error { 83 | *argp = 0 84 | return nil 85 | } 86 | 87 | // Tiocoutq return the number of bytes in the output buffer. 88 | func Tiocoutq(fd uintptr, argp *int) error { 89 | return ioctl(fd, syscall.TIOCOUTQ, uintptr(unsafe.Pointer(argp))) 90 | } 91 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/timestruct.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "time" 10 | 11 | // TimespecToNsec converts a Timespec value into a number of 12 | // nanoseconds since the Unix epoch. 13 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 14 | 15 | // NsecToTimespec takes a number of nanoseconds since the Unix epoch 16 | // and returns the corresponding Timespec value. 17 | func NsecToTimespec(nsec int64) Timespec { 18 | sec := nsec / 1e9 19 | nsec = nsec % 1e9 20 | if nsec < 0 { 21 | nsec += 1e9 22 | sec-- 23 | } 24 | return setTimespec(sec, nsec) 25 | } 26 | 27 | // TimeToTimespec converts t into a Timespec. 28 | // On some 32-bit systems the range of valid Timespec values are smaller 29 | // than that of time.Time values. So if t is out of the valid range of 30 | // Timespec, it returns a zero Timespec and ERANGE. 31 | func TimeToTimespec(t time.Time) (Timespec, error) { 32 | sec := t.Unix() 33 | nsec := int64(t.Nanosecond()) 34 | ts := setTimespec(sec, nsec) 35 | 36 | // Currently all targets have either int32 or int64 for Timespec.Sec. 37 | // If there were a new target with floating point type for it, we have 38 | // to consider the rounding error. 39 | if int64(ts.Sec) != sec { 40 | return Timespec{}, ERANGE 41 | } 42 | return ts, nil 43 | } 44 | 45 | // TimevalToNsec converts a Timeval value into a number of nanoseconds 46 | // since the Unix epoch. 47 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 48 | 49 | // NsecToTimeval takes a number of nanoseconds since the Unix epoch 50 | // and returns the corresponding Timeval value. 51 | func NsecToTimeval(nsec int64) Timeval { 52 | nsec += 999 // round up to microsecond 53 | usec := nsec % 1e9 / 1e3 54 | sec := nsec / 1e9 55 | if usec < 0 { 56 | usec += 1e6 57 | sec-- 58 | } 59 | return setTimeval(sec, usec) 60 | } 61 | 62 | // Unix returns ts as the number of seconds and nanoseconds elapsed since the 63 | // Unix epoch. 64 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 65 | return int64(ts.Sec), int64(ts.Nsec) 66 | } 67 | 68 | // Unix returns tv as the number of seconds and nanoseconds elapsed since the 69 | // Unix epoch. 70 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 71 | return int64(tv.Sec), int64(tv.Usec) * 1000 72 | } 73 | 74 | // Nano returns ts as the number of nanoseconds elapsed since the Unix epoch. 75 | func (ts *Timespec) Nano() int64 { 76 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 77 | } 78 | 79 | // Nano returns tv as the number of nanoseconds elapsed since the Unix epoch. 80 | func (tv *Timeval) Nano() int64 { 81 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 82 | } 83 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## v0.3.0 (2018/??/??) 4 | 5 | next release. 6 | 7 | ## v0.2.3 (2018/10/25) 8 | 9 | ### What's new? 10 | 11 | * Add `prompt.FuzzyFilter` for fuzzy matching at [#92](https://github.com/c-bata/go-prompt/pull/92). 12 | * Add `OptionShowCompletionAtStart` to show completion at start at [#100](https://github.com/c-bata/go-prompt/pull/100). 13 | * Add `prompt.NewStderrWriter` at [#102](https://github.com/c-bata/go-prompt/pull/102). 14 | 15 | ### Fixed 16 | 17 | * Fix resetting display attributes (please see [pull #104](https://github.com/c-bata/go-prompt/pull/104) for more details). 18 | * Fix error handling of Flush function in ConsoleWriter (please see [pull #97](https://github.com/c-bata/go-prompt/pull/97) for more details). 19 | * Fix panic problem when reading from stdin before starting the prompt (please see [issue #88](https://github.com/c-bata/go-prompt/issues/88) for more details). 20 | 21 | ### Removed or Deprecated 22 | 23 | * `prompt.NewStandardOutputWriter` is deprecated. Please use `prompt.NewStdoutWriter`. 24 | 25 | ## v0.2.2 (2018/06/28) 26 | 27 | ### What's new? 28 | 29 | * Support CJK(Chinese, Japanese and Korean) and Cyrillic characters. 30 | * Add OptionCompletionWordSeparator(x string) to customize insertion points for completions. 31 | * To support this, text query functions by arbitrary word separator are added in Document (please see [here](https://github.com/c-bata/go-prompt/pull/79) for more details). 32 | * Add FilePathCompleter to complete file path on your system. 33 | * Add option to customize ascii code key bindings. 34 | * Add GetWordAfterCursor method in Document. 35 | 36 | ### Removed or Deprecated 37 | 38 | * prompt.Choose shortcut function is deprecated. 39 | 40 | ## v0.2.1 (2018/02/14) 41 | 42 | ### What's New? 43 | 44 | * ~~It seems that windows support is almost perfect.~~ 45 | * A critical bug is found :( When you change a terminal window size, the layout will be broken because current implementation cannot catch signal for updating window size on Windows. 46 | 47 | ### Fixed 48 | 49 | * Fix a Shift+Tab handling on Windows. 50 | * Fix 4-dimension arrow keys handling on Windows. 51 | 52 | ## v0.2.0 (2018/02/13) 53 | 54 | ### What's New? 55 | 56 | * Supports scrollbar when there are too many matched suggestions 57 | * Windows support (but please caution because this is still not perfect). 58 | * Add OptionLivePrefix to update the prefix dynamically 59 | * Implement clear screen by `Ctrl+L`. 60 | 61 | ### Fixed 62 | 63 | * Fix the behavior of `Ctrl+W` keybind. 64 | * Fix the panic because when running on a docker container (please see [here](https://github.com/c-bata/go-prompt/pull/32) for details). 65 | * Fix panic when making terminal window small size after input 2 lines of texts. See [here](https://github.com/c-bata/go-prompt/issues/37) for details). 66 | * And also fixed many bugs that layout is broken when using Terminal.app, GNU Terminal and a Goland(IntelliJ). 67 | 68 | ### News 69 | 70 | New core developers are joined (alphabetical order). 71 | 72 | * Nao Yonashiro (Github @orisano) 73 | * Ryoma Abe (Github @Allajah) 74 | * Yusuke Nakamura (Github @unasuke) 75 | 76 | 77 | ## v0.1.0 (2017/08/15) 78 | 79 | Initial Release 80 | -------------------------------------------------------------------------------- /vendor/github.com/c-bata/go-prompt/emacs.go: -------------------------------------------------------------------------------- 1 | package prompt 2 | 3 | /* 4 | 5 | ======== 6 | PROGRESS 7 | ======== 8 | 9 | Moving the cursor 10 | ----------------- 11 | 12 | * [x] Ctrl + a Go to the beginning of the line (Home) 13 | * [x] Ctrl + e Go to the End of the line (End) 14 | * [x] Ctrl + p Previous command (Up arrow) 15 | * [x] Ctrl + n Next command (Down arrow) 16 | * [x] Ctrl + f Forward one character 17 | * [x] Ctrl + b Backward one character 18 | * [x] Ctrl + xx Toggle between the start of line and current cursor position 19 | 20 | Editing 21 | ------- 22 | 23 | * [x] Ctrl + L Clear the Screen, similar to the clear command 24 | * [x] Ctrl + d Delete character under the cursor 25 | * [x] Ctrl + h Delete character before the cursor (Backspace) 26 | 27 | * [x] Ctrl + w Cut the Word before the cursor to the clipboard. 28 | * [x] Ctrl + k Cut the Line after the cursor to the clipboard. 29 | * [x] Ctrl + u Cut/delete the Line before the cursor to the clipboard. 30 | 31 | * [ ] Ctrl + t Swap the last two characters before the cursor (typo). 32 | * [ ] Esc + t Swap the last two words before the cursor. 33 | 34 | * [ ] ctrl + y Paste the last thing to be cut (yank) 35 | * [ ] ctrl + _ Undo 36 | 37 | */ 38 | 39 | var emacsKeyBindings = []KeyBind{ 40 | // Go to the End of the line 41 | { 42 | Key: ControlE, 43 | Fn: func(buf *Buffer) { 44 | x := []rune(buf.Document().TextAfterCursor()) 45 | buf.CursorRight(len(x)) 46 | }, 47 | }, 48 | // Go to the beginning of the line 49 | { 50 | Key: ControlA, 51 | Fn: func(buf *Buffer) { 52 | x := []rune(buf.Document().TextBeforeCursor()) 53 | buf.CursorLeft(len(x)) 54 | }, 55 | }, 56 | // Cut the Line after the cursor 57 | { 58 | Key: ControlK, 59 | Fn: func(buf *Buffer) { 60 | x := []rune(buf.Document().TextAfterCursor()) 61 | buf.Delete(len(x)) 62 | }, 63 | }, 64 | // Cut/delete the Line before the cursor 65 | { 66 | Key: ControlU, 67 | Fn: func(buf *Buffer) { 68 | x := []rune(buf.Document().TextBeforeCursor()) 69 | buf.DeleteBeforeCursor(len(x)) 70 | }, 71 | }, 72 | // Delete character under the cursor 73 | { 74 | Key: ControlD, 75 | Fn: func(buf *Buffer) { 76 | if buf.Text() != "" { 77 | buf.Delete(1) 78 | } 79 | }, 80 | }, 81 | // Backspace 82 | { 83 | Key: ControlH, 84 | Fn: func(buf *Buffer) { 85 | buf.DeleteBeforeCursor(1) 86 | }, 87 | }, 88 | // Right allow: Forward one character 89 | { 90 | Key: ControlF, 91 | Fn: func(buf *Buffer) { 92 | buf.CursorRight(1) 93 | }, 94 | }, 95 | // Left allow: Backward one character 96 | { 97 | Key: ControlB, 98 | Fn: func(buf *Buffer) { 99 | buf.CursorLeft(1) 100 | }, 101 | }, 102 | // Cut the Word before the cursor. 103 | { 104 | Key: ControlW, 105 | Fn: func(buf *Buffer) { 106 | buf.DeleteBeforeCursor(len([]rune(buf.Document().GetWordBeforeCursorWithSpace()))) 107 | }, 108 | }, 109 | // Clear the Screen, similar to the clear command 110 | { 111 | Key: ControlL, 112 | Fn: func(buf *Buffer) { 113 | consoleWriter.EraseScreen() 114 | consoleWriter.CursorGoTo(0, 0) 115 | consoleWriter.Flush() 116 | }, 117 | }, 118 | } 119 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

GoScheme


2 |

Just another shceme interpreter written in Go.

3 |

4 | 5 | 6 | godoc 7 | 8 | 9 |

10 | 11 |

12 | 13 |

14 | 15 | ## Installation 16 | 17 | ```bash 18 | go get github.com/xrlin/goscheme/cmd/goscheme 19 | ``` 20 | 21 | Or you can download the corresponding pre-compiled executable file in [release page](https://github.com/xrlin/goscheme/releases). 22 | 23 | ## Usage 24 | 25 | ```shell 26 | # Just run goscheme to enter interactive shell 27 | goscheme 28 | 29 | # Run a scheme file 30 | goscheme test.scm 31 | ``` 32 | 33 | ## Examples 34 | 35 | * Calculate nth fibonacci number 36 | 37 | ```scheme 38 | ; calculate nth fibonacci number 39 | (define (fib n) 40 | (if (<= n 2) 1 (+ (fib (- n 1)) (fib (- n 2))))) 41 | 42 | (fib 10) 43 | 44 | ;#=> 55 45 | 46 | ; calculate nth fibnacci number in tail recursion 47 | (define (fib2 n) 48 | (begin (define (fib-iter a b n) 49 | (if (= n 0) b (fib-iter b (+ a b) (- n 1)))) 50 | (fib-iter 0 1 (- n 1)))) 51 | (fib2 30) 52 | ;#=>832040 53 | ``` 54 | 55 | * Mutually recursion 56 | 57 | ```scheme 58 | (letrec ( 59 | (zero? (lambda (x) (= x 0))) 60 | (even? 61 | (lambda (n) 62 | (if (zero? n) 63 | #t 64 | (odd? (- n 1))))) 65 | (odd? 66 | (lambda (n) 67 | (if (zero? n) 68 | #f 69 | (even? (- n 1)))))) 70 | (even? 88)) 71 | ;#=>#t 72 | ``` 73 | 74 | Explore `example.scm` for more examples. 75 | 76 | 77 | ## Features 78 | 79 | * Interactive REPL shell 80 | 81 | * Tail recursion optimization 82 | 83 | * Lazy evaluation 84 | 85 | * Short circut logic 86 | 87 | * Type: `String`, `Number`, `Quote`, `LambdaProcess`, `Pair`, `Bool` ... 88 | 89 | * syntax, builtin functions and procedures 90 | 91 | `load` 92 | `define` 93 | `let` 94 | `let*` 95 | `letrec` 96 | `begin` 97 | `lambda` 98 | `and` 99 | `or` 100 | `not` 101 | `if` 102 | `cond` 103 | `delay` 104 | `map` 105 | `reduce` 106 | `force` 107 | `+` 108 | `-` 109 | `*` 110 | `/` 111 | `=` 112 | `cons` 113 | `list` 114 | `append` 115 | `list-length` 116 | `list-ref` 117 | `quote` 118 | `null?` 119 | `'` 120 | `eval` 121 | `apply` 122 | `set!` 123 | `set-cdr!` 124 | `set-car!` 125 | ... etc 126 | 127 | Though it is a toy project just for fun and practice, Feel free to open an issue or make a merge request is you find bugs or have some suggestions. 128 | 129 | Happy coding... 130 | 131 | 132 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-tty/tty_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !plan9 3 | 4 | package tty 5 | 6 | import ( 7 | "bufio" 8 | "os" 9 | "os/signal" 10 | "syscall" 11 | "unsafe" 12 | 13 | "golang.org/x/sys/unix" 14 | ) 15 | 16 | type TTY struct { 17 | in *os.File 18 | bin *bufio.Reader 19 | out *os.File 20 | termios syscall.Termios 21 | ws chan WINSIZE 22 | ss chan os.Signal 23 | } 24 | 25 | func open() (*TTY, error) { 26 | tty := new(TTY) 27 | 28 | in, err := os.Open("/dev/tty") 29 | if err != nil { 30 | return nil, err 31 | } 32 | tty.in = in 33 | tty.bin = bufio.NewReader(in) 34 | 35 | out, err := os.OpenFile("/dev/tty", syscall.O_WRONLY, 0) 36 | if err != nil { 37 | return nil, err 38 | } 39 | tty.out = out 40 | 41 | if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(tty.in.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&tty.termios)), 0, 0, 0); err != 0 { 42 | return nil, err 43 | } 44 | newios := tty.termios 45 | newios.Iflag &^= syscall.ISTRIP | syscall.INLCR | syscall.ICRNL | syscall.IGNCR | syscall.IXON | syscall.IXOFF 46 | newios.Lflag &^= syscall.ECHO | syscall.ICANON /*| syscall.ISIG*/ 47 | if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(tty.in.Fd()), ioctlWriteTermios, uintptr(unsafe.Pointer(&newios)), 0, 0, 0); err != 0 { 48 | return nil, err 49 | } 50 | 51 | tty.ws = make(chan WINSIZE) 52 | tty.ss = make(chan os.Signal, 1) 53 | signal.Notify(tty.ss, syscall.SIGWINCH) 54 | go func() { 55 | for sig := range tty.ss { 56 | switch sig { 57 | case syscall.SIGWINCH: 58 | if w, h, err := tty.size(); err == nil { 59 | tty.ws <- WINSIZE{ 60 | W: w, 61 | H: h, 62 | } 63 | } 64 | default: 65 | } 66 | } 67 | }() 68 | return tty, nil 69 | } 70 | 71 | func (tty *TTY) buffered() bool { 72 | return tty.bin.Buffered() > 0 73 | } 74 | 75 | func (tty *TTY) readRune() (rune, error) { 76 | r, _, err := tty.bin.ReadRune() 77 | return r, err 78 | } 79 | 80 | func (tty *TTY) close() error { 81 | close(tty.ss) 82 | close(tty.ws) 83 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(tty.in.Fd()), ioctlWriteTermios, uintptr(unsafe.Pointer(&tty.termios)), 0, 0, 0) 84 | return err 85 | } 86 | 87 | func (tty *TTY) size() (int, int, error) { 88 | var dim [4]uint16 89 | if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(tty.out.Fd()), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&dim)), 0, 0, 0); err != 0 { 90 | return -1, -1, err 91 | } 92 | return int(dim[1]), int(dim[0]), nil 93 | } 94 | 95 | func (tty *TTY) input() *os.File { 96 | return tty.in 97 | } 98 | 99 | func (tty *TTY) output() *os.File { 100 | return tty.out 101 | } 102 | 103 | func (tty *TTY) raw() (func() error, error) { 104 | termios, err := unix.IoctlGetTermios(int(tty.in.Fd()), ioctlReadTermios) 105 | if err != nil { 106 | return nil, err 107 | } 108 | 109 | termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON 110 | termios.Oflag &^= unix.OPOST 111 | termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN 112 | termios.Cflag &^= unix.CSIZE | unix.PARENB 113 | termios.Cflag |= unix.CS8 114 | termios.Cc[unix.VMIN] = 1 115 | termios.Cc[unix.VTIME] = 0 116 | if err := unix.IoctlSetTermios(int(tty.in.Fd()), ioctlWriteTermios, termios); err != nil { 117 | return nil, err 118 | } 119 | 120 | return func() error { 121 | if err := unix.IoctlSetTermios(int(tty.in.Fd()), ioctlWriteTermios, termios); err != nil { 122 | return err 123 | } 124 | return nil 125 | }, nil 126 | } 127 | 128 | func (tty *TTY) sigwinch() chan WINSIZE { 129 | return tty.ws 130 | } 131 | --------------------------------------------------------------------------------