Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
5ed8dbde
Commit
5ed8dbde
authored
Sep 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
74948883
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
113 deletions
+118
-113
go/neo/protogen.go
go/neo/protogen.go
+15
-10
go/neo/zproto-marshal.go
go/neo/zproto-marshal.go
+103
-103
No files found.
go/neo/protogen.go
View file @
5ed8dbde
...
@@ -219,10 +219,13 @@ func (c MsgCode) String() string {
...
@@ -219,10 +219,13 @@ func (c MsgCode) String() string {
return
s
return
s
}
}
// sort MsgCode by
serial
// sort MsgCode by
(serial, answer)
type
BySerial
[]
MsgCode
type
BySerial
[]
MsgCode
func
(
v
BySerial
)
Less
(
i
,
j
int
)
bool
{
return
v
[
i
]
.
msgSerial
<
v
[
j
]
.
msgSerial
}
func
(
v
BySerial
)
Less
(
i
,
j
int
)
bool
{
return
(
v
[
i
]
.
msgSerial
<
v
[
j
]
.
msgSerial
)
||
(
v
[
i
]
.
msgSerial
==
v
[
j
]
.
msgSerial
&&
!
v
[
i
]
.
answer
&&
v
[
j
]
.
answer
)
}
func
(
v
BySerial
)
Swap
(
i
,
j
int
)
{
v
[
i
],
v
[
j
]
=
v
[
j
],
v
[
i
]
}
func
(
v
BySerial
)
Swap
(
i
,
j
int
)
{
v
[
i
],
v
[
j
]
=
v
[
j
],
v
[
i
]
}
func
(
v
BySerial
)
Len
()
int
{
return
len
(
v
)
}
func
(
v
BySerial
)
Len
()
int
{
return
len
(
v
)
}
...
@@ -293,16 +296,18 @@ import (
...
@@ -293,16 +296,18 @@ import (
}
}
// generate code for this type to implement neo.Msg
// generate code for this type to implement neo.Msg
msgCode
:=
MsgCode
{
var
msgCode
MsgCode
msgSerial
:
msgSerial
,
msgCode
.
answer
=
specAnnotation
.
answer
||
strings
.
HasPrefix
(
typename
,
"Answer"
)
answer
:
specAnnotation
.
answer
||
strings
.
HasPrefix
(
typename
,
"Answer"
),
switch
{
case
!
msgCode
.
answer
||
typename
==
"Error"
:
msgCode
.
msgSerial
=
msgSerial
// answer to something
default
:
msgCode
.
msgSerial
=
msgSerial
-
1
}
}
fmt
.
Fprintf
(
&
buf
,
"// %d. %s"
,
msgSerial
,
typename
)
fmt
.
Fprintf
(
&
buf
,
"// %s. %s
\n\n
"
,
msgCode
,
typename
)
if
msgCode
.
answer
{
fmt
.
Fprintf
(
&
buf
,
" (answer)"
)
}
fmt
.
Fprintf
(
&
buf
,
"
\n\n
"
)
buf
.
emit
(
"func (*%s) neoMsgCode() uint16 {"
,
typename
)
buf
.
emit
(
"func (*%s) neoMsgCode() uint16 {"
,
typename
)
buf
.
emit
(
"return %s"
,
msgCode
)
buf
.
emit
(
"return %s"
,
msgCode
)
...
...
go/neo/zproto-marshal.go
View file @
5ed8dbde
This diff is collapsed.
Click to expand it.
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