From b35ee46b2f5e7bcdebc32bebf76769a6ad367bfb Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Fri, 10 Oct 2014 15:50:46 +0200
Subject: [PATCH] Bumped version from 2013 to 20141009

---
 .gitignore                                    |  6 +--
 examples/simple/Makefile                      |  1 +
 examples/simple/compile.sh                    |  6 +--
 examples/simple/example_encoder.py            |  2 +-
 examples/simple/run.sh                        |  8 +--
 examples/user_types/Makefile                  |  1 +
 examples/user_types/compile.sh                |  6 +--
 examples/user_types/example_encoder.py        |  2 +-
 examples/user_types/run.sh                    | 12 ++---
 examples/wiki_example/example_decoder.py      |  2 +-
 lib/Makefile                                  |  2 +
 lib/RAPID/README                              |  2 +-
 lib/c/Makefile                                | 10 ++--
 lib/c/labcomm.c                               |  2 +-
 lib/c/labcomm_decoder.c                       |  8 +--
 lib/c/labcomm_encoder.c                       |  2 +-
 lib/csharp/se/lth/control/labcomm/LabComm.cs  |  2 +-
 .../control/labcomm/LabCommDecoderChannel.cs  |  1 -
 lib/java/Makefile                             |  6 +--
 lib/java/se/lth/control/labcomm/LabComm.java  |  2 +-
 .../labcomm/LabCommDecoderChannel.java        |  1 -
 .../labcomm2006/LabCommDecoderChannel.java    |  3 +-
 .../labcomm2006/LabCommEncoderChannel.java    |  2 +-
 lib/python/Makefile                           |  5 ++
 lib/python/labcomm/LabComm.py                 | 50 ++++++++++++++++---
 25 files changed, 92 insertions(+), 52 deletions(-)
 create mode 100644 lib/python/Makefile

diff --git a/.gitignore b/.gitignore
index 336ae92..002536b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,9 +6,9 @@ lib/c/liblabcomm.so.1
 lib/c/liblabcomm2006.so.1
 lib/c/liblabcomm2006.so
 lib/c/liblabcomm2006.a
-lib/c/liblabcomm2013.so.1
-lib/c/liblabcomm2013.so
-lib/c/liblabcomm2013.a
+lib/c/liblabcomm20141009.so.1
+lib/c/liblabcomm20141009.so
+lib/c/liblabcomm20141009.a
 lib/c/test/test_labcomm
 lib/c/test/test_labcomm_basic_type_encoding
 lib/c/test/test_labcomm_copy
diff --git a/examples/simple/Makefile b/examples/simple/Makefile
index b11fc29..e12fb67 100644
--- a/examples/simple/Makefile
+++ b/examples/simple/Makefile
@@ -10,3 +10,4 @@ distclean:
 	rm -f example_encoder06
 	rm -f example_decoder
 	rm -f example_decoder06
+	rm -f encoded_data
diff --git a/examples/simple/compile.sh b/examples/simple/compile.sh
index a5566fc..113f7f2 100644
--- a/examples/simple/compile.sh
+++ b/examples/simple/compile.sh
@@ -7,15 +7,15 @@
 mkdir -p gen
 java -jar ../../compiler/labComm.jar --java=gen --c=gen/simple.c --h=gen/simple.h  --python=gen/simple.py simple.lc 
 
