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
Anders Blomdell
LabComm
Commits
3f2e9cd3
Commit
3f2e9cd3
authored
May 25, 2015
by
Sven Gestegård Robertz
Browse files
First implementation of intention encoding in python
parent
04756989
Changes
3
Hide whitespace changes
Inline
Side-by-side
compiler/2014/Python_CodeGen.jrag
View file @
3f2e9cd3
...
@@ -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) {
...
...
examples/user_types/Makefile
View file @
3f2e9cd3
...
@@ -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
...
...
lib/python/labcomm2014/LabComm.py
View file @
3f2e9cd3
...
@@ -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
):
...
...
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