Commit a6eda524 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

fixed python encoding example for multiple labcomm versions

parent 50540219
...@@ -5,7 +5,8 @@ import sys ...@@ -5,7 +5,8 @@ import sys
import simple import simple
if __name__ == '__main__': if __name__ == '__main__':
encoder = labcomm.Encoder(labcomm.StreamWriter(open(sys.argv[1], 'w'))) version = sys.argv[2] if len(sys.argv) == 3 else "LabComm2013"
encoder = labcomm.Encoder(labcomm.StreamWriter(open(sys.argv[1], 'w')), version)
encoder.add_decl(simple.theTwoInts.signature) encoder.add_decl(simple.theTwoInts.signature)
encoder.add_decl(simple.IntString.signature) encoder.add_decl(simple.IntString.signature)
foo = simple.theTwoInts() foo = simple.theTwoInts()
......
...@@ -25,6 +25,10 @@ echo ...@@ -25,6 +25,10 @@ echo
java -cp .:../../lib/java:gen06 Encoder06 encoded_data06 java -cp .:../../lib/java:gen06 Encoder06 encoded_data06
./example_decoder06 encoded_data06 ./example_decoder06 encoded_data06
PYTHONPATH=../../lib/python:gen ./example_encoder.py encoded_data06 LabComm2006
java -cp .:../../lib/java:gen06 Decoder06 encoded_data06
./example_encoder06 encoded_data06 ./example_encoder06 encoded_data06
java -cp .:../../lib/java:gen06 Decoder06 encoded_data06 java -cp .:../../lib/java:gen06 Decoder06 encoded_data06
......
...@@ -556,7 +556,7 @@ class Encoder(Codec): ...@@ -556,7 +556,7 @@ class Encoder(Codec):
def __init__(self, writer, version="LabComm2013"): def __init__(self, writer, version="LabComm2013"):
super(Encoder, self).__init__() super(Encoder, self).__init__()
self.writer = writer self.writer = writer
self.versoin = version self.version = version
self.writer.start(self, self.version) self.writer.start(self, self.version)
def pack(self, format, *args): def pack(self, format, *args):
......
Supports Markdown
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