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

renamed SAMPLE to SAMPLE_DEF

parent ac25da65
......@@ -11,7 +11,7 @@ public class Constant {
* Predeclared aggregate type indices
*/
public static final int VERSION = 0x01;
public static final int SAMPLE = 0x02;
public static final int SAMPLE_DEF = 0x02;
public static final int PRAGMA = 0x3f;
public static final int FIRST_USER_INDEX = 0x40; /* ..0xffffffff */
......
......@@ -29,7 +29,7 @@ public class DecoderChannel implements Decoder {
version + " != " + Constant.CURRENT_VERSION);
}
} break;
case Constant.SAMPLE: {
case Constant.SAMPLE_DEF: {
int index = decodePacked32();
String name = decodeString();
int signature_length = decodePacked32();
......
......@@ -30,7 +30,7 @@ public class EncoderChannel implements Encoder {
public void register(SampleDispatcher dispatcher) throws IOException {
int index = registry.add(dispatcher);
begin(Constant.SAMPLE);
begin(Constant.SAMPLE_DEF);
encodePacked32(index);
encodeString(dispatcher.getName());
byte[] signature = dispatcher.getSignature();
......
......@@ -11,7 +11,7 @@
# | ...
# +----+--
#
# LabComm220141009 SAMPLE:
# LabComm220141009 SAMPLE_DEF:
#
# +----+----+----+----+
# | id = 0x02 (packed32)
......@@ -50,7 +50,7 @@
# | ...
# +----+--
#
# LabComm2006 SAMPLE:
# LabComm2006 SAMPLE_DEF:
#
# +----+----+----+----+
# | id = 0x00000002 |
......@@ -123,23 +123,23 @@ import struct as packer
DEFAULT_VERSION = "LabComm20141009"
# Allowed packet tags
i_VERSION = 0x01
i_SAMPLE = 0x02
i_PRAGMA = 0x3f
i_USER = 0x40 # ..0xffffffff
i_VERSION = 0x01
i_SAMPLE_DEF = 0x02
i_PRAGMA = 0x3f
i_USER = 0x40 # ..0xffffffff
# Predefined types
i_ARRAY = 0x10
i_STRUCT = 0x11
i_ARRAY = 0x10
i_STRUCT = 0x11
i_BOOLEAN = 0x20
i_BYTE = 0x21
i_SHORT = 0x22
i_INTEGER = 0x23
i_LONG = 0x24
i_FLOAT = 0x25
i_DOUBLE = 0x26
i_STRING = 0x27
i_BOOLEAN = 0x20
i_BYTE = 0x21
i_SHORT = 0x22
i_INTEGER = 0x23
i_LONG = 0x24
i_FLOAT = 0x25
i_DOUBLE = 0x26
i_STRING = 0x27
# Version testing
......@@ -310,7 +310,7 @@ class sample(object):
self.decl = decl
def encode_decl(self, encoder):
encoder.encode_type(i_SAMPLE)
encoder.encode_type(i_SAMPLE_DEF)
with length_encoder(encoder) as e1:
e1.encode_type(encoder.decl_to_index[self])
e1.encode_string(self.name)
......@@ -512,7 +512,7 @@ class struct:
result += "\n])"
return result
SAMPLE = sample(None, None)
SAMPLE_DEF = sample(None, None)
ARRAY = array(None, None)
STRUCT = struct({})
......@@ -541,7 +541,7 @@ class Codec(object):
self.predefined_types()
def predefined_types(self):
self.add_decl(SAMPLE, i_SAMPLE)
self.add_decl(SAMPLE_DEF, i_SAMPLE_DEF)
self.add_decl(ARRAY, i_ARRAY)
self.add_decl(STRUCT, i_STRUCT)
......@@ -705,7 +705,7 @@ class Decoder(Codec):
if self.version != other_version:
raise Exception("LabComm version mismatch %s != %s" %
(version, other_version))
if index == i_SAMPLE:
if index == i_SAMPLE_DEF:
decl = self.index_to_decl[index].decode_decl(self)
value = None
else:
......
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