From 62481855aaa5c58b4e52561f94a4bd6f26492967 Mon Sep 17 00:00:00 2001
From: Sven Gestegard Robertz <sven.robertz@cs.lth.se>
Date: Sat, 25 Oct 2014 08:42:19 +0200
Subject: [PATCH] renamed SAMPLE to SAMPLE_DEF

---
 lib/java/se/lth/control/labcomm/Constant.java |  2 +-
 .../lth/control/labcomm/DecoderChannel.java   |  2 +-
 .../lth/control/labcomm/EncoderChannel.java   |  2 +-
 lib/python/labcomm/LabComm.py                 | 40 +++++++++----------
 4 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/lib/java/se/lth/control/labcomm/Constant.java b/lib/java/se/lth/control/labcomm/Constant.java
index b67fb05..e2c88c9 100644
--- a/lib/java/se/lth/control/labcomm/Constant.java
+++ b/lib/java/se/lth/control/labcomm/Constant.java
@@ -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 */
 
diff --git a/lib/java/se/lth/control/labcomm/DecoderChannel.java b/lib/java/se/lth/control/labcomm/DecoderChannel.java
index 6f7760f..9c5b94d 100644
--- a/lib/java/se/lth/control/labcomm/DecoderChannel.java
+++ b/lib/java/se/lth/control/labcomm/DecoderChannel.java
@@ -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();
diff --git a/lib/java/se/lth/control/labcomm/EncoderChannel.java b/lib/java/se/lth/control/labcomm/EncoderChannel.java
index e7c3e80..08ef0fc 100644
--- a/lib/java/se/lth/control/labcomm/EncoderChannel.java
+++ b/lib/java/se/lth/control/labcomm/EncoderChannel.java
@@ -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();
diff --git a/lib/python/labcomm/LabComm.py b/lib/python/labcomm/LabComm.py
index da370ea..7b38330 100644
--- a/lib/python/labcomm/LabComm.py
+++ b/lib/python/labcomm/LabComm.py
@@ -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:
-- 
GitLab