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

First implementation of intention encoding in python

parent 04756989
...@@ -151,7 +151,11 @@ aspect PythonTypes { ...@@ -151,7 +151,11 @@ aspect PythonTypes {
} }
public void TypeInstance.Python_genIntentions(Python_env env) { public void TypeInstance.Python_genIntentions(Python_env env) {
env.print("{'':'"+getName()+"'}"); env.print("{'':'"+getName()+"'");
for(Intention i : sortedIntentions()) {
env.print(", '"+i.getKey()+"':'"+new String(i.getValue())+"'");
}
env.print("}");
} }
public void TypeInstance.Python_genTypedef(Python_env env) { public void TypeInstance.Python_genTypedef(Python_env env) {
......
...@@ -96,12 +96,11 @@ run: ...@@ -96,12 +96,11 @@ run:
@echo "************ running python encoder: *****************" @echo "************ running python encoder: *****************"
@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014 @PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014
@echo "WARNING! python encoded data only decoded by python decoder, pending intention implementation" @echo "************ running Java decoder: *****************"
# @echo "************ running Java decoder: *****************" @java -cp .:${LCDIR}/lib/java/labcomm2014.jar:${GENDIR} Decoder encoded_data_p
# @java -cp .:${LCDIR}/lib/java/labcomm2014.jar:${GENDIR} Decoder encoded_data_p
# @echo "************ running C decoder: *****************"
# @echo "************ running C decoder: *****************" @LD_LIBRARY_PATH=${LCDIR}/lib/c/ ./example_decoder encoded_data_p
# @LD_LIBRARY_PATH=${LCDIR}/lib/c/ ./example_decoder encoded_data_p
@echo "************ running python decoder (from wiki_example):" @echo "************ running python decoder (from wiki_example):"
PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014 PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014
...@@ -145,16 +144,15 @@ runwcs: build ExampleEncoder.exe ExampleDecoder.exe ...@@ -145,16 +144,15 @@ runwcs: build ExampleEncoder.exe ExampleDecoder.exe
@echo "************ running python encoder: *****************" @echo "************ running python encoder: *****************"
@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014 @PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014
@echo "WARNING! python encoded data only decoded by python decoder, pending intention implementation" @echo "************ running Java decoder: *****************"
# @echo "************ running Java decoder: *****************" @java -cp .:${LCDIR}/lib/java/labcomm2014.jar:${GENDIR} Decoder encoded_data_p
# @java -cp .:${LCDIR}/lib/java/labcomm2014.jar:${GENDIR} Decoder encoded_data_p
# @echo "************ running C decoder: *****************"
# @echo "************ running C decoder: *****************" @LD_LIBRARY_PATH=${LCDIR}/lib/c/ ./example_decoder encoded_data_p
# @LD_LIBRARY_PATH=${LCDIR}/lib/c/ ./example_decoder encoded_data_p
# @echo "************ running C# decoder: *****************"
# @echo "************ running C# decoder: *****************" @mono ./ExampleDecoder.exe encoded_data_p
# @mono ./ExampleDecoder.exe encoded_data_p
#
@echo "************ running python decoder (from wiki_example):" @echo "************ running python decoder (from wiki_example):"
PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014 PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014
......
...@@ -893,8 +893,9 @@ class Encoder(Codec): ...@@ -893,8 +893,9 @@ class Encoder(Codec):
keys.sort(); keys.sort();
self.encode_packed32(len(intentions)) self.encode_packed32(len(intentions))
for k in keys: for k in keys:
v = intentions[k]
self.encode_string(k) self.encode_string(k)
self.encode_string(intentions[k]) self.encode_string(v)
class Decoder(Codec): class Decoder(Codec):
def __init__(self, reader, version=DEFAULT_VERSION): def __init__(self, reader, version=DEFAULT_VERSION):
......
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