-javac -cp ../../lib/java/labcomm2013.jar:. gen/*.java Encoder.java Decoder.java
+javac -cp ../../lib/java/labcomm20141009.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 \
-    -llabcomm2013 -Tlabcomm.linkscript
+    -llabcomm20141009 -Tlabcomm.linkscript
 gcc -Wall -Werror -I . -I ../../lib/c -L../../lib/c \
     -o example_decoder example_decoder.c gen/simple.c \
-    -llabcomm2013 -Tlabcomm.linkscript
+    -llabcomm20141009 -Tlabcomm.linkscript
 
 # For version 2006
 
diff --git a/examples/simple/example_encoder.py b/examples/simple/example_encoder.py
index 277eb93..fea1dbc 100755
--- a/examples/simple/example_encoder.py
+++ b/examples/simple/example_encoder.py
@@ -5,7 +5,7 @@ import sys
 import simple
 
 if __name__ == '__main__':
-    version = sys.argv[2] if len(sys.argv) == 3 else "LabComm2013"
+    version = sys.argv[2] if len(sys.argv) == 3 else "LabComm20141009"
     encoder = labcomm.Encoder(labcomm.StreamWriter(open(sys.argv[1], 'w')), version)
     encoder.add_decl(simple.theTwoInts.signature)
     encoder.add_decl(simple.IntString.signature)
diff --git a/examples/simple/run.sh b/examples/simple/run.sh
index 192225d..bc9a10a 100644
--- a/examples/simple/run.sh
+++ b/examples/simple/run.sh
@@ -5,17 +5,17 @@ echo "***   Running example for version 2013   ***"
 echo "********************************************"
 echo
 
-java -cp .:../../lib/java/labcomm2013.jar:gen Encoder encoded_data
+java -cp .:../../lib/java/labcomm20141009.jar:gen Encoder encoded_data
 ./example_decoder encoded_data
 
 PYTHONPATH=../../lib/python:gen ./example_encoder.py encoded_data
-java -cp .:../../lib/java/labcomm2013.jar:gen Decoder encoded_data
+java -cp .:../../lib/java/labcomm20141009.jar:gen Decoder encoded_data
 
 ./example_encoder encoded_data
-java -cp .:../../lib/java/labcomm2013.jar:gen Decoder encoded_data
+java -cp .:../../lib/java/labcomm20141009.jar:gen Decoder encoded_data
 
 echo "running python decoder (from wiki_example):"
-PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm2013
+PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm20141009
 
 echo
 echo "*******************************************************"
diff --git a/examples/user_types/Makefile b/examples/user_types/Makefile
index 757301e..4d68ea9 100644
--- a/examples/user_types/Makefile
+++ b/examples/user_types/Makefile
@@ -4,3 +4,4 @@ clean:
 
 distclean:
 	rm -rf gen
+	rm -f encoded_data
diff --git a/examples/user_types/compile.sh b/examples/user_types/compile.sh
index e1029d8..3daee1b 100644
--- a/examples/user_types/compile.sh
+++ b/examples/user_types/compile.sh
@@ -7,16 +7,16 @@
 mkdir -p gen
 java -jar ../../compiler/labComm.jar --java=gen --c=gen/test.c --h=gen/test.h  --python=gen/test.py test.lc 
 
-javac -cp ../../lib/java/labcomm2013.jar:. gen/*.java Encoder.java Decoder.java
+javac -cp ../../lib/java/labcomm20141009.jar:. gen/*.java Encoder.java Decoder.java
 
 # for macOS, add     -DLABCOMM_COMPAT=\"labcomm_compat_osx.h\" \
 gcc -Wall -Werror -Wno-unused-function \
     -I. -I../../lib/c -L../../lib/c \
     -o example_encoder example_encoder.c gen/test.c \
-    -llabcomm2013 
+    -llabcomm20141009 
 
 gcc -Wall -Werror -I . -I ../../lib/c -L../../lib/c \
     -o example_decoder example_decoder.c gen/test.c \
-    -llabcomm2013 
+    -llabcomm20141009 
     #-Tlabcomm.linkscript
 
diff --git a/examples/user_types/example_encoder.py b/examples/user_types/example_encoder.py
index f20d42c..987a2b1 100755
--- a/examples/user_types/example_encoder.py
+++ b/examples/user_types/example_encoder.py
@@ -5,7 +5,7 @@ import sys
 import test
 
 if __name__ == '__main__':
-    version = sys.argv[2] if len(sys.argv) == 3 else "LabComm2013"
+    version = sys.argv[2] if len(sys.argv) == 3 else "LabComm20141009"
     encoder = labcomm.Encoder(labcomm.StreamWriter(open(sys.argv[1], 'w')), version)
     encoder.add_decl(test.twoLines.signature)
     l1 = test.line()
diff --git a/examples/user_types/run.sh b/examples/user_types/run.sh
index 2bdc6ee..1b791ec 100644
--- a/examples/user_types/run.sh
+++ b/examples/user_types/run.sh
@@ -5,34 +5,34 @@ echo "***   Running example for version 2013   ***"
 echo "********************************************"
 echo
 
-java -cp .:../../lib/java/labcomm2013.jar:gen Encoder encoded_data
+java -cp .:../../lib/java/labcomm20141009.jar:gen Encoder encoded_data
 
 echo "running Java  decoder:"
-java -cp .:../../lib/java/labcomm2013.jar:gen Decoder encoded_data
+java -cp .:../../lib/java/labcomm20141009.jar:gen Decoder encoded_data
 
 echo "running C decoder:"
 ./example_decoder encoded_data
 
 echo "running python decoder (from wiki_example):"
-PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm2013
+PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm20141009
 
 echo "running C encoder:"
 ./example_encoder encoded_data
 
 echo "running Java  decoder:"
-java -cp .:../../lib/java/labcomm2013.jar:gen Decoder encoded_data
+java -cp .:../../lib/java/labcomm20141009.jar:gen Decoder encoded_data
 
 echo "running C decoder:"
 ./example_decoder encoded_data
 
 echo "running python decoder (from wiki_example):"
-PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm2013
+PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm20141009
 
 echo "running python encoder:"
 PYTHONPATH=../../lib/python:gen ./example_encoder.py encoded_data2
 
 echo "running Java  decoder:"
-java -cp .:../../lib/java/labcomm2013.jar:gen Decoder encoded_data2
+java -cp .:../../lib/java/labcomm20141009.jar:gen Decoder encoded_data2
 
 echo "running C decoder:"
 ./example_decoder encoded_data2
diff --git a/examples/wiki_example/example_decoder.py b/examples/wiki_example/example_decoder.py
index a725330..6f5813e 100755
--- a/examples/wiki_example/example_decoder.py
+++ b/examples/wiki_example/example_decoder.py
@@ -4,7 +4,7 @@ import labcomm
 import sys
 
 if __name__ == "__main__":
-    version = sys.argv[2] if len(sys.argv) == 3 else "LabComm2013"
+    version = sys.argv[2] if len(sys.argv) == 3 else "LabComm20141009"
     d = labcomm.Decoder(labcomm.StreamReader(open(sys.argv[1])), version)
 
     while True:
diff --git a/lib/Makefile b/lib/Makefile
index ed696a8..8f5b6da 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -10,8 +10,10 @@ clean:
 	cd c ; make clean
 	cd csharp ; make clean
 	cd java ; make clean
+	$(MAKE) -C python clean
 
 distclean:
 	cd c ; make distclean
 	cd csharp ; make clean
 	cd java ; make clean
+	$(MAKE) -C python clean
diff --git a/lib/RAPID/README b/lib/RAPID/README
index f296d4d..0e45345 100644
--- a/lib/RAPID/README
+++ b/lib/RAPID/README
@@ -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 "LabComm2013".
+version is "LabComm20141009".
 
 # Initiate the labcomm samples:
 LabComm trusts the application to manage each sample. It requests the samples,
diff --git a/lib/c/Makefile b/lib/c/Makefile
index 43e892f..ed97fc4 100644
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -1,6 +1,6 @@
 ## Macros
 UNAME_S=$(shell uname -s)
-ALL_DEPS=liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1  liblabcomm2013.a liblabcomm2013.so.1
+ALL_DEPS=liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1  liblabcomm20141009.a liblabcomm20141009.so.1
 
 ifeq ($(UNAME_S),Linux)
   CFLAGS=-std=c99 -g -Wall -Werror -O3  -I. -Itest -I2006
@@ -95,10 +95,10 @@ liblabcomm.a: $(OBJS) $(OBJS2006)
 liblabcomm.so.1: $(OBJS:%.o=%.pic.o) $(OBJS2006:%.o=%.pic.o)
 	$(call MAKESHARED,$@,$@,$^)
 
-liblabcomm2013.a: $(OBJS)
+liblabcomm20141009.a: $(OBJS)
 	ar -r $@ $^
 
-liblabcomm2013.so.1: $(OBJS:%.o=%.pic.o)
+liblabcomm20141009.so.1: $(OBJS:%.o=%.pic.o)
 	$(call MAKESHARED,$@,$@,$^)
 
 liblabcomm2006.a: $(OBJS2006)
@@ -178,8 +178,8 @@ distclean: clean
 	$(RM) liblabcomm.a
 	$(RM) liblabcomm2006.so.1
 	$(RM) liblabcomm2006.a
-	$(RM) liblabcomm2013.so.1
-	$(RM) liblabcomm2013.a
+	$(RM) liblabcomm20141009.so.1
+	$(RM) liblabcomm20141009.a
 
 # Extra dependencies
 $(TEST_DIR)/test_labcomm_basic_type_encoding.o: labcomm_private.h
diff --git a/lib/c/labcomm.c b/lib/c/labcomm.c
index ed4e617..3ec7d88 100644
--- a/lib/c/labcomm.c
+++ b/lib/c/labcomm.c
@@ -37,7 +37,7 @@
 #include "labcomm_ioctl.h"
 #include "labcomm_dynamic_buffer_writer.h"
 
-#define LABCOMM_VERSION "LabComm2013"
+#define LABCOMM_VERSION "LabComm20141009"
 
 /* Unwrapping reader/writer functions */
 #define UNWRAP_ac(rw, ac, ...) ac
diff --git a/lib/c/labcomm_decoder.c b/lib/c/labcomm_decoder.c
index 0de42d3..ee433d9 100644
--- a/lib/c/labcomm_decoder.c
+++ b/lib/c/labcomm_decoder.c
@@ -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 LABCOMM_VERSION "LabComm2013"
+#define LABCOMM_VERSION "LabComm20141009"
 
 #include <errno.h>
 #include "labcomm.h"
@@ -166,7 +166,7 @@ out:
   return result;
 }
 
-static int decode_typedef_or_sample(struct labcomm_decoder *d, int kind)
+static int decode_sample(struct labcomm_decoder *d, int kind)
 {
   int result;
 
@@ -310,8 +310,8 @@ int labcomm_decoder_decode_one(struct labcomm_decoder *d)
     result = d->reader->error;
     goto out;
   }
-  if (remote_index == LABCOMM_TYPEDEF || remote_index == LABCOMM_SAMPLE) {
-    result = decode_typedef_or_sample(d, remote_index); 
+  if (remote_index == LABCOMM_SAMPLE) {
+    result = decode_sample(d, remote_index); 
   } else {
     int *local_index;
     struct call_handler_context wrap = {
diff --git a/lib/c/labcomm_encoder.c b/lib/c/labcomm_encoder.c
index 9230742..3983e43 100644
--- a/lib/c/labcomm_encoder.c
+++ b/lib/c/labcomm_encoder.c
@@ -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 LABCOMM_VERSION "LabComm2013"
+#define LABCOMM_VERSION "LabComm20141009"
 
 #include <errno.h>
 #include "labcomm.h"
diff --git a/lib/csharp/se/lth/control/labcomm/LabComm.cs b/lib/csharp/se/lth/control/labcomm/LabComm.cs
index 93efe68..32ec6cf 100644
--- a/lib/csharp/se/lth/control/labcomm/LabComm.cs
+++ b/lib/csharp/se/lth/control/labcomm/LabComm.cs
@@ -2,7 +2,7 @@ namespace se.lth.control.labcomm {
 
   public class LabComm {
 
-   public const string VERSION = "LabComm2013";
+   public const string VERSION = "LabComm20141009";
 
    /*
      * Predeclared aggregate type indices
diff --git a/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs b/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs
index 2d6b8d4..76fa4e9 100644
--- a/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs
+++ b/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs
@@ -25,7 +25,6 @@ namespace se.lth.control.labcomm {
       while (!done) {
 	int tag = decodePacked32();
 	switch (tag) {
-	case LabComm.TYPEDEF:
         case LabComm.SAMPLE: {
           int index = decodePacked32();
           String name = decodeString();
diff --git a/lib/java/Makefile b/lib/java/Makefile
index 48204f4..f3f60c2 100644
--- a/lib/java/Makefile
+++ b/lib/java/Makefile
@@ -13,13 +13,13 @@ MODULES=LabCommDispatcher \
 	LabCommReader \
 	WriterWrapper
 
-all: labcomm.jar labcomm2013.jar labcomm2006.jar
+all: labcomm.jar labcomm20141009.jar labcomm2006.jar
 
 labcomm.jar: gen/JAVAC
 	echo $@
 	cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class se/lth/control/labcomm2006/*.class
 
-labcomm2013.jar: gen/JAVAC
+labcomm20141009.jar: gen/JAVAC
 	echo $@
 	cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class
 
@@ -38,5 +38,5 @@ gen/JAVAC: $(MODULES:%=se/lth/control/labcomm/%.java) $(MODULES:%=se/lth/control
 .PHONY: clean
 
 clean:
-	rm -rf labcomm.jar labcomm2006.jar labcomm2013.jar gen 
+	rm -rf labcomm.jar labcomm2006.jar labcomm20141009.jar gen 
 
diff --git a/lib/java/se/lth/control/labcomm/LabComm.java b/lib/java/se/lth/control/labcomm/LabComm.java
index 99c74c2..0a89ea3 100644
--- a/lib/java/se/lth/control/labcomm/LabComm.java
+++ b/lib/java/se/lth/control/labcomm/LabComm.java
@@ -2,7 +2,7 @@ package se.lth.control.labcomm;
 
 public class LabComm {
 
-  public static final String VERSION = "LabComm2013";
+  public static final String VERSION = "LabComm20141009";
 
   /*
    * Predeclared aggregate type indices
diff --git a/lib/java/se/lth/control/labcomm/LabCommDecoderChannel.java b/lib/java/se/lth/control/labcomm/LabCommDecoderChannel.java
index 0fe0e82..6054875 100644
--- a/lib/java/se/lth/control/labcomm/LabCommDecoderChannel.java
+++ b/lib/java/se/lth/control/labcomm/LabCommDecoderChannel.java
@@ -26,7 +26,6 @@ public class LabCommDecoderChannel implements LabCommDecoder {
     while (!done) {
       int tag = decodePacked32();
       switch (tag) {
-	case LabComm.TYPEDEF:
 	case LabComm.SAMPLE: {
 	  int index = decodePacked32();
 	  String name = decodeString();
diff --git a/lib/java/se/lth/control/labcomm2006/LabCommDecoderChannel.java b/lib/java/se/lth/control/labcomm2006/LabCommDecoderChannel.java
index d0767b0..28077b5 100644
--- a/lib/java/se/lth/control/labcomm2006/LabCommDecoderChannel.java
+++ b/lib/java/se/lth/control/labcomm2006/LabCommDecoderChannel.java
@@ -20,7 +20,6 @@ public class LabCommDecoderChannel implements LabCommDecoder {
     while (!done) {
       int tag = decodePacked32();
       switch (tag) {
-	case LabComm.TYPEDEF:
 	case LabComm.SAMPLE: {
 	  int index = decodePacked32();
 	  String name = decodeString();
@@ -135,7 +134,7 @@ public class LabCommDecoderChannel implements LabCommDecoder {
   }
 
   /**
-     method for API harmonization with labcomm2013.
+     method for API harmonization with labcomm20141009.
      Labcomm2006 encodes lengths etc as 32 bit ints.
   */
   public int decodePacked32() throws IOException {
diff --git a/lib/java/se/lth/control/labcomm2006/LabCommEncoderChannel.java b/lib/java/se/lth/control/labcomm2006/LabCommEncoderChannel.java
index 6cd8804..173ff50 100644
--- a/lib/java/se/lth/control/labcomm2006/LabCommEncoderChannel.java
+++ b/lib/java/se/lth/control/labcomm2006/LabCommEncoderChannel.java
@@ -94,7 +94,7 @@ public class LabCommEncoderChannel implements LabCommEncoder {
   }
 
   /**
-     method for API harmonization with labcomm2013.
+     method for API harmonization with labcomm20141009.
      Labcomm2006 encodes lengths etc as 32 bit ints.
   */
   public void encodePacked32(long value) throws IOException {
diff --git a/lib/python/Makefile b/lib/python/Makefile
new file mode 100644
index 0000000..7798ea9
--- /dev/null
+++ b/lib/python/Makefile
@@ -0,0 +1,5 @@
+clean:
+	find . -name '*.pyc' -exec rm {} \;
+
+distclean:
+	find . -name '*.pyc' -exec rm {} \;
diff --git a/lib/python/labcomm/LabComm.py b/lib/python/labcomm/LabComm.py
index ad99579..5f8ab13 100644
--- a/lib/python/labcomm/LabComm.py
+++ b/lib/python/labcomm/LabComm.py
@@ -96,14 +96,41 @@
 import types
 import struct as packer
 
-#VERSION = "LabComm2013"
+DEFAULT_VERSION = "LabComm20141009"
 
 # Version testing
 def sendVersionString(version):
-  return version == "LabComm2013" 
+    return version in [ "LabComm2013", "LabComm20141009" ]
 
 def usePacked32(version):
-  return version == "LabComm2013"
+    return version in [ "LabComm2013", "LabComm20141009" ]
+
+def usePacketLength(version):
+    return version in [ "LabComm20141009" ]
+
+class length_encoder:
+    def __init__(self, encoder):
+        import sys
+        self.encoder = encoder
+        self.data = ""
+        print>>sys.stderr, "INIT", self, self.encoder, self.encoder.writer
+
+    def start(self, encoder, version):
+        self.version = version
+        pass
+    
+    def write(self, data):
+        import sys
+        print>>sys.stderr, [ data ]
+        print>>sys.stderr, "WRITE", self, self.encoder, self.encoder.writer
+
+    def __enter__(self):
+        return Encoder(self)
+
+    def __exit__(self, type, value, traceback):
+        print>>sys.stderr, "EXIT", value
+        
+        pass
 
 i_TYPEDEF = 0x01
 i_SAMPLE  = 0x02
@@ -269,6 +296,7 @@ class sample_or_typedef(object):
         self.decl = decl
 
     def encode_decl_tail(self, encoder):
+#        with length_encoder(encoder) as e:
         encoder.encode_type_number(self)
         encoder.encode_string(self.name)
         encoder.encode_type_number(self.decl)
@@ -298,6 +326,12 @@ class sample_or_typedef(object):
 
 class sample(sample_or_typedef):
     def encode_decl(self, encoder):
+#        with length_encoder(encoder) as e:
+#            e.encode_type(i_SAMPLE)
+#            self.encode_decl_tail(e)
+        import sys
+        print>>sys.stderr, "AFTER"
+ 
         encoder.encode_type(i_SAMPLE)
         self.encode_decl_tail(encoder)
 
@@ -553,7 +587,7 @@ class Codec(object):
         
 
 class Encoder(Codec):
-    def __init__(self, writer, version="LabComm2013"):
+    def __init__(self, writer, version=DEFAULT_VERSION):
         super(Encoder, self).__init__()
         self.writer = writer
         self.version = version
@@ -584,7 +618,7 @@ class Encoder(Codec):
             
     def encode_packed32(self, v):
         #if usePacked32(self.version) :
-        if self.version == "LabComm2013" :
+        if self.version in [ "LabComm2013",  "LabComm20141009" ]:
             v = v & 0xffffffff
             tmp = [ v & 0x7f ]
             v = v >> 7
@@ -634,7 +668,7 @@ class Encoder(Codec):
 #        self.pack("!i%ds" % len(s), len(s), s)
 
 class Decoder(Codec):
-    def __init__(self, reader, version="LabComm2013"):
+    def __init__(self, reader, version=DEFAULT_VERSION):
         super(Decoder, self).__init__()
         self.reader = reader
         self.version = version
@@ -659,7 +693,7 @@ class Decoder(Codec):
         value = None
         index = self.decode_type_number()
         decl = self.index_to_decl[index]
-        if index == i_TYPEDEF or index == i_SAMPLE:
+        if index == i_SAMPLE:
             decl = decl.decode_decl(self)
         else:
             value = decl.decode(self)
@@ -680,7 +714,7 @@ class Decoder(Codec):
         return result
     
     def decode_packed32(self):
-        if self.version == "LabComm2013" :
+        if self.version in [ "LabComm2013", "LabComm20141009" ] :
             result = 0
             while True:
                 tmp = self.decode_byte()
-- 
GitLab