Coder Social home page Coder Social logo

Comments (12)

haifenghuang avatar haifenghuang commented on September 4, 2024

Except Windows, which platform did you compile the magpie source?

If you compile it using linux, then maybe you should change the run.sh file.

    14  echo "Building REPL...(magpie)"
    15  go build -o magpie main.go

to

    14  echo "Building REPL...(magpie)"
    15  GOOS=linux go build -o magpie main.go

from magpie.

 avatar commented on September 4, 2024

@haifenghuang

My OS:

GOOS=darwin
GOARCH=amd64

go env:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/tomdean/Library/Caches/go-build"
GOENV="/Users/tomdean/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/tomdean/magpie"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches -fno-common"

OS: macOS 10.13.6
Platform: amd64
Golang: go version go1.14.3 darwin/amd64

Previos versions of magpie compiled suceessfully, but after last commit, compilation failed.

from magpie.

haifenghuang avatar haifenghuang commented on September 4, 2024

Then, you should change run.sh as below:

 14  echo "Building REPL...(magpie)"
 15  GOOS=darwin go build -o magpie main.go

from magpie.

haifenghuang avatar haifenghuang commented on September 4, 2024

I know the problem, tomorrow I'll commit a new version and fix the problem.

If you need to use it now, You can add below methods to input_darwin.go and input_linux.go

func isInwinConsole() bool {
	return false
}

func getConsoleTextAttr() int16 {
	return 0
}

func setConsoleTextAttr(attr uint16) (n int, err error) {
	return 0, nil
}

My home machine's OS is windows, so I cannot test it. Tomorrow, I'll check it at my office.

from magpie.

 avatar commented on September 4, 2024

Then, you should change run.sh as below:

 14  echo "Building REPL...(magpie)"
 15  GOOS=darwin go build -o magpie main.go

@haifenghuang Same error.

from magpie.

 avatar commented on September 4, 2024

I know the problem, tomorrow I'll commit a new version and fix the problem.

@haifenghuang Ok.

from magpie.

 avatar commented on September 4, 2024

I know the problem, tomorrow I'll commit a new version and fix the problem.

If you need to use it now, You can add below methods to input_darwin.go and input_linux.go

func isInwinConsole() bool {
	return false
}

func getConsoleTextAttr() int16 {
	return 0
}

func setConsoleTextAttr(attr uint16) (n int, err error) {
	return 0, nil
}

My home machine's OS is windows, so I cannot test it. Tomorrow, I'll check it at my office.

@haifenghuang

After adding this piece of code I got the following error:

Building REPL...(magpie)
# magpie/repl
src/magpie/repl/repl.go:75:16: l.IsInwinConsole undefined (type *liner.State has no field or method IsInwinConsole)

from magpie.

 avatar commented on September 4, 2024

@haifenghuang

I understood, also you should to add:

func (s *State) IsInwinConsole() bool {
	return isInwinConsole()
}

this is shortcut for isInwinConsole()

Now everything compiled, but highlighting does not works on Linux/Darwin:

base

from magpie.

haifenghuang avatar haifenghuang commented on September 4, 2024

Hi, I made a mistake. Just change source from:

	if h.isWinConsole {
		colorsMap = map[Color]string{
			COLOR_BLACK:   "\x1b[30m",
			COLOR_BLUE:    "\x1b[34m",
			COLOR_GREEN:   "\x1b[32m",
			COLOR_CYAN:    "\x1b[36m",
			COLOR_RED:     "\x1b[31m",
			COLOR_MAGENTA: "\x1b[35m",
			COLOR_YELLOW:  "\x1b[33m",
			COLOR_WHITE:   "\x1b[37m",
		}
		h.textAttr = getConsoleTextAttr()
	}

to

	if h.isWinConsole {
		h.textAttr = getConsoleTextAttr()
	} else {
		colorsMap = map[Color]string{
			COLOR_BLACK:   "\x1b[30m",
			COLOR_BLUE:    "\x1b[34m",
			COLOR_GREEN:   "\x1b[32m",
			COLOR_CYAN:    "\x1b[36m",
			COLOR_RED:     "\x1b[31m",
			COLOR_MAGENTA: "\x1b[35m",
			COLOR_YELLOW:  "\x1b[33m",
			COLOR_WHITE:   "\x1b[37m",
		}
	}

from magpie.

haifenghuang avatar haifenghuang commented on September 4, 2024

As for

func (s *State) IsInwinConsole() bool {
	return isInwinConsole()
}

Since we added isInwinConsole, getConsoleTextAttr and setConsoleTextAttr to input_darwin.go and input_linux.go, so I think we should remove above code from input_windows.go and add it to line.go.

from magpie.

haifenghuang avatar haifenghuang commented on September 4, 2024

Hi, I just committed a new version, and tested on windows, Linux and Ubuntu, now it works fine for these platforms.

from magpie.

 avatar commented on September 4, 2024

@haifenghuang Everything works on macOS too.

from magpie.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.