Commit 0ba3696b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 74e9e143
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment