Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sven Gestegård Robertz
LabComm
Commits
bc52d70a
Commit
bc52d70a
authored
Feb 15, 2014
by
Sven Gestegård Robertz
Browse files
added example python encoder
parent
ec845d8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
examples/simple/example_encoder.py
0 → 100755
View file @
bc52d70a
#!/usr/bin/python
import
labcomm
import
sys
import
simple
if
__name__
==
'__main__'
:
encoder
=
labcomm
.
Encoder
(
labcomm
.
StreamWriter
(
open
(
sys
.
argv
[
1
],
'w'
)))
encoder
.
add_decl
(
simple
.
theTwoInts
.
signature
)
encoder
.
add_decl
(
simple
.
IntString
.
signature
)
foo
=
simple
.
theTwoInts
()
foo
.
a
=
13
foo
.
b
=
37
encoder
.
encode
(
foo
,
simple
.
theTwoInts
.
signature
)
bar
=
simple
.
IntString
()
bar
.
x
=
1742
bar
.
s
=
"A string from Python"
encoder
.
encode
(
bar
,
simple
.
IntString
.
signature
)
examples/simple/run.sh
View file @
bc52d70a
...
...
@@ -2,6 +2,10 @@ export LD_LIBRARY_PATH=../../lib/c/
java
-cp
.:../../lib/java:gen Encoder encoded_data
./example_decoder encoded_data
PYTHONPATH
=
../../lib/python:gen ./example_encoder.py encoded_data
java
-cp
.:../../lib/java:gen Decoder encoded_data
./example_encoder encoded_data
java
-cp
.:../../lib/java:gen Decoder encoded_data
...
...
Write
Preview
Supports
Markdown
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