Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
abdf5e76
Commit
abdf5e76
authored
Oct 17, 2014
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #138 from erezwanderman/fixwindows
Fix ethereum compilation and functioning on Windows.
parents
03fd832e
7227552f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
5 deletions
+141
-5
console_colors_windows.go
ethereum/repl/console_colors_windows.go
+80
-0
repl_darwin.go
ethereum/repl/repl_darwin.go
+4
-1
repl_windows.go
ethereum/repl/repl_windows.go
+54
-3
js_lib.go
javascript/js_lib.go
+3
-1
No files found.
ethereum/repl/console_colors_windows.go
0 → 100644
View file @
abdf5e76
/* Inspired by https://github.com/xuyu/logging/blob/master/colorful_win.go */
package
ethrepl
import
(
"syscall"
"unsafe"
)
type
color
uint16
const
(
green
=
color
(
0x0002
)
red
=
color
(
0x0004
)
yellow
=
color
(
0x000E
)
)
const
(
mask
=
uint16
(
yellow
|
green
|
red
)
)
var
(
kernel32
=
syscall
.
NewLazyDLL
(
"kernel32.dll"
)
procGetStdHandle
=
kernel32
.
NewProc
(
"GetStdHandle"
)
procSetConsoleTextAttribute
=
kernel32
.
NewProc
(
"SetConsoleTextAttribute"
)
procGetConsoleScreenBufferInfo
=
kernel32
.
NewProc
(
"GetConsoleScreenBufferInfo"
)
hStdout
uintptr
initScreenInfo
*
consoleScreenBufferInfo
)
func
setConsoleTextAttribute
(
hConsoleOutput
uintptr
,
wAttributes
uint16
)
bool
{
ret
,
_
,
_
:=
procSetConsoleTextAttribute
.
Call
(
hConsoleOutput
,
uintptr
(
wAttributes
))
return
ret
!=
0
}
type
coord
struct
{
X
,
Y
int16
}
type
smallRect
struct
{
Left
,
Top
,
Right
,
Bottom
int16
}
type
consoleScreenBufferInfo
struct
{
DwSize
coord
DwCursorPosition
coord
WAttributes
uint16
SrWindow
smallRect
DwMaximumWindowSize
coord
}
func
getConsoleScreenBufferInfo
(
hConsoleOutput
uintptr
)
*
consoleScreenBufferInfo
{
var
csbi
consoleScreenBufferInfo
ret
,
_
,
_
:=
procGetConsoleScreenBufferInfo
.
Call
(
hConsoleOutput
,
uintptr
(
unsafe
.
Pointer
(
&
csbi
)))
if
ret
==
0
{
return
nil
}
return
&
csbi
}
const
(
stdOutputHandle
=
uint32
(
-
11
&
0xFFFFFFFF
)
)
func
init
()
{
hStdout
,
_
,
_
=
procGetStdHandle
.
Call
(
uintptr
(
stdOutputHandle
))
initScreenInfo
=
getConsoleScreenBufferInfo
(
hStdout
)
}
func
resetColorful
()
{
if
initScreenInfo
==
nil
{
return
}
setConsoleTextAttribute
(
hStdout
,
initScreenInfo
.
WAttributes
)
}
func
changeColor
(
c
color
)
{
attr
:=
uint16
(
0
)
&
^
mask
|
uint16
(
c
)
setConsoleTextAttribute
(
hStdout
,
attr
)
}
ethereum/repl/repl_darwin.go
View file @
abdf5e76
...
@@ -118,6 +118,9 @@ func (self *JSRepl) PrintValue(v interface{}) {
...
@@ -118,6 +118,9 @@ func (self *JSRepl) PrintValue(v interface{}) {
method
,
_
:=
self
.
re
.
Vm
.
Get
(
"prettyPrint"
)
method
,
_
:=
self
.
re
.
Vm
.
Get
(
"prettyPrint"
)
v
,
err
:=
self
.
re
.
Vm
.
ToValue
(
v
)
v
,
err
:=
self
.
re
.
Vm
.
ToValue
(
v
)
if
err
==
nil
{
if
err
==
nil
{
method
.
Call
(
method
,
v
)
val
,
err
:=
method
.
Call
(
method
,
v
)
if
err
==
nil
{
fmt
.
Printf
(
"%v"
,
val
)
}
}
}
}
}
ethereum/repl/repl_windows.go
View file @
abdf5e76
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"bufio"
"bufio"
"fmt"
"fmt"
"os"
"os"
"strings"
)
)
func
(
self
*
JSRepl
)
read
()
{
func
(
self
*
JSRepl
)
read
()
{
...
@@ -14,11 +15,61 @@ func (self *JSRepl) read() {
...
@@ -14,11 +15,61 @@ func (self *JSRepl) read() {
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"Error reading input"
,
err
)
fmt
.
Println
(
"Error reading input"
,
err
)
}
else
{
}
else
{
self
.
parseInput
(
string
(
str
))
if
(
string
(
str
)
==
"exit"
)
{
self
.
Stop
()
break
}
else
{
self
.
parseInput
(
string
(
str
))
}
}
}
}
}
}
}
func
(
self
*
JSRepl
)
PrintValue
(
value
otto
.
Value
)
{
func
addHistory
(
s
string
)
{
fmt
.
Println
(
value
)
}
func
printColored
(
outputVal
string
)
{
for
;
outputVal
!=
""
;
{
codePart
:=
""
if
(
strings
.
HasPrefix
(
outputVal
,
"
\0
33[32m"
))
{
codePart
=
"
\0
33[32m"
changeColor
(
2
)
}
if
(
strings
.
HasPrefix
(
outputVal
,
"
\0
33[1m
\0
33[30m"
))
{
codePart
=
"
\0
33[1m
\0
33[30m"
changeColor
(
8
)
}
if
(
strings
.
HasPrefix
(
outputVal
,
"
\0
33[31m"
))
{
codePart
=
"
\0
33[31m"
changeColor
(
red
)
}
if
(
strings
.
HasPrefix
(
outputVal
,
"
\0
33[35m"
))
{
codePart
=
"
\0
33[35m"
changeColor
(
5
)
}
if
(
strings
.
HasPrefix
(
outputVal
,
"
\0
33[0m"
))
{
codePart
=
"
\0
33[0m"
resetColorful
()
}
textPart
:=
outputVal
[
len
(
codePart
)
:
len
(
outputVal
)]
index
:=
strings
.
Index
(
textPart
,
"
\0
33"
)
if
index
==
-
1
{
outputVal
=
""
}
else
{
outputVal
=
textPart
[
index
:
len
(
textPart
)]
textPart
=
textPart
[
0
:
index
]
}
fmt
.
Printf
(
"%v"
,
textPart
)
}
}
func
(
self
*
JSRepl
)
PrintValue
(
v
interface
{})
{
method
,
_
:=
self
.
re
.
Vm
.
Get
(
"prettyPrint"
)
v
,
err
:=
self
.
re
.
Vm
.
ToValue
(
v
)
if
err
==
nil
{
val
,
err
:=
method
.
Call
(
method
,
v
)
if
err
==
nil
{
printColored
(
fmt
.
Sprintf
(
"%v"
,
val
))
}
}
}
}
javascript/js_lib.go
View file @
abdf5e76
...
@@ -44,9 +44,11 @@ function pp(object) {
...
@@ -44,9 +44,11 @@ function pp(object) {
function prettyPrint(/* */) {
function prettyPrint(/* */) {
var args = arguments;
var args = arguments;
var ret = "";
for(var i = 0, l = args.length; i < l; i++) {
for(var i = 0, l = args.length; i < l; i++) {
console.log(pp(args[i]))
ret += pp(args[i]) + "\n";
}
}
return ret;
}
}
var print = prettyPrint;
var print = prettyPrint;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment