From 33f41ada88bd254256ed4de09cb20761981c1fb7 Mon Sep 17 00:00:00 2001 From: Sven Gestegard Robertz <sven.robertz@cs.lth.se> Date: Mon, 26 Jan 2015 10:16:48 +0100 Subject: [PATCH] put back TYPE_DEF, TYPE_BINDING, and PRAGMA in python decoder --- lib/python/labcomm/LabComm.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/python/labcomm/LabComm.py b/lib/python/labcomm/LabComm.py index c4b353c..b3b6dd6 100644 --- a/lib/python/labcomm/LabComm.py +++ b/lib/python/labcomm/LabComm.py @@ -157,6 +157,8 @@ DEFAULT_VERSION = "LabComm2014" i_VERSION = 0x01 i_SAMPLE_DEF = 0x02 i_SAMPLE_REF = 0x03 +i_TYPE_DEF = 0x04 +i_TYPE_BINDING= 0x05 i_PRAGMA = 0x3f i_USER = 0x40 # ..0xffffffff @@ -829,6 +831,13 @@ class Decoder(Codec): for _ in xrange(length): self.decode_byte() + # kludge, should really check if the index exists in self.version + def skip_or_raise(self, length, index): + if usePacketLength(self.version): + self.skip(length) + else: + raise Exception("Invalid type index %d" % index) + def decode(self): while True: index = self.decode_type_number() @@ -847,6 +856,18 @@ class Decoder(Codec): elif index == i_SAMPLE_REF: decl = self.index_to_decl[index].decode_decl(self) value = None + elif index == i_TYPE_DEF: + self.skip_or_raise(length, index) + decl = None + value = None + elif index == i_TYPE_BINDING: + self.skip_or_raise(length, index) + decl = None + value = None + elif index == i_PRAGMA: + self.skip_or_raise(length, index) + decl = None + value = None elif index < i_USER: raise Exception("Invalid type index %d" % index) else: -- GitLab