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
0ba3696b
Commit
0ba3696b
authored
Jan 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
74e9e143
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
go/neo/proto/protogen.go
go/neo/proto/protogen.go
+9
-7
No files found.
go/neo/proto/protogen.go
View file @
0ba3696b
...
@@ -23,13 +23,14 @@
...
@@ -23,13 +23,14 @@
NEO. Protocol module. Code generator
NEO. Protocol module. Code generator
This program generates marshalling code for message types defined in proto.go .
This program generates marshalling code for message types defined in proto.go .
For every type
4
methods are generated in accordance with neo.Msg interface:
For every type
the following
methods are generated in accordance with neo.Msg interface:
// XXX update for 'N' and 'M'
neoMsgCode() uint16
neoMsgCode() uint16
neoMsgEncodedLenN() int
neoMsgEncodeN(buf []byte)
; E stands for 'N' and 'M' encodings
neoMsgDecodeN(data []byte) (nread int, err error)
neoMsgEncodedLen<E>() int
neoMsgEncode<E>(buf []byte)
neoMsgDecode<E>(data []byte) (nread int, err error)
List of message types is obtained via searching through proto.go AST - looking
List of message types is obtained via searching through proto.go AST - looking
for appropriate struct declarations there.
for appropriate struct declarations there.
...
@@ -40,8 +41,9 @@ maps, ...).
...
@@ -40,8 +41,9 @@ maps, ...).
Top-level generation driver is in generateCodecCode(). It accepts type
Top-level generation driver is in generateCodecCode(). It accepts type
specification and something that performs actual leaf-nodes code generation
specification and something that performs actual leaf-nodes code generation
(CodeGenerator interface). There are 3 particular codegenerators implemented -
(CodeGenerator interface). For each encoding there are 3 particular
- sizerN, encoderN & decoder - to generate each of the needed method functions. XXX N/M
codegenerators implemented - sizer<E>, encoder<E> & decoder<E> - to generate
each of the needed method functions.
The structure of whole process is very similar to what would be happening at
The structure of whole process is very similar to what would be happening at
runtime if marshalling was reflect based, but statically with go/types we don't
runtime if marshalling was reflect based, but statically with go/types we don't
...
...
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