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

merge from master

parents 0ebaa10d 59729683
......@@ -6,9 +6,9 @@ lib/c/liblabcomm.so.1
lib/c/liblabcomm2006.so.1
lib/c/liblabcomm2006.so
lib/c/liblabcomm2006.a
lib/c/liblabcomm20141009.so.1
lib/c/liblabcomm20141009.so
lib/c/liblabcomm20141009.a
lib/c/liblabcomm2014.so.1
lib/c/liblabcomm2014.so
lib/c/liblabcomm2014.a
lib/c/test/test_labcomm
lib/c/test/test_labcomm_basic_type_encoding
lib/c/test/test_labcomm_copy
......@@ -16,7 +16,7 @@ lib/c/test/test_labcomm_generated_encoding
lib/c/test/test_labcomm_pthread_scheduler
lib/c/test/test_signature_numbers
compiler/AST/
compiler/labComm.jar
compiler/labcomm_compiler.jar
encoded_data
encoded_data06
gen
......
......@@ -77,7 +77,7 @@ classpath="tools/jastadd2.jar"/>
<!-- delete all .class files recursively -->
<delete>
<fileset dir="." includes="**/*.class"/>
<fileset dir="." includes="labComm.jar"/>
<fileset dir="." includes="labcomm_compiler.jar"/>
</delete>
</target>
......
#dummy script to test the on-the-fly compilation
java -jar ../../compiler/labComm.jar --java=gen --javapackage=gen simple.lc
java -jar ../../compiler/labcomm_compiler.jar --java=gen --javapackage=gen simple.lc
javac -cp .:gen:../../lib/java/labcomm.jar gen/*.java
......@@ -9,7 +9,7 @@ javac -cp .:gen:../../lib/java/labcomm.jar test/StaticEncoder.java
javac -cp .:gen:../../lib/java/labcomm.jar test/StaticDecoder.java
# compile dynamic part
javac -cp .:../../compiler/labComm.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test/DynamicPart.java
javac -cp .:../../compiler/labcomm_compiler.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test/DynamicPart.java
javac test/HandlerContext.java
......@@ -17,7 +17,7 @@ javac test/HandlerContext.java
java -cp .:gen:../../lib/java//labcomm.jar test.StaticEncoder encoded_data
# run dynamic part
java -cp .:../../compiler/labComm.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test.DynamicPart simple.lc handlers2.txt encoded_data dynamic_out
java -cp .:../../compiler/labcomm_compiler.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test.DynamicPart simple.lc handlers2.txt encoded_data dynamic_out
# run static decoder
......
#dummy script to test the on-the-fly compilation
java -jar ../../compiler/labComm.jar --java=gen --javapackage=gen simple.lc
java -jar ../../compiler/labcomm_compiler.jar --java=gen --javapackage=gen simple.lc
javac -cp .:gen:../../lib/java/labcomm.jar gen/*.java
......@@ -9,7 +9,7 @@ javac -cp .:gen:../../lib/java/labcomm.jar test/StaticEncoder.java
javac -cp .:gen:../../lib/java/labcomm.jar test/StaticDecoder.java
# compile dynamic part
javac -cp .:../../compiler/labComm.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test/DynamicPart.java
javac -cp .:../../compiler/labcomm_compiler.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test/DynamicPart.java
javac test/HandlerContext.java
......@@ -17,7 +17,7 @@ javac test/HandlerContext.java
java -cp .:gen:../../lib/java//labcomm.jar test.StaticEncoder encoded_data
# run dynamic part
java -cp .:../../compiler/labComm.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test.DynamicPart simple_type.lc handlers_type.txt encoded_data dynamic_out
java -cp .:../../compiler/labcomm_compiler.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test.DynamicPart simple_type.lc handlers_type.txt encoded_data dynamic_out
# run static decoder
......
......@@ -2,7 +2,7 @@
# run labcomm compilation
java -jar ../../compiler/labComm.jar --java=gen --javapackage=gen simple.lc
java -jar ../../compiler/labcomm_compiler.jar --java=gen --javapackage=gen simple.lc
# compile example programs
javac -cp .:gen:../../lib/java/labcomm.jar test/StaticEncoder.java
......
#dummy script to test the on-the-fly compilation
javac -cp .:../../compiler/labComm.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test/TestLabcommGen.java
javac -cp .:../../compiler/labcomm_compiler.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test/TestLabcommGen.java
javac test/HandlerContext.java
java -cp .:../../compiler/labComm.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test.TestLabcommGen simple.lc handlers2.txt encoded_data
java -cp .:../../compiler/labcomm_compiler.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test.TestLabcommGen simple.lc handlers2.txt encoded_data
#dummy script to test the on-the-fly compilation
javac -cp .:../../compiler/labComm.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test/TestLabcommGen.java
javac -cp .:../../compiler/labcomm_compiler.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test/TestLabcommGen.java
javac test/HandlerContext.java
java -cp .:../../compiler/labComm.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test.TestLabcommGen simple_type.lc handlers_type.txt encoded_data
java -cp .:../../compiler/labcomm_compiler.jar:../../lib/java/labcomm.jar:../../lib/tools/beaver.jar:../../lib/tools/beaver-rt.jar:../../lib/tools/jastadd2.jar:../../lib/tools/JFlex.jar:../../lib/tools/proj.jar test.TestLabcommGen simple_type.lc handlers_type.txt encoded_data
LCDIR=../..
LCC=java -jar ${LCDIR}/compiler/labcomm_compiler.jar
LABCOMM_JAR=../../compiler/labcomm_compiler.jar
LABCOMM=java -jar $(LABCOMM_JAR)
CLASSPATH=.:${LCDIR}/lib/java/labcomm.jar
JAVA_PKG=labcommTCPtest
SAMPLENAME=foo
......@@ -11,7 +12,7 @@ TLCFILE=turtle1
TAUX=turtle_enc.c turtle_dec.c
${JAVA_PKG}/gen/foo.java: ${LCFILE}.lc
${LCC} --javapackage=${JAVA_PKG}.gen --java=${JAVA_PKG}/gen $<
${LABCOMM} --javapackage=${JAVA_PKG}.gen --java=${JAVA_PKG}/gen $<
${JAVA_PKG}/gen/${SAMPLENAME}.class: ${JAVA_PKG}/gen/${SAMPLENAME}.java
javac -cp ${CLASSPATH} $<
......@@ -37,14 +38,14 @@ client: client.c ${LCFILE}.c ${AUX} ${AUX:.c=.h}
testserver: testserver.c ${LCFILE}.c ${AUX} ${AUX:.c=.h}
${CC} -o $@ testserver.c ${AUX} ${LCFILE}.c -I${LCLIBDIR} -L${LCLIBDIR} -llabcomm
turtleclient: turtleclient.c ${TLCFILE}.c ${TAUX} ${TAUX:.c=.h}
${CC} -o $@ turtleclient.c ${TAUX} ${TLCFILE}.c -I${LCLIBDIR} -L${LCLIBDIR} -llabcomm
${LCFILE}.c : ${LCFILE}.lc
${LCC} -C ${LCFILE}.lc
${LABCOMM} -C ${LCFILE}.lc
${TLCFILE}.c : ${TLCFILE}.lc
${LCC} -C ${TLCFILE}.lc
${LABCOMM} -C ${TLCFILE}.lc
all: client testserver ${JAVA_PKG}/server/TestServer.class ${JAVA_PKG}/client/TestClient.class turtleclient
......
......@@ -7,15 +7,15 @@
mkdir -p gen
java -jar ../../compiler/labcomm_compiler.jar --java=gen --c=gen/simple.c --h=gen/simple.h --python=gen/simple.py simple.lc
javac -cp ../../lib/java/labcomm20141009.jar:. gen/*.java Encoder.java Decoder.java
javac -cp ../../lib/java/labcomm2014.jar:. gen/*.java Encoder.java Decoder.java
gcc -Wall -Werror -Wno-unused-function \
-I. -I../../lib/c -L../../lib/c \
-o example_encoder example_encoder.c gen/simple.c \
-llabcomm20141009 -Tlabcomm.linkscript
-llabcomm2014 -Tlabcomm.linkscript
gcc -Wall -Werror -I . -I ../../lib/c -L../../lib/c \
-o example_decoder example_decoder.c gen/simple.c \
-llabcomm20141009 -Tlabcomm.linkscript
-llabcomm2014 -Tlabcomm.linkscript
# For version 2006
......
......@@ -5,7 +5,7 @@ import sys
import simple
if __name__ == '__main__':
version = sys.argv[2] if len(sys.argv) == 3 else "LabComm20141009"
version = sys.argv[2] if len(sys.argv) == 3 else "LabComm2014"
encoder = labcomm.Encoder(labcomm.StreamWriter(open(sys.argv[1], 'w')), version)
encoder.add_decl(simple.theTwoInts.signature)
encoder.add_decl(simple.IntString.signature)
......
......@@ -5,17 +5,17 @@ echo "*** Running example for version 2013 ***"
echo "********************************************"
echo
java -cp .:../../lib/java/labcomm20141009.jar:gen Encoder encoded_data
java -cp .:../../lib/java/labcomm2014.jar:gen Encoder encoded_data
./example_decoder encoded_data
PYTHONPATH=../../lib/python:gen ./example_encoder.py encoded_data
java -cp .:../../lib/java/labcomm20141009.jar:gen Decoder encoded_data
java -cp .:../../lib/java/labcomm2014.jar:gen Decoder encoded_data
./example_encoder encoded_data
java -cp .:../../lib/java/labcomm20141009.jar:gen Decoder encoded_data
java -cp .:../../lib/java/labcomm2014.jar:gen Decoder encoded_data
echo "running python decoder (from wiki_example):"
PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm20141009
PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm2014
echo
echo "*******************************************************"
......
LCDIR=../..
LCCJAR=${LCDIR}/compiler/labcomm_compiler.jar # the LabComm compiler
LABCOMM_JAR=../../compiler/labcomm_compiler.jar
LABCOMM=java -jar $(LABCOMM_JAR)
LCLJAR=${LCDIR}/lib/java/labcomm.jar # the LabComm library
JAVA_PKG=labcommTCPtest
......@@ -14,17 +15,16 @@ run : ${JAVA_PKG}/Example.class ${JAVA_PKG}/server/TestServer.class ${JAVA_PKG}/
### dependencies and parts ####################
###############################################
LCC=java -jar ${LCCJAR}
CLASSPATH=.:${LCLJAR}
${LCCJAR} :
${LABCOMM_JAR} :
cd ${LCDIR} && make make-compiler
${LCLJAR} :
cd ${LCDIR}/lib/java && make labcomm.jar
${JAVA_PKG}/gen/FooSample.java: test.lc ${LCCJAR}
${LCC} --javapackage=${JAVA_PKG}.gen --java=${JAVA_PKG}/gen $<
${LABCOMM} --javapackage=${JAVA_PKG}.gen --java=${JAVA_PKG}/gen $<
${JAVA_PKG}/gen/FooSample.class: ${JAVA_PKG}/gen/FooSample.java test.lc ${LCLJAR}
javac -cp ${CLASSPATH} $<
......
......@@ -49,11 +49,11 @@ build :
${CC} ${CFLAGS} ${LDFLAGS} -Wall -Werror -Wno-unused-function \
-I. -I${LCDIR}/lib/c -L${LCDIR}/lib/c \
-o example_encoder example_encoder.c ${GENDIR}/test.c \
-llabcomm20141009
-llabcomm2014
${CC} ${CFLAGS} ${LDFLAGS} -Wall -Werror -I . -I ${LCDIR}/lib/c -L${LCDIR}/lib/c \
-o example_decoder example_decoder.c ${GENDIR}/test.c \
-llabcomm20141009
-llabcomm2014
buildcs: Encoder.exe Decoder.exe
......@@ -74,7 +74,7 @@ run:
@./example_decoder encoded_data_j
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_j LabComm20141009
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_j LabComm2014
@echo "************ running C encoder: *****************"
@./example_encoder encoded_data_c
......@@ -86,10 +86,10 @@ run:
@./example_decoder encoded_data_c
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_c LabComm20141009
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_c LabComm2014
@echo "************ running python encoder: *****************"
@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm20141009
@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_p
......@@ -98,7 +98,7 @@ run:
@./example_decoder encoded_data_p
@echo "************ running python decoder (from wiki_example):"
PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm20141009
PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014
runwcs: Encoder.exe Decoder.exe
export LD_LIBRARY_PATH=${LCDIR}/lib/c/
......@@ -132,13 +132,13 @@ runwcs: Encoder.exe Decoder.exe
@./example_decoder encoded_data_c
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_c LabComm20141009
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_c LabComm2014
@echo "************ running C# decoder: *****************"
@./Decoder.exe encoded_data_c
@echo "************ running python encoder: *****************"
@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm20141009
@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_p
......@@ -147,7 +147,7 @@ runwcs: Encoder.exe Decoder.exe
@./example_decoder encoded_data_p
@echo "************ running python decoder (from wiki_example):"
PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm20141009
PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014
@echo "************ running C# decoder: *****************"
@./Decoder.exe encoded_data_p
......@@ -162,7 +162,7 @@ runwcs: Encoder.exe Decoder.exe
@./example_decoder encoded_data_cs
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_cs LabComm20141009
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_cs LabComm2014
@echo "************ running C# decoder: *****************"
@./Decoder.exe encoded_data_cs
......
......@@ -5,7 +5,7 @@ import sys
import test
if __name__ == '__main__':
version = sys.argv[2] if len(sys.argv) == 3 else "LabComm20141009"
version = sys.argv[2] if len(sys.argv) == 3 else "LabComm2014"
encoder = labcomm.Encoder(labcomm.StreamWriter(open(sys.argv[1], 'w')), version)
encoder.add_decl(test.twoLines.signature)
tl = dict(
......
......@@ -4,7 +4,7 @@ import labcomm
import sys
if __name__ == "__main__":
version = sys.argv[2] if len(sys.argv) == 3 else "LabComm20141009"
version = sys.argv[2] if len(sys.argv) == 3 else "LabComm2014"
d = labcomm.Decoder(labcomm.StreamReader(open(sys.argv[1])), version)
while True:
......
#!/bin/sh
# Auto generate code from .lc file
java -jar ../../compiler/labComm.jar \
java -jar ../../compiler/labcomm_compiler.jar \
--c=example.c --h=example.h \
--java=. \
--cs=example.cs \
......
......@@ -34,7 +34,7 @@ or
$ VAR Encoder e;
$ Init_Encoder e, st;
This will read/write the version of LabComm to ensure compatibility, current
version is "LabComm20141009".
version is "LabComm2014".
# Initiate the labcomm samples:
LabComm trusts the application to manage each sample. It requests the samples,
......
## Macros
include os_compat.mk
ALL_DEPS=liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1 liblabcomm20141009.a liblabcomm20141009.so.1
ALL_DEPS=liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1 liblabcomm2014.a liblabcomm2014.so.1
# TODO: Support for Codesourcery ARM toolchain.
......@@ -66,10 +66,10 @@ liblabcomm.a: $(OBJS) $(OBJS2006)
liblabcomm.so.1: $(OBJS:%.o=%.pic.o) $(OBJS2006:%.o=%.pic.o)
$(call MAKESHARED,$@,$@,$^)
liblabcomm20141009.a: $(OBJS)
liblabcomm2014.a: $(OBJS)
ar -r $@ $^
liblabcomm20141009.so.1: $(OBJS:%.o=%.pic.o)
liblabcomm2014.so.1: $(OBJS:%.o=%.pic.o)
$(call MAKESHARED,$@,$@,$^)
liblabcomm2006.a: $(OBJS2006)
......@@ -149,8 +149,8 @@ distclean: clean
$(RM) liblabcomm.a
$(RM) liblabcomm2006.so.1
$(RM) liblabcomm2006.a
$(RM) liblabcomm20141009.so.1
$(RM) liblabcomm20141009.a
$(RM) liblabcomm2014.so.1
$(RM) liblabcomm2014.a
# Extra dependencies
$(TEST_DIR)/test_labcomm_basic_type_encoding.o: labcomm_private.h
......
......@@ -37,7 +37,7 @@
#include "labcomm_ioctl.h"
#include "labcomm_dynamic_buffer_writer.h"
#define CURRENT_VERSION "LabComm20141009"
#define CURRENT_VERSION "LabComm2014"
/* Unwrapping reader/writer functions */
#define UNWRAP_ac(rw, ac, ...) ac
......
......@@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define CURRENT_VERSION "LabComm20141009"
#define CURRENT_VERSION "LabComm2014"
#include <errno.h>
#include "labcomm.h"
......
......@@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define CURRENT_VERSION "LabComm20141009"
#define CURRENT_VERSION "LabComm2014"
#include <errno.h>
#include "labcomm.h"
......
......@@ -2,7 +2,7 @@ namespace se.lth.control.labcomm {
public class Constant {
public const string CURRENT_VERSION = "LabComm20141009";
public const string CURRENT_VERSION = "LabComm2014";
/*
* Allowed packet tags
......
......@@ -14,13 +14,13 @@ MODULES=Constant \
Writer \
WriterWrapper
all: labcomm.jar labcomm20141009.jar labcomm2006.jar
all: labcomm.jar labcomm2014.jar labcomm2006.jar
labcomm.jar: gen/JAVAC
echo $@
cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class se/lth/control/labcomm2006/*.class
labcomm20141009.jar: gen/JAVAC
labcomm2014.jar: gen/JAVAC
echo $@
cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class
......@@ -39,5 +39,5 @@ gen/JAVAC: $(MODULES:%=se/lth/control/labcomm/%.java) $(MODULES:%=se/lth/control
.PHONY: clean
clean:
rm -rf labcomm.jar labcomm2006.jar labcomm20141009.jar gen
rm -rf labcomm.jar labcomm2006.jar labcomm2014.jar gen
......@@ -2,7 +2,7 @@ package se.lth.control.labcomm;
public class Constant {
public static final String CURRENT_VERSION = "LabComm20141009";
public static final String CURRENT_VERSION = "LabComm2014";
/*
* Allowed packet tags
......
......@@ -134,7 +134,7 @@ public class DecoderChannel implements Decoder {
}
/**
method for API harmonization with labcomm20141009.
method for API harmonization with labcomm2014.
Labcomm2006 encodes lengths etc as 32 bit ints.
*/
public int decodePacked32() throws IOException {
......
......@@ -81,7 +81,7 @@ public class EncoderChannel implements Encoder {
}
/**
method for API harmonization with labcomm20141009.
method for API harmonization with labcomm2014.
Labcomm2006 encodes lengths etc as 32 bit ints.
*/
public void encodePacked32(long value) throws IOException {
......
#!/usr/bin/python
#
# LabComm20141009 packet has the following layout
# LabComm2014 packet has the following layout
#
# +----+----+----+----+
# | id (packed32)
......@@ -11,7 +11,7 @@
# | ...
# +----+--
#
# LabComm220141009 SAMPLE_DEF:
# LabComm2014 SAMPLE:
#
# +----+----+----+----+
# | id = 0x02 (packed32)
......@@ -29,7 +29,7 @@
# | ...
# +----+--
#
# LabComm220141009 TYPE_DEF: (as SAMPLE_DEF, but signatures are hierarchical,
# LabComm2014 TYPE_DEF: (as SAMPLE_DEF, but signatures are hierarchical,
# i.e., may contain references to other types
#
# +----+----+----+----+
......@@ -48,7 +48,7 @@
# | ...
# +----+--
#
# LabComm220141009 TYPE_BINDING
# LabComm2014 TYPE_BINDING
#
# +----+----+----+----+
# | id = 0x04 (packed32)
......@@ -60,7 +60,7 @@
# | type number (packed32)
# +----+----+----+----+
#
# LabComm20141009 User data:
# LabComm2014 User data:
#
# +----+----+----+----+
# | id >= 0x00000040 (packed32)
......@@ -151,7 +151,7 @@
import types
import struct as packer
DEFAULT_VERSION = "LabComm20141009"
DEFAULT_VERSION = "LabComm2014"
# Allowed packet tags
i_VERSION = 0x01
......@@ -177,7 +177,7 @@ i_STRING = 0x27
# Version testing
def usePacketLength(version):
return version in [ None, "LabComm20141009" ]
return version in [ None, "LabComm2014" ]
class length_encoder:
def __init__(self, encoder):
......@@ -619,7 +619,7 @@ class Encoder(Codec):
super(Encoder, self).__init__()
self.writer = writer
self.version = version
if self.version in [ "LabComm20141009" ]:
if self.version in [ "LabComm2014" ]:
self.encode_type(i_VERSION)
with length_encoder(self) as e:
e.encode_string(version)
......@@ -654,7 +654,7 @@ class Encoder(Codec):
decl.encode_decl(self)
def encode_packed32(self, v):
if self.version in [ None, "LabComm20141009" ]:
if self.version in [ None, "LabComm2014" ]:
v = v & 0xffffffff
tmp = [ v & 0x7f ]
v = v >> 7
......@@ -771,7 +771,7 @@ class Decoder(Codec):
return result
def decode_packed32(self):
if self.version in [ "LabComm2013", "LabComm20141009" ] :
if self.version in [ "LabComm2013", "LabComm2014" ] :
result = 0
while True:
tmp = self.decode_byte()
......
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