diff --git a/Makefile b/Makefile
index 77f3305be42cf3bf750fbed64aa4c60ae740427e..f774e61247291edae2cd1048289d715d5cece843 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 SUBDIRS=compiler lib test examples packaging
-export LABCOMM_JAR=$(shell pwd)/compiler/labcomm_compiler.jar
+export LABCOMM_JAR=$(shell pwd)/compiler/labcomm2006_compiler.jar
 export LABCOMM=java -jar $(LABCOMM_JAR) 
 
 .PHONY: all
diff --git a/compiler/.gitignore b/compiler/.gitignore
index fb3995c874769be543f53f991762b1b77c16fc06..8aff1aca7f9fe2af186ebc471e15b09e01fe3735 100644
--- a/compiler/.gitignore
+++ b/compiler/.gitignore
@@ -1,4 +1,2 @@
 gen
 labcomm2006_compiler.jar
-labcomm2014_compiler.jar
-labcomm_compiler.jar
diff --git a/compiler/2006/CS_CodeGen.jrag b/compiler/2006/CS_CodeGen.jrag
index e1da497f2601fa68727e527a94e6f90287e804df..800e0541f1be4141184c0264b8c106930c4f870e 100644
--- a/compiler/2006/CS_CodeGen.jrag
+++ b/compiler/2006/CS_CodeGen.jrag
@@ -8,8 +8,6 @@ aspect CS_CodeGenEnv {
 
   public class CS_env {
 
-    public final int version;
-    public final String verStr;
     private int indent;
     private int depth;
     private CS_printer printer;
@@ -77,19 +75,17 @@ aspect CS_CodeGenEnv {
       }
     }
 
-    private CS_env(int indent, CS_printer printer, int version) {
-      this.version = version;
+    private CS_env(int indent, CS_printer printer) {
       this.indent = indent;
       this.printer = printer;
-      this.verStr = LabCommVersion.versionString(version);
     }
 
-    public CS_env(File f, int version) {
-      this(0, new CS_printer(f), version);
+    public CS_env(File f) {
+      this(0, new CS_printer(f));
     }
 
-    public CS_env(PrintStream out, int version) {
-      this(0, new CS_printer(out), version);
+    public CS_env(PrintStream out) {
+      this(0, new CS_printer(out));
     }
 
     public void close() throws IOException {
@@ -202,9 +198,9 @@ aspect CS_Void {
 aspect CS_CodeGen {
 
   public void Program.CS_gen(String file, 
-			     String namespace, int version) throws IOException {
+			     String namespace) throws IOException {
     // Registration class
-    CS_env env = new CS_env(new File(file), version);
+    CS_env env = new CS_env(new File(file));
     if (namespace != null && namespace.length() > 0) {
       env.println("namespace " + namespace + "{");
       env.indent();
@@ -244,7 +240,6 @@ aspect CS_Register {
   }
 
   public void TypeDecl.CS_emitTypeRegister(CS_env env) {
-    // TODO
   }
 
 }
@@ -258,45 +253,9 @@ aspect CS_Class {
   }
 
   public void Decl.CS_emitDeclPP(CS_env env){
-	env.println("/* ");
-	pp(env.getPrintStream());
-	
-	CS_emitUserTypeDeps(env,null,false);
-	CS_emitUserTypeRefs(env,null,false);
-	env.println("*/");
-  
-  }
-  
-  public void Decl.CS_emitUserTypeDeps(CS_env env, String via, boolean outputCode){
-	Iterator<Decl> it = type_dependencies().iterator();
-	while(it.hasNext()) {
-	    Decl t = it.next();
-
-	    t.CS_emitUserTypeDeps(env, t.getName(), outputCode);
-	    if( outputCode && t.getType().isUserType() ) {
-	       env.println(t.getName()+".register(e);");
-	    } else {  // Just output a comment
-		String refpath = (via == null) ? "directly" : "indirectly via "+via;
-	       env.println(" //Depends ("+refpath+") on "+t.getName() );
-	    }
-	}
-  }
-  
-  public void Decl.CS_emitUserTypeRefs(CS_env env, String via, boolean outputCode){
-     if( isReferenced() ) {
-        Iterator<Decl> it = type_references().iterator();
-        while(it.hasNext()) {
-            Decl t = it.next();
-
-            t.CS_emitUserTypeRefs(env, t.getName(), outputCode);
-            if(outputCode) {
-               env.println(t.getName()+".register(e);");
-            } else {  // Just output a comment
-	        String refpath = (via == null) ? "directly" : "indirectly via "+via;
-	       env.println(" //Is referenced ("+refpath+")  by "+t.getName() );
-            }
-        }
-    }
+    env.println("/* ");
+    pp(env.getPrintStream());
+    env.println("*/");
   }
   
   public void Decl.CS_emitRegisterEncoder(CS_env env) {
@@ -305,11 +264,6 @@ aspect CS_Class {
     env.println("e.register(dispatcher);");
     env.unindent();
     env.println("}");
-    env.println("public static void registerSampleRef(Encoder e) {");
-    env.indent();
-    env.println("e.registerSampleRef(dispatcher);");
-    env.unindent();
-    env.println("}");
     env.println();
   }
   
@@ -320,12 +274,6 @@ aspect CS_Class {
     env.unindent();
     env.println("}");
     env.println();
-    env.println("public static void registerSampleRef(Decoder d) {");
-    env.indent();
-    env.println("d.registerSampleRef(dispatcher);");
-    env.unindent();
-    env.println("}");
-    env.println();
   }
     
   public void TypeDecl.CS_emitClass(CS_env env) {
@@ -339,11 +287,6 @@ aspect CS_Class {
       env.println();
       env.indent();
       getType().CS_emitInstance(env);
-      if( isReferenced()) {
-        CS_emitRegisterEncoder(env);
-	CS_emitDispatcher(env,false);
-      }
-      CS_emitSignature(env);
       CS_emitEncoder(env);
       CS_emitDecoder(env);
       env.unindent();
@@ -381,22 +324,18 @@ aspect CS_Class {
 
   public void Decl.CS_emitSignature(CS_env env) {
     CS_emitFlatSignature(env);
-//    if(isReferenced() || isSampleDecl()){
-//      Signature signature = getSignature();
-//      signature.CS_emitSignature(env, !isSampleDecl());
-//    }
   }
 
   public void Decl.CS_emitFlatSignature(CS_env env){
     env.println("private static byte[] signature = new byte[] {");
     env.indent();
-    SignatureList signature = flatSignature(env.version);
+    SignatureList signature = flatSignature(2006);
     for (int i = 0 ; i < signature.size() ; i++) {
       String comment = signature.getComment(i);
       if (comment != null) {
         env.println(signature.getIndent(i) + "// " + comment);
       }
-      byte[] data = signature.getData(i, env.version);
+      byte[] data = signature.getData(i, 2006);
       if (data != null) {
         env.print(signature.getIndent(i));
         for (int j = 0 ; j < data.length ; j++) {
@@ -413,7 +352,7 @@ aspect CS_Class {
 
   //XXX TODO: refactor: split into a static class ("TypeDefSingleton"?)and a (smaller) dispatcher
   public void Decl.CS_emitDispatcher(CS_env env, boolean isSample) {
-    String genericStr = ""; //env.versionHasMetaData()?"<"+getName()+">":""; 
+    String genericStr = "";
     env.println("private static Dispatcher dispatcher = new Dispatcher();");
     env.println();
     env.println("public SampleDispatcher getDispatcher() {");
@@ -467,8 +406,8 @@ aspect CS_Class {
 //    env.println();
 //  env.println("public void encodeSignatureMetadata(Encoder e, int index){");
 //  env.indent();
-//  env.println("e.encodePacked32(Constant.TYPE_DEF);");
-//  env.println("e.encodePacked32(index);");
+//  env.println("e.encodeInt(Constant.TYPE_DEF);");
+//  env.println("e.encodeInt(index);");
 //  env.println("e.encodeString(getName());");
 //  env.println("emitSignature(e);");
 //  env.unindent();
@@ -553,7 +492,6 @@ aspect CS_Class {
       case LABCOMM_FLOAT: { env.print("e.encodeFloat"); } break;
       case LABCOMM_DOUBLE: { env.print("e.encodeDouble"); } break;
       case LABCOMM_STRING: { env.print("e.encodeString"); } break;
-      case LABCOMM_SAMPLE: { env.print("e.encodeSampleRef"); } break;
     }
     env.println("(" + name + ");");
   }
@@ -593,7 +531,7 @@ aspect CS_Class {
   }
 
   public String VariableSize.CS_emitEncoder(CS_env env, String name) {
-    env.println("e.encodePacked32(" + name + ");");
+    env.println("e.encodeInt(" + name + ");");
     return name;
   }
 
@@ -648,7 +586,6 @@ aspect CS_Class {
       case LABCOMM_FLOAT: { env.println("d.decodeFloat();"); } break;
       case LABCOMM_DOUBLE: { env.println("d.decodeDouble();"); } break;
       case LABCOMM_STRING: { env.println("d.decodeString();"); } break;
-      case LABCOMM_SAMPLE: { env.println("d.decodeSampleRef();"); } break;
       default: {
         throw new Error("PrimType.CS_emitDecoder(CS_env env, String name)" + 
                         " unknown token type");
@@ -706,7 +643,7 @@ aspect CS_Class {
   }
 
   public void VariableSize.CS_emitDecoder(CS_env env) {
-    env.print("d.decodePacked32()");
+    env.print("d.decodeInt()");
   }
 
   public void StructType.CS_emitDecoder(CS_env env, String name) {
@@ -892,51 +829,51 @@ aspect CS_Class {
 }
 
 aspect CS_Signature {
-    public void Signature.CS_emitSignature(CS_env env, boolean decl){
- 
-      SignatureList sl = getSignatureList();
-      sl.CS_emitSignature(env, decl);
-    }
 
-    public abstract void SignatureLine.CS_emitSignature(CS_env env, boolean decl);
+  public void Signature.CS_emitSignature(CS_env env, boolean decl) {
+    SignatureList sl = getSignatureList();
+    sl.CS_emitSignature(env, decl);
+  }
+
+  public abstract void SignatureLine.CS_emitSignature(CS_env env, boolean decl);
+
+  public void TypeRefSignatureLine.CS_emitSignature(CS_env env, boolean isDecl) {
+    env.print(getIndentString());
+    env.println("e.encodeInt(e.getTypeId( typeof("+decl.getName()+")));");
+  }
 
-    public void TypeRefSignatureLine.CS_emitSignature(CS_env env, boolean isDecl){
+  public void DataSignatureLine.CS_emitSignature(CS_env env, boolean decl) {
+    byte[] data = getData(2006);
+    if (data != null) {
       env.print(getIndentString());
-      env.println("e.encodePacked32(e.getTypeId( typeof("+decl.getName()+")));");
-    }
-
-    public void DataSignatureLine.CS_emitSignature(CS_env env, boolean decl){
-        byte[] data = getData(env.version);
-          if (data != null) {
-              env.print(getIndentString());
-              for (int j = 0 ; j < data.length ; j++) {
-                  //env.print("e.encodeByte((byte)"+data[j]+");");
-                  env.print("e.encodeByte((byte)"+ String.format("0x%02X ", data[j]) +"); ");
-              }
-              env.println();
-          }
+      for (int j = 0 ; j < data.length ; j++) {
+        env.print("e.encodeByte((byte)"+ String.format("0x%02X ", data[j]) +"); ");
+      }
+      env.println();
+    }
   }
-    public void SignatureList.CS_emitSignature(CS_env env, boolean decl) {
-      env.println("private static void emitSignature(Encoder e){");
-      env.indent();
-      for (int i = 0 ; i < size() ; i++) {
-        String comment = getComment(i);
-        if (comment != null && comment.length() > 0) {
-            env.println(getIndent(i) + "// " + comment);
-        }
-        SignatureLine l = getSignatureLine(i);
-        l.CS_emitSignature(env, decl);
+  
+  public void SignatureList.CS_emitSignature(CS_env env, boolean decl) {
+    env.println("private static void emitSignature(Encoder e){");
+    env.indent();
+    for (int i = 0 ; i < size() ; i++) {
+      String comment = getComment(i);
+      if (comment != null && comment.length() > 0) {
+          env.println(getIndent(i) + "// " + comment);
       }
-      env.println("}");
-      env.unindent();
+      SignatureLine l = getSignatureLine(i);
+      l.CS_emitSignature(env, decl);
+    }
+    env.println("}");
+    env.unindent();
   }
 
 }
 
 aspect CS_Info {
 
-  public void Program.CS_info(PrintStream out, String namespace, int version) {
-    CS_env env = new CS_env(out, version);
+  public void Program.CS_info(PrintStream out, String namespace) {
+    CS_env env = new CS_env(out);
     if (namespace == null) {
       namespace = ""; 
     } else {
diff --git a/compiler/2006/C_CodeGen.jrag b/compiler/2006/C_CodeGen.jrag
index 2fd45b192385847e511939149846d5e1a5c5651e..f0c1912a573d120d7c04c0be6854dbe3e644af05 100644
--- a/compiler/2006/C_CodeGen.jrag
+++ b/compiler/2006/C_CodeGen.jrag
@@ -33,9 +33,6 @@ aspect C_CodeGenEnv {
       }
     }
 
-    public final int version; //labcomm version (2006 or 2014)
-    public final String verStr; // version suffix to append (currently _2006 and empty string)
-
     public final String qualid;
     public final String lcName;
     public final String rawPrefix;
@@ -47,16 +44,10 @@ aspect C_CodeGenEnv {
     private boolean rootIsPointer;
     private int rootLevel;
 
-    public boolean versionHasMetaData() {
-      return version != 2006;
-    }
-
     private C_env(String qualid, String lcName, String rawPrefix, 
 		  int indent, int depth, C_printer printer,
-                  int nestedLevel, int version)
+                  int nestedLevel)
     {
-      this.version = version;
-      this.verStr = LabCommVersion.versionString(version);
       this.qualid = qualid;
       this.lcName = lcName;
       this.rawPrefix = rawPrefix;
@@ -75,24 +66,24 @@ aspect C_CodeGenEnv {
     }
 
     public C_env(String qualid, String lcName, String rawPrefix,
-		 PrintStream out, int version)
+		 PrintStream out)
     {
-      this(qualid, lcName, rawPrefix, 0, 0, new C_printer(out), 0, version);
+      this(qualid, lcName, rawPrefix, 0, 0, new C_printer(out), 0);
     }
 
     public C_env(String qualid, String lcName, String rawPrefix,
-		 int indent, int depth, C_printer printer, int version) {
-            this(qualid, lcName, rawPrefix, indent, depth, printer, 0, version);
+		 int indent, int depth, C_printer printer) {
+            this(qualid, lcName, rawPrefix, indent, depth, printer, 0);
     }
 
     public C_env nestArray(String suffix) {
       return new C_env(qualid + suffix, lcName, rawPrefix,
-		       indent, depth + 1, printer, nestedLevel + 1, version);
+		       indent, depth + 1, printer, nestedLevel + 1);
     }
 
     public C_env nestStruct(String suffix) {
       return new C_env(qualid + suffix, lcName, rawPrefix, 
-		       indent, depth, printer, nestedLevel + 1, version);
+		       indent, depth, printer, nestedLevel + 1);
     }
 
     public void indent() {
@@ -178,8 +169,8 @@ aspect C_IsDynamic {
 aspect C_CodeGen {
 
   public void Program.C_genH(PrintStream out, Vector includes, 
-			     String lcName, String prefix, int version) {
-    C_env env = new C_env("", lcName, prefix, out, version);
+			     String lcName, String prefix) {
+    C_env env = new C_env("", lcName, prefix, out);
 
     // Hackish prettyprint preamble
     out.println("/* LabComm declarations:");
@@ -192,7 +183,7 @@ aspect C_CodeGen {
     env.println("");
 
     // Include
-    env.println("#include \"labcomm"+env.verStr+".h\"");
+    env.println("#include \"labcomm2006.h\"");
     for (int i = 0 ; i < includes.size() ; i++) {
       env.println("#include \"" + includes.get(i) + "\"");
     }
@@ -204,12 +195,12 @@ aspect C_CodeGen {
   }
 
   public void Program.C_genC(PrintStream out, Vector includes, 
-			     String lcName, String prefix, int version) {
-    C_env env = new C_env("", lcName, prefix, out, version);
+			     String lcName, String prefix) {
+    C_env env = new C_env("", lcName, prefix, out);
 
     // Include
-    env.println("#include \"labcomm"+env.verStr+".h\"");
-    env.println("#include \"labcomm"+env.verStr+"_private.h\"");
+    env.println("#include \"labcomm2006.h\"");
+    env.println("#include \"labcomm2006_private.h\"");
     for (int i = 0 ; i < includes.size() ; i++) {
       env.println("#include \"" + includes.get(i) + "\"");
     }
@@ -285,8 +276,8 @@ aspect C_Type {
     env.println(";");
     env.println("#define LABCOMM_DEFINED_" + env.prefix + getName());
     env.println("#endif");
-    env.println("extern const struct labcomm"+env.verStr+"_signature " +
-                "*labcomm"+env.verStr+"_signature_" + env.prefix + getName() + 
+    env.println("extern const struct labcomm2006_signature " +
+                "*labcomm2006_signature_" + env.prefix + getName() + 
                 ";");
   }
 
@@ -383,10 +374,10 @@ aspect C_Declarations {
   }
 
   public void SampleDecl.C_emitDecoderDeclaration(C_env env) {
-    env.println("int labcomm"+env.verStr+"_decoder_register_" + 
+    env.println("int labcomm2006_decoder_register_" + 
 		env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_decoder *d,");
+    env.println("struct labcomm2006_decoder *d,");
     env.println("void (*handler)(");
     env.indent();
     env.println(env.prefix + getName() + " *v,");
@@ -397,9 +388,9 @@ aspect C_Declarations {
     env.unindent();
     env.println(");");
 
-    env.println("int labcomm"+env.verStr+"_decoder_ioctl_" + env.prefix + getName() + "(");
+    env.println("int labcomm2006_decoder_ioctl_" + env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_decoder *d,");
+    env.println("struct labcomm2006_decoder *d,");
     env.println("int ioctl_action,");
     env.println("...");
     env.unindent();
@@ -410,24 +401,24 @@ aspect C_Declarations {
   }
 //
   public void SampleDecl.C_emitEncoderDeclaration(C_env env) {
-    env.println("int labcomm"+env.verStr+"_encoder_register_" + 
+    env.println("int labcomm2006_encoder_register_" + 
 		env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_encoder *e);");
+    env.println("struct labcomm2006_encoder *e);");
     env.unindent();
 
-    env.println("int labcomm"+env.verStr+"_encode_" + env.prefix + getName() + "(");
+    env.println("int labcomm2006_encode_" + env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_encoder *e");
+    env.println("struct labcomm2006_encoder *e");
     if(!isVoid() ) {
         env.println(", "+env.prefix + getName() + " *v");
     }
     env.unindent();
     env.println(");");
 
-    env.println("int labcomm"+env.verStr+"_encoder_ioctl_" + env.prefix + getName() + "(");
+    env.println("int labcomm2006_encoder_ioctl_" + env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_encoder *e,");
+    env.println("struct labcomm2006_encoder *e,");
     env.println("int ioctl_action,");
     env.println("...");
     env.unindent();
@@ -489,7 +480,7 @@ aspect C_Decoder {
     env = env.nestStruct("v");
     env.println("static void decode_" + env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_reader *r,");
+    env.println("struct labcomm2006_reader *r,");
     env.println("void (*handle)(");
     env.indent();
     env.println(env.prefix + getName() + " *v,");
@@ -529,10 +520,10 @@ aspect C_Decoder {
     switch (getToken()) {
       case LABCOMM_SAMPLE: { 
         env.println("labcomm_internal_decoder_index_to_signature(" +
-                    "r->decoder, labcomm"+env.verStr+"_read_int(r));");
+                    "r->decoder, labcomm2006_read_int(r));");
       } break;
       default: {
-        env.println("labcomm"+env.verStr+"_read_" + getName() + "(r);");
+        env.println("labcomm2006_read_" + getName() + "(r);");
       }; break;
     }
   }
@@ -580,7 +571,7 @@ aspect C_Decoder {
   }
 
   public void VariableSize.C_emitDecoderDecodeLimit(C_env env, int i) {
-    env.println(env.qualid + ".n_" + i + " = labcomm"+env.verStr+"_read_packed32(r);");
+    env.println(env.qualid + ".n_" + i + " = labcomm2006_read_int(r);");
   }
 
   public void ArrayType.C_emitDecoderDecodeLimit(C_env env) {
@@ -594,7 +585,7 @@ aspect C_Decoder {
 
   public void VariableArrayType.C_emitDecoderArrayAllocate(C_env env) {
     env.print(env.qualid + 
-              ".a = labcomm"+env.verStr+"_memory_alloc(r->memory, 1, sizeof(" + 
+              ".a = labcomm2006_memory_alloc(r->memory, 1, sizeof(" + 
 	      env.qualid + ".a[0])");
     for (int i = 0 ; i < getNumExp() ; i++) {
       env.print(" * " + getExp(i).C_getLimit(env, i));
@@ -612,7 +603,7 @@ aspect C_Decoder {
 
   public void PrimType.C_emitDecoderDeallocation(C_env env) {
     if (C_isDynamic()) {
-      env.println("labcomm"+env.verStr+"_memory_free(r->memory, 1, " + 
+      env.println("labcomm2006_memory_free(r->memory, 1, " + 
                   env.qualid + ");");
     }
   }
@@ -658,7 +649,7 @@ aspect C_Decoder {
 
   public void VariableArrayType.C_emitDecoderDeallocation(C_env env) {
     super.C_emitDecoderDeallocation(env);
-    env.println("labcomm"+env.verStr+"_memory_free(r->memory, 1, " + 
+    env.println("labcomm2006_memory_free(r->memory, 1, " + 
                 env.qualid + ".a);");
   }
 
@@ -676,10 +667,10 @@ aspect C_Decoder {
   }
 
   public void SampleDecl.C_emitDecoderRegisterHandler(C_env env) {
-    env.println("int labcomm"+env.verStr+"_decoder_register_" + 
+    env.println("int labcomm2006_decoder_register_" + 
 		env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_decoder *d,");
+    env.println("struct labcomm2006_decoder *d,");
     env.println("void (*handler)(");
     env.indent();
     env.println(env.prefix + getName() + " *v,");
@@ -691,12 +682,12 @@ aspect C_Decoder {
     env.println(")");
     env.println("{");
     env.indent();
-    env.println("return labcomm"+env.verStr+"_internal_decoder_register(");
+    env.println("return labcomm2006_internal_decoder_register(");
     env.indent();
     env.println("d,");
     env.println("&signature_" + env.prefix + getName() + ",");
-    env.println("(labcomm"+env.verStr+"_decoder_function)decode_" + env.prefix + getName() + ",");
-    env.println("(labcomm"+env.verStr+"_handler_function)handler,");
+    env.println("(labcomm2006_decoder_function)decode_" + env.prefix + getName() + ",");
+    env.println("(labcomm2006_handler_function)handler,");
     env.println("context");
     env.unindent();
     env.println(");");
@@ -711,10 +702,10 @@ aspect C_copy {
   private void SampleDecl.C_emitCopyFunctionParam(C_env env, String src,
 						  String dst)
   {
-    env.println("void labcomm" + env.verStr + "_copy_" +
+    env.println("void labcomm2006_copy_" +
                 env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm" + env.verStr + "_memory *mem,");
+    env.println("struct labcomm2006_memory *mem,");
     env.println(env.prefix + getName() + " *" + dst + ",");
     env.println(env.prefix + getName() + " *" + src);
     env.unindent();
@@ -765,9 +756,8 @@ aspect C_copy {
   public void PrimType.C_emitCopy(C_env env_src, C_env env_dst) {
     if (C_isDynamic()) {
       env_src.println(String.format(
-	  "%s%s = labcomm%s_memory_alloc(mem, 1, strlen(%s%s)+1);",
+	  "%s%s = labcomm2006_memory_alloc(mem, 1, strlen(%s%s)+1);",
 	  env_dst.accessor(), env_dst.qualid,
-          env_src.verStr,
 	  env_src.accessor(), env_src.qualid));
       env_src.println(String.format(
 	  "memcpy(%s%s, %s%s, strlen(%s%s)+1);",
@@ -843,8 +833,7 @@ aspect C_copy {
 							C_env env_dst)
   {
     env_src.print(env_dst.qualid + env_dst.memberAccessor() +
-                  "a = labcomm" + env_src.verStr +
-                  "_memory_alloc(mem, 1, sizeof(" +
+                  "a = labcomm2006_memory_alloc(mem, 1, sizeof(" +
 		  env_src.qualid + env_src.memberAccessor() + "a[0])");
     for (int i = 0 ; i < getNumExp() ; i++) {
       env_src.print(" * " + getExp(i).C_getLimit(env_src, i));
@@ -857,10 +846,10 @@ aspect C_copy {
   private void SampleDecl.C_emitCopyDeallocationFunctionParam(C_env env,
 							      String par)
   {
-    env.println("void labcomm" + env.verStr + "_copy_free_" +
+    env.println("void labcomm2006_copy_free_" +
                 env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm" + env.verStr + "_memory *mem,");
+    env.println("struct labcomm2006_memory *mem,");
     env.println(env.prefix + getName() + " *" + par);
     env.unindent();
     env.print(")");
@@ -907,7 +896,7 @@ aspect C_copy {
 
   public void PrimType.C_emitCopyDeallocation(C_env env) {
     if (C_isDynamic()) {
-      env.println("labcomm" + env.verStr + "_memory_free(mem, 1, " +
+      env.println("labcomm2006_memory_free(mem, 1, " +
                   env.accessor() + env.qualid + ");");
     }
   }
@@ -953,7 +942,7 @@ aspect C_copy {
 
   public void VariableArrayType.C_emitCopyDeallocation(C_env env) {
     super.C_emitCopyDeallocation(env);
-    env.println("labcomm" + env.verStr + "_memory_free(mem, 1, " +
+    env.println("labcomm2006_memory_free(mem, 1, " +
                 env.qualid + env.memberAccessor() + "a);");
   }
 
@@ -975,9 +964,9 @@ aspect C_DecoderIoctl {
   }
 
   public void SampleDecl.C_emitDecoderIoctl(C_env env) {
-    env.println("int labcomm"+env.verStr+"_decoder_ioctl_" + env.prefix + getName() + "(");
+    env.println("int labcomm2006_decoder_ioctl_" + env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_decoder *d,");
+    env.println("struct labcomm2006_decoder *d,");
     env.println("int ioctl_action,");
     env.println("...");
     env.unindent();
@@ -987,7 +976,7 @@ aspect C_DecoderIoctl {
     env.println("int result;");
     env.println("va_list va;");
     env.println("va_start(va, ioctl_action);");
-    env.println("result = labcomm"+env.verStr+"_internal_decoder_ioctl(");
+    env.println("result = labcomm2006_internal_decoder_ioctl(");
     env.indent();
     env.println("d, &signature_" + env.prefix + getName() + ", ");
     env.println("ioctl_action, va);");
@@ -1016,7 +1005,7 @@ aspect C_Encoder {
     env = env.nestStruct("(*v)");
     env.println("static int encode_" + env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_writer *w");
+    env.println("struct labcomm2006_writer *w");
     if(!isVoid() ) {
         env.println(", "+env.prefix + getName() + " *v");
     }
@@ -1031,8 +1020,8 @@ aspect C_Encoder {
     env.println("}");
 
     // Typesafe encode wrapper
-    env.println("int labcomm"+env.verStr+"_encode_" + env.prefix + getName() + "(");
-    env.println("struct labcomm"+env.verStr+"_encoder *e");
+    env.println("int labcomm2006_encode_" + env.prefix + getName() + "(");
+    env.println("struct labcomm2006_encoder *e");
     if(!isVoid() ) {
         env.println(", "+env.prefix + getName() + " *v");
     }
@@ -1040,9 +1029,9 @@ aspect C_Encoder {
     env.println(")");
     env.println("{");
     env.indent();
-    env.println("return labcomm"+env.verStr+"_internal_encode(e, &signature_" + 
+    env.println("return labcomm2006_internal_encode(e, &signature_" + 
 		env.prefix + getName() + 
-		", (labcomm"+env.verStr+"_encoder_function)encode_" + 
+		", (labcomm2006_encoder_function)encode_" + 
                 env.prefix + getName() +
 		(!isVoid()?", v":", NULL")+");");
     env.unindent();
@@ -1063,12 +1052,12 @@ aspect C_Encoder {
     env.print("result = ");
     switch (getToken()) {
       case LABCOMM_SAMPLE: { 
-        env.println("labcomm"+env.verStr+"_write_int(w, " + 
+        env.println("labcomm2006_write_int(w, " + 
                     "labcomm_internal_encoder_signature_to_index(w->encoder, " +
                     env.qualid + "));");
       } break;
       default: {
-        env.println("labcomm"+env.verStr+"_write_" + getName() + 
+        env.println("labcomm2006_write_" + getName() + 
                     "(w, " + env.qualid + ");");
       } break;
     }
@@ -1117,7 +1106,7 @@ aspect C_Encoder {
   }
 
   public void VariableSize.C_emitEncoderEncodeLimit(C_env env, int i) {
-    env.println("labcomm"+env.verStr+"_write_packed32(w, " + env.qualid + ".n_" + i + ");");
+    env.println("labcomm2006_write_int(w, " + env.qualid + ".n_" + i + ");");
   }
 
   public void ArrayType.C_emitEncoderEncodeLimit(C_env env) {
@@ -1137,19 +1126,19 @@ aspect C_Encoder {
   }
   
   public void SampleDecl.C_emitEncoderRegisterHandler(C_env env) {
-    env.println("int labcomm"+env.verStr+"_encoder_register_" + 
+    env.println("int labcomm2006_encoder_register_" + 
 		env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_encoder *e");
+    env.println("struct labcomm2006_encoder *e");
     env.unindent();
     env.println(")");
     env.println("{");
     env.indent();
-    env.println("return labcomm"+env.verStr+"_internal_encoder_register(");
+    env.println("return labcomm2006_internal_encoder_register(");
     env.indent();
     env.println("e,");
     env.println("&signature_" + env.prefix + getName() + ",");
-    env.println("(labcomm"+env.verStr+"_encoder_function)encode_" + env.prefix + getName());
+    env.println("(labcomm2006_encoder_function)encode_" + env.prefix + getName());
     env.unindent();
     env.println(");");
     env.unindent();
@@ -1170,9 +1159,9 @@ aspect C_EncoderIoctl {
   }
 
   public void SampleDecl.C_emitEncoderIoctl(C_env env) {
-    env.println("int labcomm"+env.verStr+"_encoder_ioctl_" + env.prefix + getName() + "(");
+    env.println("int labcomm2006_encoder_ioctl_" + env.prefix + getName() + "(");
     env.indent();
-    env.println("struct labcomm"+env.verStr+"_encoder *e,");
+    env.println("struct labcomm2006_encoder *e,");
     env.println("int ioctl_action,");
     env.println("...");
     env.unindent();
@@ -1182,7 +1171,7 @@ aspect C_EncoderIoctl {
     env.println("int result;");
     env.println("va_list va;");
     env.println("va_start(va, ioctl_action);");
-    env.println("result = labcomm"+env.verStr+"_internal_encoder_ioctl(");
+    env.println("result = labcomm2006_internal_encoder_ioctl(");
     env.indent();
     env.println("e, &signature_" + env.prefix + getName() + ", ");
     env.println("ioctl_action, va);");
@@ -1209,25 +1198,6 @@ aspect C_Signature {
 
   public void Decl.C_emitSignature(C_env env) {
     C_emitFlatSignature(env);
-//
-//  if( false && (isReferenced() || isSampleDecl())){ 
-//    Signature signature = getSignature();
-//    signature.C_emitSignature(env, !isSampleDecl());
-//  } else {
-//    env.println("// not emitting signature for "+getName()+isReferenced()+isSampleDecl());  
-//  }
-//  if(env.versionHasMetaData()) { 
-//    if(isReferenced() || isSampleDecl()){
-//        env.println("(int (*)(void *))labcomm"+env.verStr+"_signature_" + 
-//	 	env.prefix + getName() + "_emit_signature");
-//    } else {
-//        env.println("NULL");  // HERE BE DRAGONS! Is it worth the size saving to skip emitting the emit_signature function for unused types?
-//                              //                  The code won't likely end up in a target system anyway?
-//    }
-//  }
-//  env.unindent();
-//  env.println(" };");
-//
   }
 
   public void ASTNode.C_emitFlatSignature(C_env env) {
@@ -1242,13 +1212,13 @@ aspect C_Signature {
   public void SampleDecl.C_emitFlatSignature(C_env env){
     env.println("static unsigned char signature_bytes_" + 
   	        env.prefix + getName() + "[] = {");
-    SignatureList signature = flatSignature(env.version);
+    SignatureList signature = flatSignature(2006);
     for (int i = 0 ; i < signature.size() ; i++) {
       String comment = signature.getComment(i);
       if (comment != null) {
         env.println(signature.getIndent(i) + "// " + comment);
       }
-      byte[] data = signature.getData(i, env.version);
+      byte[] data = signature.getData(i, 2006);
       if (data != null) {
         env.print(signature.getIndent(i));
         for (int j = 0 ; j < data.length ; j++) {
@@ -1260,7 +1230,7 @@ aspect C_Signature {
     env.println("};");
 
     C_emitSizeofValue(env);
-    env.println("static struct labcomm"+env.verStr+"_signature " +
+    env.println("static struct labcomm2006_signature " +
                 "signature_" + env.prefix + getName() + " = {");
     env.indent();
     env.println("\"" + getName() + "\",");
@@ -1270,105 +1240,13 @@ aspect C_Signature {
     env.println("0");
     env.unindent();
     env.println(" };");
-    env.println("const struct labcomm"+env.verStr+"_signature " +
-                "*labcomm"+env.verStr+"_signature_" + env.prefix + getName() + 
+    env.println("const struct labcomm2006_signature " +
+                "*labcomm2006_signature_" + env.prefix + getName() + 
                 " = &signature_" + env.prefix + getName() + ";");
   }
 
-    public void Signature.C_emitSignature(C_env env, boolean decl){
-      getSignatureList().C_emitSignature(env, decl);
-    }
-
-    public abstract void SignatureLine.C_emitSignature(C_env env, boolean decl);
-
-    public void TypeRefSignatureLine.C_emitSignature(C_env env, boolean isDecl){ 
-      //env.print(getIndentString());
-      //env.println("LABCOMM_SIGDEF_SIGNATURE(labcomm"+env.verStr+"_signature_" + env.prefix + decl.getName() +"),");
-    }
-
-    public void DataSignatureLine.C_emitSignature(C_env env, boolean decl){ 
-       //   String comment = getComment();
-       //   if (comment != null && comment.length() > 0) {
-       //     env.println(getIndentString() + "// " + comment);
-       //   }
-       //   byte[] data = getData(env.version);
-       //   if (data != null && data.length > 0) {
-       //     env.print(getIndentString());
-       //     env.print("LABCOMM_SIGDEF_BYTES("+data.length+", \"");
-       //     for (int j = 0 ; j < data.length ; j++) {
-       //       byte d = data[j];
-       //       //if(d>='a'&&d<='z' || d>='A'&&d<='Z'|| d>='0'&&d<='9'  )
-       //       //  env.print(""+(char)d);
-       //       //else
-       //       env.print("\\x"+Integer.toHexString(d));
-       //     }
-       //     env.println("\"),");
-       // }
-    }
-//
-//
-//      byte[] data = getData(env.version);
-//        if (data != null) {
-//            for (int j = 0 ; j < data.length ; j++) {
-//                env.print(getIndentString());
-//                //env.print("printf(\"labcomm"+env.verStr+"_write_byte( w, (unsigned char)"+ String.format("0x%02X ", data[j]) +")\\n\"); ");
-//                env.print("labcomm"+env.verStr+"_write_byte( w, (unsigned char)"+ String.format("0x%02X ", data[j]) +"); ");
-//                env.println("if (result != 0) { return result; }");
-//            }
-//            env.println();
-//        }
-//
-//}
-  public void SignatureList.C_emitSignature(C_env env, boolean decl) { 
-//  env.println("static struct labcomm_signature_data signature_tree_" + 
-//  	 env.prefix + parentDecl().getName() + "[] = {");
-//  env.indent();
-//  for (int i = 0 ; i < size() ; i++) {
-//    SignatureLine l = getSignatureLine(i);
-//    l.C_emitSignature(env, decl);
-//  }
-//  
-//  env.println("LABCOMM_SIGDEF_END");
-//  env.println("};");
-//  env.unindent();
-//  env.println();
-  }
-
-
-
-//  public void SampleDecl.C_emitSignature(C_env env) {
-//    env.println("static unsigned char signature_bytes_" + 
-//		       env.prefix + getName() + "[] = {");
-//    SignatureList signature = signature(env.version);
-//    for (int i = 0 ; i < signature.size() ; i++) {
-//      String comment = signature.getComment(i);
-//      if (comment != null) {
-//        env.println(signature.getIndent(i) + "// " + comment);
-//      }
-//      byte[] data = signature.getData(i);
-//      if (data != null) {
-//        env.print(signature.getIndent(i));
-//        for (int j = 0 ; j < data.length ; j++) {
-//          env.print(data[j] + ", ");
-//        }
-//        env.println("");
-//      }
-//    }
-//    env.println("};");
-//    env.println("struct labcomm"+env.verStr+"_signature labcomm"+env.verStr+"_signature_" + 
-//		env.prefix + getName() + " = {");
-//    env.indent();
-//    env.println("LABCOMM_SAMPLE, \"" + getName() + "\",");
-//    env.println("(int (*)(struct labcomm"+env.verStr+"_signature *, void *))labcomm"+env.verStr+"_sizeof_" + 
-//		env.prefix + getName() + ",");
-//    env.println("sizeof(signature_bytes_" + env.prefix + getName() + "),");
-//    env.println("signature_bytes_" + env.prefix + getName() + ",");
-//    env.println("0");
-//    env.unindent();
-//    env.println(" };");
-//  }
-
 }
+
 aspect C_Constructor {
   public void ASTNode.C_emitConstructor(C_env env) {
     throw new Error(this.getClass().getName() + 
@@ -1396,9 +1274,9 @@ aspect C_Constructor {
 
   public void Decl.C_emitConstructor(C_env env) {
   }
-//XXX
+
   public void SampleDecl.C_emitConstructor(C_env env) {
-    env.println("labcomm"+env.verStr+"_set_local_index(&signature_" + 
+    env.println("labcomm2006_set_local_index(&signature_" + 
 		env.prefix + getName() + ");");
   }
 
@@ -1420,7 +1298,7 @@ aspect C_Sizeof {
   }
 
   public void SampleDecl.C_emitSizeofDeclaration(C_env env) {
-    env.println("extern int labcomm"+env.verStr+"_sizeof_" + env.prefix + getName() +
+    env.println("extern int labcomm2006_sizeof_" + env.prefix + getName() +
         "(" + env.prefix + getName() + " *v);");
   }
 
@@ -1433,11 +1311,11 @@ aspect C_Sizeof {
 
   public void SampleDecl.C_emitSizeof(C_env env) {
     env = env.nestStruct("(*v)");
-    env.println("int labcomm"+env.verStr+"_sizeof_" + env.prefix + getName() +
+    env.println("int labcomm2006_sizeof_" + env.prefix + getName() +
         "(" + env.prefix + getName() + " *v)");
     env.println("{");
     env.indent();
-    env.println("return labcomm"+env.verStr+"_internal_sizeof(" +
+    env.println("return labcomm2006_internal_sizeof(" +
                 "&signature_" + env.prefix + getName() +
                 ", v);");
     env.unindent();
@@ -1523,7 +1401,7 @@ aspect C_Sizeof {
     switch (getToken()) {
       case LABCOMM_STRING: { 
         env.print("{ int l = strlen(" + env.qualid + "); ");
-    env.println("result += labcomm"+env.verStr+"_size_packed32(l) + l; }"); 
+        env.println("result += 4 + l; }"); 
       } break;
       default: { 
     throw new Error(this.getClass().getName() + 
@@ -1556,8 +1434,7 @@ aspect C_Sizeof {
   }
 
   public void VariableSize.C_emitSizeof(C_env env, int i) {
-    env.println("result += labcomm"+env.verStr+"_size_packed32(" + 
-                env.qualid + env.memberAccessor() + "n_" + i + ");");
+    env.println("result += 4;");
   }
 
   public void ArrayType.C_emitSizeof(C_env env) {
@@ -1627,8 +1504,8 @@ aspect C_forAll {
 
 aspect C_Info {
 
-  public void Program.C_info(PrintStream out, String prefix, int version) {
-    C_env env = new C_env("", "", prefix, out, version);
+  public void Program.C_info(PrintStream out, String prefix) {
+    C_env env = new C_env("", "", prefix, out);
     for (int i = 0; i < getNumDecl(); i++) {
       getDecl(i).C_info(env);
     }
diff --git a/compiler/2006/Java_CodeGen.jrag b/compiler/2006/Java_CodeGen.jrag
index 0a1ac1f249d033e802b9a6fd9d4d2d6ddeae0fa1..615cff35e5b31459342ff20d1d6fd1ff26b070c3 100644
--- a/compiler/2006/Java_CodeGen.jrag
+++ b/compiler/2006/Java_CodeGen.jrag
@@ -8,8 +8,6 @@ aspect Java_CodeGenEnv {
 
   public class Java_env {
 
-    public final int version;  //labcomm version to generate code for
-    public final String verStr;
     private int indent;
     private int depth;
     private Java_printer printer;
@@ -77,24 +75,22 @@ aspect Java_CodeGenEnv {
       }
     }
 
-    private Java_env(int version, int indent) {
-      this.version = version;
-      this.verStr = LabCommVersion.versionString(version);
+    private Java_env(int indent) {
       this.indent = indent;
     }
 
-    private Java_env(int version, Java_printer printer) {
-      this(version, 0);
+    private Java_env(Java_printer printer) {
+      this(0);
       this.printer = printer;
     }
 
-    public Java_env(int version, File f) {
-      this(version, 0);
+    public Java_env(File f) {
+      this(0);
       this.printer = new Java_printer(f);
     }
 
-    public Java_env(int version, PrintStream out) {
-      this(version, 0);
+    public Java_env(PrintStream out) {
+      this(0);
       this.printer = new Java_printer(out);
     }
 
@@ -204,9 +200,9 @@ aspect Java_Void {
 
 aspect Java_CodeGen {
 
-  public void Program.J_gen(PrintStream ps, String pack, int version) throws IOException {
+  public void Program.J_gen(PrintStream ps, String pack) throws IOException {
     Java_env env;
-    env = new Java_env(version, ps);
+    env = new Java_env(ps);
     for (int i = 0; i < getNumDecl(); i++) {
       Decl d = getDecl(i);
       try {
@@ -219,12 +215,12 @@ aspect Java_CodeGen {
     env.close();
   }
 
-  public void Program.J_gen(String dir, String pack, int version) throws IOException {
+  public void Program.J_gen(String dir, String pack) throws IOException {
     Java_env env;
     for (int i = 0; i < getNumDecl(); i++) {
       Decl d = getDecl(i);
       try {
-        env = new Java_env(version, new File(dir, d.getName() + ".java"));
+        env = new Java_env(new File(dir, d.getName() + ".java"));
         d.Java_emitClass(env, pack);
         env.close();
       } catch (Error e) {
@@ -236,14 +232,14 @@ aspect Java_CodeGen {
 
   /** Experimental method for generating code to a map <classname, source>
     */
-  public void Program.J_gen(Map<String,String> src, String pack, int version) throws IOException {
+  public void Program.J_gen(Map<String,String> src, String pack) throws IOException {
     Java_env env;
     for (int i = 0; i < getNumDecl(); i++) {
       Decl d = getDecl(i);
       try {
         ByteArrayOutputStream bs = new ByteArrayOutputStream();
         PrintStream out = new PrintStream(bs);
-        env = new Java_env(version, out);
+        env = new Java_env(out);
         d.Java_emitClass(env, pack);
         env.close();
         src.put(d.getName(), bs.toString());
@@ -276,20 +272,6 @@ aspect Java_Class {
   }
 
   public void Decl.Java_emitUserTypeDeps(Java_env env, String via, boolean outputCode) {
-  // XXX TODO will generate unnecessary recursion for types. fix this per commented out code
-  // XXX      but ensure that types with references actually register themselves.. (i.e., add "nested" argument)
-  //public abstract void Decl.Java_emitUserTypeDeps(Java_env env, String via, boolean outputCode);
-
-  //public void TypeDecl.Java_emitUserTypeDeps(Java_env env, String via, boolean outputCode) {
-  //  // do nothing for type decls; sampledecl iterates over all dependencies and outputs
-  //  // all type decls
-  //}
-  //public void SampleDecl.Java_emitUserTypeDeps(Java_env env, String via, boolean outputCode) {
-//  if(env.versionHasMetaData() && hasDependencies() || isReferenced() ) {
-//      if(env.versionHasMetaData() && isSampleDecl() && outputCode) {
-//         env.println("if(sendMetaData){");
-//         env.indent();
-//      }
         Iterator<Decl> it = type_dependencies().iterator();
         while(it.hasNext()) {
             Decl t = it.next();
@@ -302,13 +284,9 @@ aspect Java_Class {
 	       env.println(" //Depends ("+refpath+") on "+t.getName() );
             }
         }
-//      if(env.versionHasMetaData() && isSampleDecl() && outputCode) {
-//         env.unindent();
-//         env.println("}");
-//      }
-//  }
   }
-  public void Decl.Java_emitUserTypeRefs(Java_env env, String via, boolean outputCode) {
+
+public void Decl.Java_emitUserTypeRefs(Java_env env, String via, boolean outputCode) {
     if( isReferenced() ) {
         Iterator<Decl> it = type_references().iterator();
         while(it.hasNext()) {
@@ -348,19 +326,15 @@ aspect Java_Class {
           env.println("package " + pack + ";");
       }
 
-      env.println("import se.lth.control.labcomm"+env.verStr+".Constant;");
-      env.println("import se.lth.control.labcomm"+env.verStr+".SampleType;");
+      env.println("import se.lth.control.labcomm2006.Constant;");
+      env.println("import se.lth.control.labcomm2006.SampleType;");
 
       if (getType().Java_needInstance() || hasDependencies() || isReferenced()) {
-          env.println("import se.lth.control.labcomm"+env.verStr+".Encoder;");
-          env.println("import se.lth.control.labcomm"+env.verStr+".SampleDispatcher;");
-          env.println("import se.lth.control.labcomm"+env.verStr+".SampleHandler;");
-//          env.println();
-//      }
-//
-//      if (getType().Java_needInstance()) {
+          env.println("import se.lth.control.labcomm2006.Encoder;");
+          env.println("import se.lth.control.labcomm2006.SampleDispatcher;");
+          env.println("import se.lth.control.labcomm2006.SampleHandler;");
           env.println("import java.io.IOException;");
-          env.println("import se.lth.control.labcomm"+env.verStr+".Decoder;");
+          env.println("import se.lth.control.labcomm2006.Decoder;");
       }
       // For types without type_dependencies and not needing an instance,
       // currently just an empty class is generated
@@ -397,21 +371,14 @@ aspect Java_Class {
     }
 
     env.println("import java.io.IOException;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".Constant;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".Decoder;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".SampleDispatcher;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".Encoder;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".SampleHandler;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".Sample;");
+    env.println("import se.lth.control.labcomm2006.Constant;");
+    env.println("import se.lth.control.labcomm2006.Decoder;");
+    env.println("import se.lth.control.labcomm2006.SampleDispatcher;");
+    env.println("import se.lth.control.labcomm2006.Encoder;");
+    env.println("import se.lth.control.labcomm2006.SampleHandler;");
+    env.println("import se.lth.control.labcomm2006.Sample;");
     env.println();
     env.print("public class " + getName());
-//  TODO: ?
-//  Code for making samples of user types extend their type
-//  currently commented out. Is this a good idea or not?
-//
-//    if(getType().isUserType()) {
-//        env.print(" extends "+getType().getTypeName());
-//    }
     env.println(" implements Sample {");
     env.println();
     env.indent();
@@ -464,13 +431,13 @@ aspect Java_Class {
   public void Decl.Java_emitFlatSignature(Java_env env){
     env.println("private static byte[] signature = new byte[] {");
       env.indent();
-      SignatureList signature = flatSignature(env.version);
+      SignatureList signature = flatSignature(2006);
       for (int i = 0 ; i < signature.size() ; i++) {
         String comment = signature.getComment(i);
         if (comment != null) {
           env.println(signature.getIndent(i) + "// " + comment);
         }
-        byte[] data = signature.getData(i, env.version);
+        byte[] data = signature.getData(i, 2006);
         if (data != null) {
           env.print(signature.getIndent(i));
           for (int j = 0 ; j < data.length ; j++) {
@@ -487,7 +454,7 @@ aspect Java_Class {
 
   //XXX TODO: refactor: split into a static class ("TypeDefSingleton"?)and a (smaller) dispatcher
   public void Decl.Java_emitDispatcher(Java_env env, boolean isSample) {
-    String genericStr = ""; //env.versionHasMetaData()?"<"+getName()+">":""; 
+    String genericStr = "";
     env.println("private static Dispatcher dispatcher = new Dispatcher();");
     env.println();
     env.println("public SampleDispatcher getDispatcher() {");
@@ -513,18 +480,10 @@ aspect Java_Class {
     env.println();
     env.println("public byte getTypeDeclTag() {");
     env.indent();
-    if(env.version == 2006) {
-      if(isSample) {
-        env.println("return Constant.SAMPLE;");
-      } else {
-        env.println("return Constant.TYPEDEF;");
-      }
+    if(isSample) {
+      env.println("return Constant.SAMPLE;");
     } else {
-      if(isSample) {
-        env.println("return Constant.SAMPLE_DEF;");
-      } else {
-        env.println("return Constant.TYPE_DEF;");
-      }
+      env.println("return Constant.TYPEDEF;");
     }
     env.unindent();
     env.println("}");
@@ -534,11 +493,6 @@ aspect Java_Class {
     env.println("return "+isSample+";");
     env.unindent();
     env.println("}");
-//    env.println("public boolean hasStaticSignature() {");
-//    env.indent();
-//    env.println("return "+!hasDependencies()+";");
-//    env.unindent();
-//    env.println("}");
     env.println();
     env.println("/** return the flat signature. */");
     env.println("public byte[] getSignature() {");
@@ -547,21 +501,6 @@ aspect Java_Class {
     env.unindent();
     env.println("}");
     env.println();
-//    env.println("public void encodeSignature(Encoder e) throws IOException{");
-//    env.indent();
-//    env.println("emitSignature(e);");
-//    env.unindent();
-//    env.println("}");
-//    env.println();
-//    env.println("public void encodeSignatureMetadata(Encoder e, int index) throws IOException{");
-//    env.indent();
-//    env.println("e.encodePacked32(Constant.TYPE_DEF);");
-//    env.println("e.encodePacked32(index);");
-//    env.println("e.encodeString(getName());");
-//    env.println("emitSignature(e);");
-//    env.unindent();
-//    env.println("}");
-//    env.println();
     env.println("public boolean canDecodeAndHandle() {");
     env.indent();
     env.println("return "+isSample+";");
@@ -677,7 +616,7 @@ aspect Java_Class {
   }
 
   public String VariableSize.Java_emitEncoder(Java_env env, String name) {
-    env.println("e.encodePacked32(" + name + ".length);");
+    env.println("e.encodeInt(" + name + ".length);");
     return name + ".length";
   }
 
@@ -770,7 +709,7 @@ aspect Java_Class {
   }
 
   public void VariableSize.Java_emitDecoder(Java_env env) {
-    env.print("d.decodePacked32()");
+    env.print("d.decodeInt()");
   }
 
   public void StructType.Java_emitDecoder(Java_env env, String name) {
@@ -966,8 +905,6 @@ aspect Java_Class {
 
 aspect Java_Signature {
     public void Signature.Java_emitSignature(Java_env env, boolean decl){
-      // XXX should sendOnlyFlatSignatures be kept somewhere?
-      //SignatureList sl = (parentDecl().sendOnlyFlatSignatures(env)) ? getFlatSignatureList() : getSignatureList();
       SignatureList sl = getSignatureList();
       sl.Java_emitSignature(env, decl);
     }
@@ -981,11 +918,11 @@ aspect Java_Signature {
 
     public void TypeRefSignatureLine.Java_emitSignature(Java_env env, boolean isDecl){
       env.print(getIndentString());
-      env.println("e.encodePacked32(e.getTypeId("+decl.getName()+".class));");
+      env.println("e.encodeInt(e.getTypeId("+decl.getName()+".class));");
     }
 
     public void DataSignatureLine.Java_emitSignature(Java_env env, boolean decl){
-        byte[] data = getData(env.version);
+        byte[] data = getData(2006);
           if (data != null) {
               env.print(getIndentString());
               for (int j = 0 ; j < data.length ; j++) {
@@ -1014,8 +951,8 @@ aspect Java_Signature {
 
 aspect Java_Info {
 
-  public void Program.Java_info(PrintStream out, int version) {
-    Java_env env = new Java_env(version, out);
+  public void Program.Java_info(PrintStream out) {
+    Java_env env = new Java_env(out);
     for (int i = 0; i < getNumDecl(); i++) {
       getDecl(i).Java_info(env);
     }
diff --git a/compiler/2006/LabComm.java b/compiler/2006/LabComm.java
index 04ade9783bdf57f3bdc7ef4b5f37ed765ac24354..8ec9d1e9bbdc7a09e530aa9d9858c86a62e353d0 100644
--- a/compiler/2006/LabComm.java
+++ b/compiler/2006/LabComm.java
@@ -14,7 +14,6 @@ public class LabComm {
     println("");
     println(" --help                  Shows this help text");
     println(" -v                      Be verbose");
-    println(" --ver=VERSION           Generate code for labcomm VERSION (=2006 or 2013)");
     println("[ C options ]");
     println(" -C                      Generates C/H code in FILE.[ch]");
     println(" --cprefix=PREFIX        Prefixes C types with PREFIX");
@@ -38,25 +37,15 @@ public class LabComm {
     println(" --typeinfo=TIFILE       Generates typeinfo in TIFILE");
   }
     
-  /** To be cleaned up.
-   */
-  private static void checkVersion(int v) {
-     if(! (v == 2006 || v == 2013) ) {
-	System.err.println(" Unknown version: " + v);
-	System.err.println(" Supported versions: 2006, 2013 ");
-	System.exit(2);
-     }
-  }
-
   private static void genH(Program p, String hName, 
-			   Vector cIncludes, String coreName, String prefix, int ver) {
+			   Vector cIncludes, String coreName, String prefix) {
     try {
       FileOutputStream f;
       PrintStream out;
       
       f = new FileOutputStream(hName);
       out = new PrintStream(f);
-      p.C_genH(out, cIncludes, coreName, prefix, ver);
+      p.C_genH(out, cIncludes, coreName, prefix);
       out.close();
     } catch (IOException e) {
       System.err.println("IOException: " + hName + " " + e);
@@ -64,56 +53,56 @@ public class LabComm {
   }
 
   private static void genC(Program p, String cName, 
-			   Vector cIncludes, String coreName, String prefix, int ver) {
+			   Vector cIncludes, String coreName, String prefix) {
     try {
       FileOutputStream f;
       PrintStream out;
 
       f = new FileOutputStream(cName);
       out = new PrintStream(f);
-      p.C_genC(out, cIncludes, coreName, prefix, ver);
+      p.C_genC(out, cIncludes, coreName, prefix);
       out.close();
     } catch (IOException e) {
       System.err.println("IOException: " + cName + " " + e);
     }
   }
 
-  private static void genCS(Program p, String csName, String csNamespace, int ver) {
+  private static void genCS(Program p, String csName, String csNamespace) {
 //      throw new Error("C# generation currently disabled");
     try {
-      p.CS_gen(csName, csNamespace, ver);
+      p.CS_gen(csName, csNamespace);
     } catch (IOException e) {
       System.err.println("IOException: " + csName + " " + 
 			 csNamespace + " " + e);
     }
   }
 
-  private static void genJava(Program p,  String dirName, String packageName, int ver) {
+  private static void genJava(Program p,  String dirName, String packageName) {
     try {
-      p.J_gen(dirName, packageName, ver);
+      p.J_gen(dirName, packageName);
     } catch (IOException e) {
       System.err.println("IOException: " + dirName + " " + 
 			 packageName + " " + e);
     }
   }
 
-  private static void genPython(Program p, String filename, String prefix, int ver) {
+  private static void genPython(Program p, String filename, String prefix) {
     try {
       FileOutputStream f;
       PrintStream out;
 
       f = new FileOutputStream(filename);
       out = new PrintStream(f);
-      p.Python_gen(out, prefix, ver);
+      p.Python_gen(out, prefix);
       out.close();
     } catch (IOException e) {
       System.err.println("IOException: " + filename + " " + e);
     }
   }
 
-  private static void genRAPID(Program p, String filename, String prefix, int ver) {
+  private static void genRAPID(Program p, String filename, String prefix) {
     try {
-      p.RAPID_gen(filename, prefix, ver);
+      p.RAPID_gen(filename, prefix);
     } catch (IOException e) {
       System.err.println("IOException: " + filename + " " + e);
     }
@@ -127,7 +116,6 @@ public class LabComm {
     String coreName = null;
     String prefix = null;
     boolean verbose = false;
-    int ver = 2006; // Version 2006 fixed
     String cFile = null;
     String hFile = null;
     Vector cIncludes = new Vector();
@@ -191,9 +179,6 @@ public class LabComm {
   	System.exit(0);
         } else if (args[i].equals("-v")) {
   	verbose=true;
-        } else if (args[i].startsWith("--ver=")) {
-          /* ver = Integer.parseInt(args[i].substring(6));
-             checkVersion(ver); */
         } else if (args[i].equals("-C")) {
   	cFile = coreName + ".c";
   	hFile = coreName + ".h";
@@ -276,12 +261,12 @@ public class LabComm {
      }
      if (cFile != null) {
        printStatus("C: " , cFile);
-       genC(ast, cFile, cIncludes, coreName, cPrefix, ver);
+       genC(ast, cFile, cIncludes, coreName, cPrefix);
        wroteFile = true;
      }
      if (hFile != null) {
        printStatus("H: " , hFile);
-       genH(ast, hFile, hIncludes, coreName, cPrefix, ver);
+       genH(ast, hFile, hIncludes, coreName, cPrefix);
        wroteFile = true;
      }
      return wroteFile;
@@ -291,7 +276,7 @@ public class LabComm {
      boolean wroteFile = false; 
      if (csFile != null) {
        printStatus("C#: " , csFile); 
-       genCS(ast, csFile, csNamespace, ver);
+       genCS(ast, csFile, csNamespace);
        wroteFile = true;
      }
      return wroteFile;
@@ -301,7 +286,7 @@ public class LabComm {
      boolean wroteFile = false; 
      if (javaDir != null) {
        printStatus("Java: " , javaDir);
-       genJava(ast, javaDir, javaPackage, ver);
+       genJava(ast, javaDir, javaPackage);
        wroteFile = true;
      }
      return wroteFile;
@@ -311,7 +296,7 @@ public class LabComm {
      boolean wroteFile = false; 
      if (pythonFile != null) {
        printStatus("Python: " , pythonFile); 
-       genPython(ast, pythonFile, prefix, ver);
+       genPython(ast, pythonFile, prefix);
        wroteFile = true;
      }
      return wroteFile;
@@ -321,7 +306,7 @@ public class LabComm {
      boolean wroteFile = false; 
      if (rapidFile != null) {
        printStatus("RAPID: " , rapidFile);
-       genRAPID(ast, rapidFile, coreName, ver);
+       genRAPID(ast, rapidFile, coreName);
        wroteFile = true;
      }
      return wroteFile;
@@ -350,9 +335,9 @@ public class LabComm {
        try {
          FileOutputStream f = new FileOutputStream(typeinfoFile);
          PrintStream out = new PrintStream(f);
-         ast.C_info(out, cPrefix, ver);
-         ast.Java_info(out, ver);
-         ast.CS_info(out, csNamespace, ver);
+         ast.C_info(out, cPrefix);
+         ast.Java_info(out);
+         ast.CS_info(out, csNamespace);
          wroteFile = true;
        } catch (IOException e) {
          System.err.println("IOException: " + typeinfoFile + " " + e);
diff --git a/compiler/2006/Python_CodeGen.jrag b/compiler/2006/Python_CodeGen.jrag
index 17203b88ea5c2c0e833c791f4036189f16bf8b46..9d68bd30090536129f9cc3b7d1b6345deaefa29c 100644
--- a/compiler/2006/Python_CodeGen.jrag
+++ b/compiler/2006/Python_CodeGen.jrag
@@ -72,10 +72,7 @@ aspect Python_CodeGenEnv {
 
 aspect Python_CodeGen {
 
-  public void Program.Python_gen(PrintStream out, String baseName, int version) {
-    // Remove when Blomdell has verified that it is OK to ignore version
-    // when generating python code. 
-    System.err.println("*** Warning! Python_gen ignores version: "+version);
+  public void Program.Python_gen(PrintStream out, String baseName) {
     Python_env env = new Python_env(out);
     env.println("#!/usr/bin/python");
     env.println("# Auto generated " + baseName);
@@ -84,20 +81,13 @@ aspect Python_CodeGen {
     env.println("import StringIO");
     env.println();
     Python_genTypes(env);
-    //env.println("typedef = [");
-    //env.indent();
-    //for (int i = 0 ; i < getNumDecl() ; i++) {
-    //  getDecl(i).Python_genTypedefListEntry(env);
-    //}
-    //env.unindent();
-    //env.println("]");
-    env.println("sample = [");
+    env.println("sample = tuple([");
     env.indent();
     for (int i = 0 ; i < getNumDecl() ; i++) {
       getDecl(i).Python_genSampleListEntry(env);
     }
     env.unindent();
-    env.println("]");
+    env.println("])");
   }
 
 }
@@ -117,17 +107,6 @@ aspect PythonTypes {
   }
 
   public void TypeDecl.Python_genSignature(Python_env env) {
-/*
-    env.println("class " + getName() + "(object):");
-    env.indent();
-    env.println("signature = labcomm.typedef('" + getName() + "',");
-    env.indent();
-    getType().Python_genSignature(env);
-    env.unindent();
-    env.println(")");
-    env.unindent();
-    env.println();
-*/
   }
 
   public void SampleDecl.Python_genSignature(Python_env env) {
@@ -200,18 +179,11 @@ aspect PythonTypes {
     env.print(")");
   }
 
-  public void Decl.Python_genTypedefListEntry(Python_env env) {
-  }
-
-  public void TypeDecl.Python_genTypedefListEntry(Python_env env) {
-    env.println("('" + getName() + "', " + getName() + ".signature),");
-  }
-
   public void Decl.Python_genSampleListEntry(Python_env env) {
   }
 
   public void SampleDecl.Python_genSampleListEntry(Python_env env) {
-    env.println("('" + getName() + "', " + getName() + ".signature),");
+    env.println(getName() + ",");
   }
 
   public String Exp.Python_getValue() {
diff --git a/compiler/2006/RAPID_CodeGen.jrag b/compiler/2006/RAPID_CodeGen.jrag
index b367ee5720eb34ff4cd308cd4eeab56a6d1002cd..a2029b7373eab34d89406957d9f64e5c852f97fa 100644
--- a/compiler/2006/RAPID_CodeGen.jrag
+++ b/compiler/2006/RAPID_CodeGen.jrag
@@ -1,16 +1,14 @@
 
 aspect RAPID_env {
 	public class RAPID_env {
-                public final int version;
 		private String prefix;
 		private StringBuilder types;
 		private StringBuilder constants;
 		private StringBuilder procedures;
 		private PrintStream ps;
 
-		public RAPID_env(PrintStream ps, String prefix, int version)
+		public RAPID_env(PrintStream ps, String prefix)
 		{
-			this.version = version;
 			this.types = new StringBuilder();
 			this.constants = new StringBuilder();
 			this.procedures = new StringBuilder();
@@ -77,11 +75,11 @@ aspect RAPID_CodeGen {
 		throw new UnsupportedOperationException();
 	}
 
-	public void Program.RAPID_gen(String file, String prefix, int version)
+	public void Program.RAPID_gen(String file, String prefix)
 			throws IOException
 	{
 		PrintStream ps = new PrintStream(new FileOutputStream(new File(file)));
-		RAPID_env env = new RAPID_env(ps, prefix, version);
+		RAPID_env env = new RAPID_env(ps, prefix);
 		RAPID_gen(env);
 	}
 
@@ -105,13 +103,13 @@ aspect RAPID_CodeGen {
 	public void Decl.RAPID_emitFlatSignature(RAPID_env env, String sig_len_name, String sig_name) {
 		System.out.println("***WARNING! Code not tested after reorganization of signatures.");
 		System.out.println("            (Tell a developer to) remove this warning when tested");
-		SignatureList sig = flatSignature(env.version);
+		SignatureList sig = flatSignature(2006);
 		StringBuilder sb = new StringBuilder();
 		sb.append("[");
 		byte[] d = null;
 		int sig_len = 0;
 		for (int i = 0; i < sig.size(); i++) {
-			d = sig.getData(i, env.version);
+			d = sig.getData(i, 2006);
 			for (int j = 0; d != null && j < d.length; j++) {
 				sb.append(d[j] + ",");
 				sig_len++;
diff --git a/compiler/2006/Signature.jrag b/compiler/2006/Signature.jrag
index 5395095487bde26c2df7a19b0ea4f452144995d9..e1be9993ec152a4079170ecbad10befd2074a3c6 100644
--- a/compiler/2006/Signature.jrag
+++ b/compiler/2006/Signature.jrag
@@ -6,8 +6,6 @@ aspect Signature {
   eq TypeDecl.isSampleDecl() = false;
   eq SampleDecl.isSampleDecl() = true;
 
-  syn boolean Decl.sendOnlyFlatSignatures(Java_env env) = (env.version==2006);
-
   eq Decl.getSignature().parentDecl() = this;
   eq Signature.getSignatureList().parentDecl() = parentDecl();
 
diff --git a/compiler/2014/ArrayTypeRewrite.jrag b/compiler/2014/ArrayTypeRewrite.jrag
deleted file mode 100644
index 28e3c79f4fa93b7ac6aeb3ec4da3174472080d87..0000000000000000000000000000000000000000
--- a/compiler/2014/ArrayTypeRewrite.jrag
+++ /dev/null
@@ -1,43 +0,0 @@
-aspect ArrayRewrite {
-
-  syn boolean Dim.isVariable() {
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      if (getExp(i) instanceof VariableSize) {
-	return true;
-      }	
-    }
-    return false;
-  }
-
-  rewrite ParseArrayType {
-    when (! getDim(0).isVariable()) 
-    to FixedArrayType  { 
-      if (getNumDim() == 1) {
-        return new FixedArrayType(getType(), 
-				  getDim(0).getExpList());
-      } else {
-        List l = new List();
-        for (int i = 1 ; i < getNumDim() ; i++) {
-	  l.add(getDim(i));
-        }
-        return new FixedArrayType(new ParseArrayType(getType(), l), 
-				  getDim(0).getExpList());
-      }
-    }
-    when (getDim(0).isVariable()) 
-    to VariableArrayType  { 
-      if (getNumDim() == 1) {
-        return new VariableArrayType(getType(), 
-				     getDim(0).getExpList());
-      } else {
-        List l = new List();
-        for (int i = 1 ; i < getNumDim() ; i++) {
-	  l.add(getDim(i));
-        }
-        return new VariableArrayType(new ParseArrayType(getType(), l), 
-				     getDim(0).getExpList());
-      }
-    }
-  }
-
-}
diff --git a/compiler/2014/CS_CodeGen.jrag b/compiler/2014/CS_CodeGen.jrag
deleted file mode 100644
index e1da497f2601fa68727e527a94e6f90287e804df..0000000000000000000000000000000000000000
--- a/compiler/2014/CS_CodeGen.jrag
+++ /dev/null
@@ -1,971 +0,0 @@
-import java.io.*;
-import java.util.*;
-
-aspect CS_CodeGenEnv {
-
-  // Environment wrapper for CS-code generation
-  // handles indentation, file writing, 
-
-  public class CS_env {
-
-    public final int version;
-    public final String verStr;
-    private int indent;
-    private int depth;
-    private CS_printer printer;
-    private HashMap unique = new HashMap();
-
-    final private static class CS_printer {
-      
-      private boolean newline = true;
-      private File file;
-      private PrintStream out;
-      private IOException exception;
-      
-
-      public CS_printer(File f) {
-  	file = f;
-        File parentFile = f.getParentFile();
-        if(parentFile != null) {
-            parentFile.mkdirs();
-        }
-      }
-
-     public CS_printer(PrintStream out) {
-        this.out = out;
-      }
-
-      public void close() throws IOException {
-	if (out != null) {
-  	  out.close();
-        }
-	if (exception != null) {
-	  throw exception;
-        }
-      }
-
-      public PrintStream getPrintStream() {
-	return(out);
-      }
-
-      public void checkOpen() {
-	if (out == null && exception == null) {
-          try {
-    	    out = new PrintStream(new FileOutputStream(file));
-          } catch (IOException e) {
-	    exception = e;
-          }
-        }
-      }
-
-      public void print(CS_env env, String s) {
-	checkOpen();
-        if (newline) {
-          newline = false;
-          for (int i = 0 ; i < env.indent ; i++) {
-            out.print("  ");
-          }
-        }
-        out.print(s);
-      }
-
-      public void println(CS_env env, String s) {
-	checkOpen();
-        print(env, s);
-        out.println();
-        newline = true;
-      }
-    }
-
-    private CS_env(int indent, CS_printer printer, int version) {
-      this.version = version;
-      this.indent = indent;
-      this.printer = printer;
-      this.verStr = LabCommVersion.versionString(version);
-    }
-
-    public CS_env(File f, int version) {
-      this(0, new CS_printer(f), version);
-    }
-
-    public CS_env(PrintStream out, int version) {
-      this(0, new CS_printer(out), version);
-    }
-
-    public void close() throws IOException {
-      printer.close();
-    }
-
-    public PrintStream getPrintStream() {
-      return printer.getPrintStream();
-    }
-    public void indent(int amount) {
-      indent += amount;
-    }
-
-    public void indent() {
-      indent(1);
-    }
-
-    public void unindent(int amount) {
-      indent -= amount;
-      if (indent < 0) {
-        throw new Error("Negative indent level");
-      }
-    }
-
-    public void unindent() {
-      unindent(1);
-    }
-
-    public void print(String s) {
-      printer.print(this, s);
-    }
-
-    public void println(String s) {
-      printer.println(this, s);
-    }
-
-    public void println() {
-      printer.println(this, "");
-    }
-
-    public int getDepth() {
-      return depth;
-    }
-
-    public String print_for_begin(String limit) {
-      print("for (int i_" + depth + " = 0 ; ");
-      print("i_" + depth + " < " + limit + " ; ");
-      println("i_" + depth + "++) {");
-      indent();
-      depth++;
-      return "i_" + (depth - 1);
-    }
-
-    public void print_for_end() {
-      depth--;
-      unindent();
-      println("}");
-    }
-
-    public void print_block_begin() {
-      println("{");
-      indent();
-    }
-
-    public void print_block_end() {
-      unindent();
-      println("}");
-    }
-
-    public String getUnique(Object o) {
-      String result = (String)unique.get(o);
-      if (result == null) {
-   	result = "_" + (unique.size() + 1) + "_";
-      }
-      unique.put(o, result);
-      return result;
-    }
-
-  }
-
-}
-
-aspect CS_StructName {
-
-  inh int Decl.CS_Depth();
-  inh int Type.CS_Depth();
-  eq Program.getDecl(int i).CS_Depth() = 0;
-  eq StructType.getField(int i).CS_Depth() = CS_Depth() + 1;
-
-  inh String Type.CS_structName();
-  eq Program.getDecl(int i).CS_structName() = getDecl(i).getName();
-  eq StructType.getField(int i).CS_structName() {
-    if (CS_Depth() == 0) {
-      return "struct_" + getField(i).getName();
-    } else {
-      return CS_structName() + "_" + getField(i).getName();
-    }
-  }
-}
-
-aspect CS_Void {
-
-  syn boolean Decl.CS_isVoid() = getType().CS_isVoid();
-  syn boolean UserType.CS_isVoid() = decl().CS_isVoid();
-  syn boolean Type.CS_isVoid() = false;
-  syn boolean VoidType.CS_isVoid() = true;
-
-}
-
-aspect CS_CodeGen {
-
-  public void Program.CS_gen(String file, 
-			     String namespace, int version) throws IOException {
-    // Registration class
-    CS_env env = new CS_env(new File(file), version);
-    if (namespace != null && namespace.length() > 0) {
-      env.println("namespace " + namespace + "{");
-      env.indent();
-    }
-    env.println("using System;");
-    env.println("using se.lth.control.labcomm;");
-    for (int i = 0; i < getNumDecl(); i++) {
-      Decl d = getDecl(i);
-      try {
-        d.CS_emitClass(env);
-      } catch (Error e) {
-	System.err.println(d.getName());
-	throw e;
-      }
-    }
-    if (namespace != null && namespace.length() > 0) {
-      env.unindent();
-      env.println("}");
-    }
-  }
-
-}
-
-aspect CS_Register {
-
-  public void Program.CS_emitTypeRegister(CS_env env) {
-  }
-
-  public void Decl.CS_emitTypeRegister(CS_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitTypeRegister(CS_env env)" + 
-		    " not declared");
-  }
-
-  public void SampleDecl.CS_emitTypeRegister(CS_env env) {
-    env.println(getName() + ".register(c);");
-  }
-
-  public void TypeDecl.CS_emitTypeRegister(CS_env env) {
-    // TODO
-  }
-
-}
-
-aspect CS_Class {
-
-  public void Decl.CS_emitClass(CS_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitClass(CS_env env)" + 
-		    " not declared");
-  }
-
-  public void Decl.CS_emitDeclPP(CS_env env){
-	env.println("/* ");
-	pp(env.getPrintStream());
-	
-	CS_emitUserTypeDeps(env,null,false);
-	CS_emitUserTypeRefs(env,null,false);
-	env.println("*/");
-  
-  }
-  
-  public void Decl.CS_emitUserTypeDeps(CS_env env, String via, boolean outputCode){
-	Iterator<Decl> it = type_dependencies().iterator();
-	while(it.hasNext()) {
-	    Decl t = it.next();
-
-	    t.CS_emitUserTypeDeps(env, t.getName(), outputCode);
-	    if( outputCode && t.getType().isUserType() ) {
-	       env.println(t.getName()+".register(e);");
-	    } else {  // Just output a comment
-		String refpath = (via == null) ? "directly" : "indirectly via "+via;
-	       env.println(" //Depends ("+refpath+") on "+t.getName() );
-	    }
-	}
-  }
-  
-  public void Decl.CS_emitUserTypeRefs(CS_env env, String via, boolean outputCode){
-     if( isReferenced() ) {
-        Iterator<Decl> it = type_references().iterator();
-        while(it.hasNext()) {
-            Decl t = it.next();
-
-            t.CS_emitUserTypeRefs(env, t.getName(), outputCode);
-            if(outputCode) {
-               env.println(t.getName()+".register(e);");
-            } else {  // Just output a comment
-	        String refpath = (via == null) ? "directly" : "indirectly via "+via;
-	       env.println(" //Is referenced ("+refpath+")  by "+t.getName() );
-            }
-        }
-    }
-  }
-  
-  public void Decl.CS_emitRegisterEncoder(CS_env env) {
-    env.println("public static void register(Encoder e){");
-    env.indent();
-    env.println("e.register(dispatcher);");
-    env.unindent();
-    env.println("}");
-    env.println("public static void registerSampleRef(Encoder e) {");
-    env.indent();
-    env.println("e.registerSampleRef(dispatcher);");
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-  
-  public void Decl.CS_emitRegisterDecoder(CS_env env) {
-    env.println("public static void register(Decoder d, Handler h) {");
-    env.indent();
-    env.println("d.register(dispatcher, h);");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public static void registerSampleRef(Decoder d) {");
-    env.indent();
-    env.println("d.registerSampleRef(dispatcher);");
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-    
-  public void TypeDecl.CS_emitClass(CS_env env) {
-    if (getType().CS_needInstance()) {
-      // Hackish prettyprint preamble
-      env.println("/* ");
-      pp(env.getPrintStream());
-      env.println("*/");
-      env.println();
-      env.println("public class " + getName() + " : SampleType {");
-      env.println();
-      env.indent();
-      getType().CS_emitInstance(env);
-      if( isReferenced()) {
-        CS_emitRegisterEncoder(env);
-	CS_emitDispatcher(env,false);
-      }
-      CS_emitSignature(env);
-      CS_emitEncoder(env);
-      CS_emitDecoder(env);
-      env.unindent();
-      env.println("}");
-    }
-  }
-
-  public void SampleDecl.CS_emitClass(CS_env env) {
-    env.println("/* ");
-    pp(env.getPrintStream());
-    env.println("*/");
-    env.println();
-    env.println("public class " + getName() + " : Sample {");
-    env.println();
-    env.indent();
-    getType().CS_emitInstance(env);
-    env.println("public interface Handler : SampleHandler {");
-    env.print("  void handle(");
-    if (!isVoid()) {
-      getType().CS_emitType(env);
-      env.print(" value");
-    }
-    env.println(");");
-    env.println("}");
-    env.println();
-    CS_emitDispatcher(env,true);
-    CS_emitRegisterEncoder(env);
-    CS_emitRegisterDecoder(env);
-    CS_emitEncoder(env);
-    CS_emitDecoder(env);
-    CS_emitSignature(env);
-
-    env.println("}");
-  }
-
-  public void Decl.CS_emitSignature(CS_env env) {
-    CS_emitFlatSignature(env);
-//    if(isReferenced() || isSampleDecl()){
-//      Signature signature = getSignature();
-//      signature.CS_emitSignature(env, !isSampleDecl());
-//    }
-  }
-
-  public void Decl.CS_emitFlatSignature(CS_env env){
-    env.println("private static byte[] signature = new byte[] {");
-    env.indent();
-    SignatureList signature = flatSignature(env.version);
-    for (int i = 0 ; i < signature.size() ; i++) {
-      String comment = signature.getComment(i);
-      if (comment != null) {
-        env.println(signature.getIndent(i) + "// " + comment);
-      }
-      byte[] data = signature.getData(i, env.version);
-      if (data != null) {
-        env.print(signature.getIndent(i));
-        for (int j = 0 ; j < data.length ; j++) {
-          //env.print(data[j] + ", ");
-          env.print(String.format("0x%02X, ", data[j])) ;
-        }
-        env.println();
-      }
-    }
-    env.unindent();
-    env.println("};");
-    env.println();
-  }
-
-  //XXX TODO: refactor: split into a static class ("TypeDefSingleton"?)and a (smaller) dispatcher
-  public void Decl.CS_emitDispatcher(CS_env env, boolean isSample) {
-    String genericStr = ""; //env.versionHasMetaData()?"<"+getName()+">":""; 
-    env.println("private static Dispatcher dispatcher = new Dispatcher();");
-    env.println();
-    env.println("public SampleDispatcher getDispatcher() {");
-    env.indent();
-    env.println("return dispatcher;");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("private class Dispatcher : SampleDispatcher{");
-    env.indent();
-    env.println();
-    env.println("public Type getSampleClass() {");
-    env.indent();
-    env.println("return typeof(" + getName() + ");");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public String getName() {");
-    env.indent();
-    env.println("return \"" + getName() + "\";");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public byte getTypeDeclTag() {");
-    env.indent();
-    if(isSample) {
-      env.println("return Constant.SAMPLE_DEF;");
-    } else {
-      env.println("return Constant.TYPE_DEF;");
-    }
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public bool isSample() {");
-    env.indent();
-    env.println("return "+isSample+";");
-    env.unindent();
-    env.println("}");
-    env.println("/** return the flat signature. */");
-    env.println("public byte[] getSignature() {");
-    env.indent();
-    env.println("return signature;");
-    env.unindent();
-    env.println("}");
-    env.println();
-//    env.println("public void encodeSignature(Encoder e) throws IOException{");
-//    env.indent();
-//    env.println("emitSignature(e);");
-//    env.unindent();
-//    env.println("}");
-//    env.println();
-//  env.println("public void encodeSignatureMetadata(Encoder e, int index){");
-//  env.indent();
-//  env.println("e.encodePacked32(Constant.TYPE_DEF);");
-//  env.println("e.encodePacked32(index);");
-//  env.println("e.encodeString(getName());");
-//  env.println("emitSignature(e);");
-//  env.unindent();
-//  env.println("}");
-//  env.println();
-    env.println("public bool canDecodeAndHandle() {");
-    env.indent();
-    env.println("return "+isSample+";");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public void decodeAndHandle(Decoder d,");
-    env.println("                            SampleHandler h) {");
-    env.indent();
-    if( isSample) {
-        if (isVoid()) {
-          env.println(getName() + ".decode(d);");
-          env.println("((Handler)h).handle();");
-        } else {
-          env.println("((Handler)h).handle(" + getName() + ".decode(d));");
-        }
-    } else {
-        env.println("throw new Exception(\"A typedef has no handler, the corresponding method on the sample class should be called.\");");
-    }
-    env.unindent();
-    env.println("}");
-    env.println("");
-    env.unindent();
-    env.println("}");
-    env.println("");
-
- } //TODO, fix above method
-  
-  public void TypeDecl.CS_emitEncoder(CS_env env) {
-    env.print("public static void encode(Encoder e");
-    if (!isVoid()) {
-      env.print(", ");
-      getType().CS_emitType(env);
-      env.print(" value");
-    }
-    env.println(") {");
-    env.indent();
-    getType().CS_emitEncoder(env, "value");
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-
-  public void SampleDecl.CS_emitEncoder(CS_env env) {
-    env.print("public static void encode(Encoder e");
-    if (!isVoid()) {
-      env.print(", ");
-      getType().CS_emitType(env);
-      env.print(" value");
-    }
-    env.println(") {");
-    env.indent();
-    env.println("e.begin(typeof(" + getName() + "));");
-    getType().CS_emitEncoder(env, "value");
-    env.println("e.end(typeof(" + getName() + "));");
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-
-  public void Type.CS_emitEncoder(CS_env env, String name) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitEncoder(CS_env env, String name)" + 
-		    " not declared");
-  }
-
-  public void VoidType.CS_emitEncoder(CS_env env, String name) {
-  }
-
-  public void PrimType.CS_emitEncoder(CS_env env, String name) {
-    switch (getToken()) {
-      case LABCOMM_BOOLEAN: { env.print("e.encodeBoolean"); } break;
-      case LABCOMM_BYTE: { env.print("e.encodeByte"); } break;
-      case LABCOMM_SHORT: { env.print("e.encodeShort"); } break;
-      case LABCOMM_INT: { env.print("e.encodeInt"); } break;
-      case LABCOMM_LONG: { env.print("e.encodeLong"); } break;
-      case LABCOMM_FLOAT: { env.print("e.encodeFloat"); } break;
-      case LABCOMM_DOUBLE: { env.print("e.encodeDouble"); } break;
-      case LABCOMM_STRING: { env.print("e.encodeString"); } break;
-      case LABCOMM_SAMPLE: { env.print("e.encodeSampleRef"); } break;
-    }
-    env.println("(" + name + ");");
-  }
-
-  public void ArrayType.CS_emitEncoder(CS_env env, String name) {
-    env.print_block_begin();
-    int baseDepth = env.getDepth();
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String limit = getExp(i).CS_emitEncoder(env, 
-					      name + ".GetLength(" + i + ")");
-      env.println("int i_" + (baseDepth + i) + "_max = " + limit + ";");
-    }
-    String index = null;
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String limit = "i_" + (baseDepth + i) + "_max";
-      if (i == 0) {
-        index = env.print_for_begin(limit);
-      } else {
-        index = index + ", " + env.print_for_begin(limit);
-      }
-    }
-    getType().CS_emitEncoder(env, name + "[" + index + "]");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print_for_end();
-    }
-    env.print_block_end();
-  }
-  
-  public String Exp.CS_emitEncoder(CS_env env, String name) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitEncoder(CS_env env, String name)" + 
-		    " not declared");
-  }
-
-  public String IntegerLiteral.CS_emitEncoder(CS_env env, String name) {
-    return getValue();
-  }
-
-  public String VariableSize.CS_emitEncoder(CS_env env, String name) {
-    env.println("e.encodePacked32(" + name + ");");
-    return name;
-  }
-
-  public void StructType.CS_emitEncoder(CS_env env, String name) {
-    for (int i = 0 ; i < getNumField() ; i++) {
-      Field f = getField(i);
-      f.getType().CS_emitEncoder(env, name + "." + f.getName());
-    }
-  }
-
-  public void UserType.CS_emitEncoder(CS_env env, String name) {
-    if (CS_needInstance()) {
-      env.println(getName() + ".encode(e, " + name + ");");
-    } else {
-      decl().getType().CS_emitEncoder(env, name);
-    }
-  }
-
-  public void Decl.CS_emitDecoder(CS_env env) {
-    env.print("public static ");
-    getType().CS_emitType(env);
-    env.println(" decode(Decoder d) {");
-    env.indent();
-    if (!isVoid()) {
-      getType().CS_emitType(env);
-      env.println(" result;");
-      getType().CS_emitDecoder(env, "result");
-      env.println("return result;");
-    }
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-
-  public void Type.CS_emitDecoder(CS_env env, String name) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitDecoder(CS_env env, String name)" + 
-		    " not declared");
-  }
-
-  public void VoidType.CS_emitDecoder(CS_env env, String name) {
-  }
-
-  public void PrimType.CS_emitDecoder(CS_env env, String name) {
-    env.print(name + " = ");
-    switch (getToken()) {
-      case LABCOMM_BOOLEAN: { env.println("d.decodeBoolean();"); } break;
-      case LABCOMM_BYTE: { env.println("d.decodeByte();"); } break;
-      case LABCOMM_SHORT: { env.println("d.decodeShort();"); } break;
-      case LABCOMM_INT: { env.println("d.decodeInt();"); } break;
-      case LABCOMM_LONG: { env.println("d.decodeLong();"); } break;
-      case LABCOMM_FLOAT: { env.println("d.decodeFloat();"); } break;
-      case LABCOMM_DOUBLE: { env.println("d.decodeDouble();"); } break;
-      case LABCOMM_STRING: { env.println("d.decodeString();"); } break;
-      case LABCOMM_SAMPLE: { env.println("d.decodeSampleRef();"); } break;
-      default: {
-        throw new Error("PrimType.CS_emitDecoder(CS_env env, String name)" + 
-                        " unknown token type");
-      }
-    }
-  }
-
-  public void ArrayType.CS_emitDecoder(CS_env env, String name) {
-    env.println("{");
-    env.indent();
-    int baseDepth = env.getDepth();
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print("int i_" + (baseDepth + i) + "_max = ");
-      getExp(i).CS_emitDecoder(env);
-      env.println(";");
-    }
-    env.print(name + " = new "); 
-    getType().CS_emitTypePrefix(env);
-    env.print("[");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      if (i > 0) {
-	env.print(", ");
-      }
-      env.print("i_" + (baseDepth + i) + "_max");
-    }
-    env.print("]");
-    getType().CS_emitTypeSuffix(env);
-    env.println(";");
-    
-    String index = null;
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String limit = "i_" + (baseDepth + i) + "_max";
-      if (i == 0) {
-        index = env.print_for_begin(limit);
-      } else {
-        index = index + ", " + env.print_for_begin(limit);
-      }
-    }
-    getType().CS_emitDecoder(env, name + "[" + index + "]");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print_for_end();
-    }
-    env.unindent();
-    env.println("}");
-  }
-
-  public void Exp.CS_emitDecoder(CS_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitDecoder(CS_env env)" + 
-		    " not declared");
-  }
-
-  public void IntegerLiteral.CS_emitDecoder(CS_env env) {
-    env.print(getValue());
-  }
-
-  public void VariableSize.CS_emitDecoder(CS_env env) {
-    env.print("d.decodePacked32()");
-  }
-
-  public void StructType.CS_emitDecoder(CS_env env, String name) {
-    env.print(name + " = new ");
-    CS_emitType(env);
-    env.println("();");
-    for (int i = 0 ; i < getNumField() ; i++) {
-      Field f = getField(i);
-      f.getType().CS_emitDecoder(env, name + "." + f.getName());
-    }
-  }
-
-  public void UserType.CS_emitDecoder(CS_env env, String name) {
-    if (CS_needInstance()) {
-      env.println(name + " = " + getName() + ".decode(d);");
-    } else {
-      decl().getType().CS_emitDecoder(env, name);
-    }
-  }
-
-  public void Type.CS_emitTypePrefix(CS_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitTypePrefix(CS_env env)" + 
-		    " not declared");
-  }
-
-  public void PrimType.CS_emitTypePrefix(CS_env env) {
-    switch (getToken()) {
-      case LABCOMM_STRING: { env.print("String"); } break;
-      case LABCOMM_SAMPLE: { env.print("Type"); } break;
-      default: { env.print(getName()); } break;
-    }
-  }
-
-  public void UserType.CS_emitTypePrefix(CS_env env) {
-    if (CS_needInstance()) {
-      env.print(getName());
-    } else {
-      decl().getType().CS_emitTypePrefix(env);
-    } 
-  }
-
-  public void ArrayType.CS_emitTypePrefix(CS_env env){
-    getType().CS_emitTypePrefix(env);
-  }
-
-  public void StructType.CS_emitTypePrefix(CS_env env){
-    env.print(CS_structName());
-  }
-
-  public void Type.CS_emitTypeSuffix(CS_env env) {
-  }
-
-  public void UserType.CS_emitTypeSuffix(CS_env env) {
-    if (! CS_needInstance()) {
-      decl().getType().CS_emitTypeSuffix(env);
-    } 
-  }
-
-  public void ArrayType.CS_emitTypeSuffix(CS_env env){
-    env.print("[");
-    for (int i = 1 ; i < getNumExp() ; i++) {
-      env.print(",");
-    }
-    env.print("]");
-    getType().CS_emitTypeSuffix(env);
-  }
-
-  public boolean Type.CS_needInstance() {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_needInstance()" + 
-		    " not declared");
-  }
-
-  public boolean VoidType.CS_needInstance() {
-    return false;
-  }
-
-  public boolean PrimType.CS_needInstance() {
-    return false;
-  }
-
-  public boolean UserType.CS_needInstance() {
-    return decl().getType().CS_needInstance();
-  }
-
-  public boolean StructType.CS_needInstance() {
-    return true;
-  }
-
-  public boolean ArrayType.CS_needInstance() {
-    return getType().CS_needInstance();
-  }
-
-  public boolean Type.CS_isPrimitive() {
-    return false;
-  }
-
-  public boolean PrimType.CS_isPrimitive() {
-    return true;
-  }
-
-  public void Type.CS_emitInstance(CS_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitInstance(CS_env env)" + 
-		    " not declared");
-  }
-
-  public void VoidType.CS_emitInstance(CS_env env) {
-  }
-
-  public void PrimType.CS_emitInstance(CS_env env) {
-  }
-
-  public void ArrayType.CS_emitInstance(CS_env env) {
-    getType().CS_emitInstance(env);
-  }
-
-  public void StructType.CS_emitInstance(CS_env env) {
-    if (CS_Depth() > 0) {
-      env.println("public class " + CS_structName() + " {");
-      env.indent();
-    }
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).getType().CS_emitInstance(env);
-    }
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).CS_emitField(env);
-    }
-    if (CS_Depth() > 0) {
-      env.unindent();
-      env.println("}");
-    }
-    env.println();
-  }
-
-  public void UserType.CS_emitInstance(CS_env env) {
-  }
-
-  public void Field.CS_emitField(CS_env env) {
-    env.print("public ");
-    getType().CS_emitType(env);
-    env.println(" " + getName() + ";");    
-  }
-
-  public void Type.CS_emitType(CS_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_emitType(CS_env env)" + 
-		    " not declared");
-  }
-
-  public void VoidType.CS_emitType(CS_env env) {
-    env.print("void");
-  }
-
-  public void PrimType.CS_emitType(CS_env env) {
-    switch (getToken()) {
-      case LABCOMM_STRING: { env.print("String"); } break;
-      case LABCOMM_BOOLEAN: { env.print("bool"); } break;
-      case LABCOMM_SAMPLE: { env.print("Type"); } break;
-      default: { env.print(getName()); } break;
-    }
-  }
-
-  public void UserType.CS_emitType(CS_env env) {
-    decl().getType().CS_emitType(env);
-  }
-
-  public void ArrayType.CS_emitType(CS_env env){
-    getType().CS_emitTypePrefix(env);
-    env.print("[");
-    for (int i = 1 ; i < getNumExp() ; i++) {
-      env.print(",");
-    }
-    env.print("]");
-    getType().CS_emitTypeSuffix(env);
-  }
-
-  public void StructType.CS_emitType(CS_env env){
-    env.print(CS_structName());
-  }
-
-}
-
-aspect CS_Signature {
-    public void Signature.CS_emitSignature(CS_env env, boolean decl){
- 
-      SignatureList sl = getSignatureList();
-      sl.CS_emitSignature(env, decl);
-    }
-
-    public abstract void SignatureLine.CS_emitSignature(CS_env env, boolean decl);
-
-    public void TypeRefSignatureLine.CS_emitSignature(CS_env env, boolean isDecl){
-      env.print(getIndentString());
-      env.println("e.encodePacked32(e.getTypeId( typeof("+decl.getName()+")));");
-    }
-
-    public void DataSignatureLine.CS_emitSignature(CS_env env, boolean decl){
-        byte[] data = getData(env.version);
-          if (data != null) {
-              env.print(getIndentString());
-              for (int j = 0 ; j < data.length ; j++) {
-                  //env.print("e.encodeByte((byte)"+data[j]+");");
-                  env.print("e.encodeByte((byte)"+ String.format("0x%02X ", data[j]) +"); ");
-              }
-              env.println();
-          }
-  }
-    public void SignatureList.CS_emitSignature(CS_env env, boolean decl) {
-      env.println("private static void emitSignature(Encoder e){");
-      env.indent();
-      for (int i = 0 ; i < size() ; i++) {
-        String comment = getComment(i);
-        if (comment != null && comment.length() > 0) {
-            env.println(getIndent(i) + "// " + comment);
-        }
-        SignatureLine l = getSignatureLine(i);
-        l.CS_emitSignature(env, decl);
-      }
-      env.println("}");
-      env.unindent();
-  }
-
-}
-
-aspect CS_Info {
-
-  public void Program.CS_info(PrintStream out, String namespace, int version) {
-    CS_env env = new CS_env(out, version);
-    if (namespace == null) {
-      namespace = ""; 
-    } else {
-      namespace = namespace + "."; 
-    }
-    for (int i = 0; i < getNumDecl(); i++) {
-      getDecl(i).CS_info(env, namespace);
-    }
-  }
-
-  public void Decl.CS_info(CS_env env, String namespace) {
-    throw new Error(this.getClass().getName() + 
-		    ".CS_info(CS_env env)" + 
-		    " not declared");
-  }
-
-  public void TypeDecl.CS_info(CS_env env, String namespace) {
-    env.print(";C#;typedef;" + namespace + getName() + ";");
-    getType().CS_emitType(env) ;
-    env.print(";not_applicable_for_C#");
-    env.println();
-  }
-
-  public void SampleDecl.CS_info(CS_env env, String namespace) {
-    env.print(";C#;sample;" + namespace + getName() + ";");
-    getType().CS_emitType(env);
-    env.print(";not_applicable_for_C#");
-    env.println();
-  }
-
-}
-
diff --git a/compiler/2014/C_CodeGen.jrag b/compiler/2014/C_CodeGen.jrag
deleted file mode 100644
index 9b7cac5c4da04e4260db1c02baff5b8e5fdd9663..0000000000000000000000000000000000000000
--- a/compiler/2014/C_CodeGen.jrag
+++ /dev/null
@@ -1,1755 +0,0 @@
-import java.util.Vector;
-
-aspect C_CodeGenEnv {
-
-  // Environment wrapper for C-code generation
-  // handles qualid nesting, indentation, file writing and
-  // prefix propagation
-
-  public class C_env {
-
-    final private static class C_printer {
-      
-      private boolean newline = true;
-      private PrintStream out;
-
-      public C_printer(PrintStream out) {
-	this.out = out;
-      }
-
-      public void print(C_env env, String s) {
-	if (newline) {
-	  newline = false;
-	  for (int i = 0 ; i < env.indent ; i++) {
-	    out.print("  ");
-	  }
-	}
-	out.print(s);
-      }
-      public void println(C_env env, String s) {
-	print(env, s);
-	out.println();
-	newline = true;
-      }
-    }
-
-    public final int version; //labcomm version (2006 or 2014)
-    public final String verStr; // version suffix to append (currently _2006 and empty string)
-
-    public final String qualid;
-    public final String lcName;
-    public final String rawPrefix;
-    public final String prefix;
-    private int indent;
-    public final int depth;
-    private C_printer printer;
-    public final int nestedLevel;
-    private boolean rootIsPointer;
-    private int rootLevel;
-
-    public boolean versionHasMetaData() {
-      return version != 2006;
-    }
-
-    private C_env(String qualid, String lcName, String rawPrefix, 
-		  int indent, int depth, C_printer printer,
-                  int nestedLevel, int version)
-    {
-      this.version = version;
-      this.verStr = LabCommVersion.versionString(version);
-      this.qualid = qualid;
-      this.lcName = lcName;
-      this.rawPrefix = rawPrefix;
-      if (rawPrefix == null) {
-        System.err.println("WARNING: prefix==null");
-        this.prefix = ""; 
-      } else if (rawPrefix.equals("")) {
-        this.prefix = rawPrefix;
-      } else {
-        this.prefix = rawPrefix + "_";
-      }
-      this.indent = indent;
-      this.depth = depth;
-      this.printer = printer;
-      this.nestedLevel = nestedLevel;
-    }
-
-    public C_env(String qualid, String lcName, String rawPrefix,
-		 PrintStream out, int version)
-    {
-      this(qualid, lcName, rawPrefix, 0, 0, new C_printer(out), 0, version);
-    }
-
-    public C_env(String qualid, String lcName, String rawPrefix,
-		 int indent, int depth, C_printer printer, int version) {
-            this(qualid, lcName, rawPrefix, indent, depth, printer, 0, version);
-    }
-
-    public C_env nestArray(String suffix) {
-      return new C_env(qualid + suffix, lcName, rawPrefix,
-		       indent, depth + 1, printer, nestedLevel + 1, version);
-    }
-
-    public C_env nestStruct(String suffix) {
-      return new C_env(qualid + suffix, lcName, rawPrefix, 
-		       indent, depth, printer, nestedLevel + 1, version);
-    }
-
-    public void indent() {
-      indent++;
-    }
-
-    public void unindent() {
-      indent--;
-    }
-
-    public String prefix() {
-      return rawPrefix;
-    }
-
-    public void print(String s) {
-      printer.print(this, s);
-    }
-
-    public void println() {
-      printer.println(this, "");
-    }
-
-    public void println(String s) {
-      printer.println(this, s);
-    }
-
-    public C_env setPointer() {
-      rootIsPointer = true;
-      rootLevel = nestedLevel;
-      return this;
-    }
-
-    public String memberAccessor() {
-      return (rootIsPointer && (nestedLevel == rootLevel)) ? "->" : ".";
-    }
-
-    public String accessor() {
-      return (rootIsPointer && (nestedLevel == rootLevel)) ? "*" : "";
-    }
-  }
-
-  public C_env ArrayType.C_Nest(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_Nest(C_env env)" + 
-		    " not declared");
-  }
-
-  public C_env FixedArrayType.C_Nest(C_env env) {
-    String index = env.memberAccessor() + "a";
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      index += "[i_" + env.depth + "_" + i + "]";
-    }
-    return env.nestArray(index);
-  }
-
-  public C_env VariableArrayType.C_Nest(C_env env) {
-    return env.nestArray(env.memberAccessor() + "a[i_" + env.depth + "]");
-  }
-
-
-}
-
-aspect C_IsDynamic {
-  
-  // Determine if a type has dynamically allocated data
-  syn boolean Decl.C_isDynamic() = getType().C_isDynamic();
-  syn boolean Type.C_isDynamic() = false;
-  syn boolean PrimType.C_isDynamic() = getToken() == LABCOMM_STRING;
-  syn boolean UserType.C_isDynamic() = 
-    lookupType(getName()).getType().C_isDynamic();
-  syn boolean StructType.C_isDynamic() {
-    for (int i = 0 ; i < getNumField() ; i++) {
-      if (getField(i).getType().C_isDynamic()) {
-	return true;
-      }
-    }
-    return false;
-  }
-  syn boolean FixedArrayType.C_isDynamic() = getType().C_isDynamic();
-  syn boolean VariableArrayType.C_isDynamic() = true;
-}
-
-aspect C_CodeGen {
-
-  public void Program.C_genH(PrintStream out, Vector includes, 
-			     String lcName, String prefix, int version) {
-    C_env env = new C_env("", lcName, prefix, out, version);
-
-    // Hackish prettyprint preamble
-    out.println("/* LabComm declarations:");
-    pp(out);
-    out.println("*/");
-    env.println("");
-    env.println("");
-    env.println("#ifndef __LABCOMM_" + env.lcName + "_H__"); 
-    env.println("#define __LABCOMM_" + env.lcName + "_H__");
-    env.println("");
-
-    // Include
-    env.println("#include \"labcomm2014.h\"");
-    for (int i = 0 ; i < includes.size() ; i++) {
-      env.println("#include \"" + includes.get(i) + "\"");
-    }
-    env.println("");
-
-    C_emitH(env);
-
-    env.println("#endif");
-  }
-
-  public void Program.C_genC(PrintStream out, Vector includes, 
-			     String lcName, String prefix, int version) {
-    C_env env = new C_env("", lcName, prefix, out, version);
-
-    // Include
-    env.println("#include \"labcomm2014.h\"");
-    env.println("#include \"labcomm2014_private.h\"");
-    for (int i = 0 ; i < includes.size() ; i++) {
-      env.println("#include \"" + includes.get(i) + "\"");
-    }
-    env.println("");
-    
-    // Method Implementations
-    C_emitC(env);
-  }
-
-  public void Program.C_emitH(C_env env) {
-    for (int i = 0; i < getNumDecl(); i++) {
-      getDecl(i).C_emitType(env);
-      getDecl(i).C_emitDecoderDeclaration(env);
-      getDecl(i).C_emitEncoderDeclaration(env);
-      getDecl(i).C_emitSizeofDeclaration(env);
-      getDecl(i).C_emitCopyDeclaration(env);
-      getDecl(i).C_emitCopyDeallocationDeclaration(env);
-      env.println("");
-    }
-    C_emitConstructorDeclaration(env);
-    C_emitForAll(env);
-  }
-
-  public void Program.C_emitC(C_env env) {
-    for (int i = 0; i < getNumDecl(); i++) {
-      getDecl(i).C_emitSignature(env);
-      getDecl(i).C_emitDecoder(env);
-      getDecl(i).C_emitDecoderRegisterHandler(env);
-      getDecl(i).C_emitDecoderIoctl(env);
-      getDecl(i).C_emitEncoder(env);
-      getDecl(i).C_emitEncoderRegisterHandler(env);
-      getDecl(i).C_emitEncoderIoctl(env);
-      getDecl(i).C_emitSizeof(env);
-      getDecl(i).C_emitCopy(env);
-      getDecl(i).C_emitCopyDeallocation(env);
-    }
-    C_emitConstructor(env);
-  }
- 
-}
-
-aspect C_Common {
-
-  public void ArrayType.C_emitLoopVariables(C_env env) {
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.println("int i_" + env.depth + "_" + i + ";");
-    }
-  }
-
-}
-
-aspect C_Type {
-
-  public void Decl.C_emitType(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitType(C_env env)" + 
-		    " not declared");
-  }
-
-  public void TypeDecl.C_emitType(C_env env) {
-    env.println("#ifndef LABCOMM_DEFINED_" + env.prefix + getName());
-    env.print("typedef ");
-    getType().C_emitType(env, env.prefix + getName());
-    env.println(";");
-    env.println("#define LABCOMM_DEFINED_" + env.prefix + getName());
-    env.println("#endif");
-  }
-
-  public void SampleDecl.C_emitType(C_env env) {
-    env.println("#ifndef LABCOMM_DEFINED_" + env.prefix + getName());
-    env.print("typedef ");
-    getType().C_emitType(env, env.prefix + getName());
-    env.println(";");
-    env.println("#define LABCOMM_DEFINED_" + env.prefix + getName());
-    env.println("#endif");
-    env.println("extern const struct labcomm2014_signature " +
-                "*labcomm2014_signature_" + env.prefix + getName() + 
-                ";");
-  }
-
-  public void Type.C_emitType(C_env env, String name) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitType(C_env env, String name)" + 
-		    " not declared");
-  }
-
-  public void VoidType.C_emitType(C_env env, String name) {
-    env.print("char " + name);
-  }
-
-  public void PrimType.C_emitType(C_env env, String name) {
-    switch (getToken()) {
-      case LABCOMM_BOOLEAN: { env.print("uint8_t"); } break;
-      case LABCOMM_BYTE: { env.print("uint8_t"); } break;
-      case LABCOMM_SHORT: { env.print("int16_t"); } break;
-      case LABCOMM_INT: { env.print("int32_t"); } break;
-      case LABCOMM_LONG: { env.print("int64_t"); } break;
-      case LABCOMM_FLOAT: { env.print("float"); } break;
-      case LABCOMM_DOUBLE: { env.print("double"); } break;
-      case LABCOMM_STRING: { env.print("char*"); } break;
-      case LABCOMM_SAMPLE: { 
-        env.print("const struct labcomm2014_signature *"); 
-      } break;
-    }
-    env.print(" " + name);
-  }
-
-  public void UserType.C_emitType(C_env env, String name) {
-    env.print(env.prefix + getName() + " " + name);
-  }
-
-  public void StructType.C_emitType(C_env env, String name) {
-    env.println("struct {");
-    env.indent();
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).C_emitType(env);
-      env.println(";");
-    }
-    env.unindent();
-    env.print("} " + name);
-  }
-
-  public void Field.C_emitType(C_env env) {
-    getType().C_emitType(env, getName());
-  }
-
-  public void FixedArrayType.C_emitType(C_env env, String name) {
-    env.println("struct {");
-    env.indent();
-    StringBuffer index = new StringBuffer("a");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      index.append("[" + getExp(i).C_getValue() + "]");
-    }
-    getType().C_emitType(env, index.toString());
-    env.println(";");
-    env.unindent();
-    env.print("} " + name);
-  }
-
-  public void VariableArrayType.C_emitType(C_env env, String name) {
-    env.println("struct {");
-    env.indent();
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      if (getExp(i) instanceof VariableSize) {
-	env.println("int n_" + i + ";");
-      } else {
-	env.println("// n_" + i + "=" + getExp(i).C_getValue());
-      }
-    }
-    getType().C_emitType(env, "*a");
-    env.println(";");
-    env.unindent();
-    env.print("} " + name);
-  }
-
-  public String Exp.C_getValue() {
-   throw new Error(this.getClass().getName() + 
-		    ".C_getValue()" + 
-		    " not declared");
-  }
-
-  public String IntegerLiteral.C_getValue() {
-    return getValue();
-  }
-
-}
-
-aspect C_Declarations {
-
-  public void Decl.C_emitDecoderDeclaration(C_env env) {
-  }
-
-  public void SampleDecl.C_emitDecoderDeclaration(C_env env) {
-    env.println("int labcomm2014_decoder_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_decoder *d,");
-    env.println("void (*handler)(");
-    env.indent();
-    env.println(env.prefix + getName() + " *v,");
-    env.println("void *context");
-    env.unindent();
-    env.println("),");
-    env.println("void *context");
-    env.unindent();
-    env.println(");");
-
-    env.println("int labcomm2014_decoder_ioctl_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_decoder *d,");
-    env.println("int ioctl_action,");
-    env.println("...");
-    env.unindent();
-    env.println(");");
-  }
-  
-  public void Decl.C_emitEncoderDeclaration(C_env env) {
-  }
-
-  public void SampleDecl.C_emitEncoderDeclaration(C_env env) {
-    env.println("int labcomm2014_encoder_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_encoder *e);");
-    env.unindent();
-
-    env.println("int labcomm2014_encode_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_encoder *e");
-    if(!isVoid() ) {
-        env.println(", "+env.prefix + getName() + " *v");
-    }
-    env.unindent();
-    env.println(");");
-
-    env.println("int labcomm2014_encoder_ioctl_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_encoder *e,");
-    env.println("int ioctl_action,");
-    env.println("...");
-    env.unindent();
-    env.println(");");
-  }
-
-}
-
-aspect C_Limit {
-
-  public String Exp.C_getLimit(C_env env, int i) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitDecoderLimit(C_env env, int i)" + 
-		    " not declared");
-  }
-
-  public String IntegerLiteral.C_getLimit(C_env env, int i) {
-    return getValue();
-  }
-
-  public String VariableSize.C_getLimit(C_env env, int i) {
-    return env.qualid + env.memberAccessor() + "n_" + i;
-  }
-  
-}
-
-aspect C_Index {
-
-  public void ArrayType.C_emitCalcIndex(C_env env) {
-  }
-
-  public void VariableArrayType.C_emitCalcIndex(C_env env) {
-    env.print("int i_" + env.depth + " = ");
-
-    String i_prefix = "i_" + env.depth + "_";
-    String expr = i_prefix + "0";
-    for (int i = 1 ; i < getNumExp() ; i++) {
-      expr = "(" + expr + ") * " +
-	getExp(i).C_getLimit(env, i) + " + " + 
-	i_prefix + i;
-    }
-    env.println(expr + ";");
-  }
-
-}
-
-aspect C_Decoder {
-
-  public void Decl.C_emitDecoder(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitDecoder(C_env env)" + 
-		    " not declared");
-  }
-
-  public void TypeDecl.C_emitDecoder(C_env env) {
-  }
-
-  public void SampleDecl.C_emitDecoder(C_env env) {
-    env = env.nestStruct("v");
-    env.println("static void decode_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_reader *r,");
-    env.println("void (*handle)(");
-    env.indent();
-    env.println(env.prefix + getName() + " *v,");
-    env.println("void *context");
-    env.unindent();
-    env.println("),");
-    env.println("void *context");
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println(env.prefix + getName() + " v;");
-    getType().C_emitDecoder(env);
-    env.println("handle(&v, context);");
-    if (C_isDynamic()) {
-      env.println("{");
-      env.indent();
-      getType().C_emitDecoderDeallocation(env);
-      env.unindent();
-      env.println("}");
-    }
-    env.unindent();
-    env.println("}");
-  }
-
-  public void Type.C_emitDecoder(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitDecoder(C_env env)" + 
-		    " not declared");
-  }
-
-  public void VoidType.C_emitDecoder(C_env env) {
-  }
-
-  public void PrimType.C_emitDecoder(C_env env) {
-    env.print(env.qualid + " = ");
-    switch (getToken()) {
-      case LABCOMM_SAMPLE: { 
-        env.println("labcomm2014_internal_decoder_index_to_signature(" +
-                    "r->decoder, labcomm2014_read_int(r));");
-      } break;
-      default: {
-        env.println("labcomm2014_read_" + getName() + "(r);");
-      }; break;
-    }
-  }
-
-  public void UserType.C_emitDecoder(C_env env) {
-    lookupType(getName()).getType().C_emitDecoder(env);
-  }
-
-  public void StructType.C_emitDecoder(C_env env) {
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).C_emitDecoder(env);
-    }
-  }
-
-  public void ArrayType.C_emitDecoder(C_env env) {
-    C_emitDecoderDecodeLimit(env);
-    C_emitDecoderArrayAllocate(env);
-    env.println("{");
-    env.indent();
-    C_emitLoopVariables(env);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String iterator = "i_" + env.depth + "_" + i;
-      env.println("for (" + iterator + " = 0" +
-		  " ; " +
-		  iterator + " < " + getExp(i).C_getLimit(env, i) +
-		  " ; " +
-		  iterator + "++) {");
-      env.indent();
-    }
-    C_emitCalcIndex(env);
-    getType().C_emitDecoder(C_Nest(env));
-    for (int i = getNumExp() - 1 ; i >= 0 ; i--) {
-      env.unindent();
-      env.println("}");
-    }
-    env.unindent();
-    env.println("}");
-  }
-
-  public void Field.C_emitDecoder(C_env env) {
-    getType().C_emitDecoder(env.nestStruct("." + getName()));
-  }
-
-  public void Exp.C_emitDecoderDecodeLimit(C_env env, int i) {
-  }
-
-  public void VariableSize.C_emitDecoderDecodeLimit(C_env env, int i) {
-    env.println(env.qualid + ".n_" + i + " = labcomm2014_read_packed32(r);");
-  }
-
-  public void ArrayType.C_emitDecoderDecodeLimit(C_env env) {
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      getExp(i).C_emitDecoderDecodeLimit(env, i);
-    }
-  }
-
-  public void ArrayType.C_emitDecoderArrayAllocate(C_env env) {
-  }
-
-  public void VariableArrayType.C_emitDecoderArrayAllocate(C_env env) {
-    env.print(env.qualid + 
-              ".a = labcomm2014_memory_alloc(r->memory, 1, sizeof(" + 
-	      env.qualid + ".a[0])");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print(" * " + getExp(i).C_getLimit(env, i));
-    }
-    env.println(");");
-  }
-
-  // Code for deallocation of dynamically allocated data 
-
-  public void Type.C_emitDecoderDeallocation(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitDecoderDeallocation(C_env env)" + 
-		    " not declared");
-  }
-
-  public void PrimType.C_emitDecoderDeallocation(C_env env) {
-    if (C_isDynamic()) {
-      env.println("labcomm2014_memory_free(r->memory, 1, " + 
-                  env.qualid + ");");
-    }
-  }
-
-  public void UserType.C_emitDecoderDeallocation(C_env env) {
-    if (C_isDynamic()) {
-      lookupType(getName()).getType().C_emitDecoderDeallocation(env);
-    }
-  }
-
-  public void StructType.C_emitDecoderDeallocation(C_env env) {
-    if (C_isDynamic()) {
-      for (int i = 0 ; i < getNumField() ; i++) {
-	getField(i).C_emitDecoderDeallocation(env);
-      }
-    }
-  }
-
-  public void ArrayType.C_emitDecoderDeallocation(C_env env) {
-    if (getType().C_isDynamic()) {
-      env.println("{");
-      env.indent();
-      C_emitLoopVariables(env);
-      for (int i = 0 ; i < getNumExp() ; i++) {
-	String iterator = "i_" + env.depth + "_" + i;
-	env.println("for (" + iterator + " = 0" +
-		    " ; " +
-		    iterator + " < " + getExp(i).C_getLimit(env, i) +
-		    " ; " +
-		    iterator + "++) {");
-	env.indent();
-      }
-      C_emitCalcIndex(env);
-      getType().C_emitDecoderDeallocation(C_Nest(env));
-      for (int i = 0 ; i < getNumExp() ; i++) {
-	env.unindent();
-	env.println("}");
-      }
-      env.unindent();
-      env.println("}");
-    }
-  }
-
-  public void VariableArrayType.C_emitDecoderDeallocation(C_env env) {
-    super.C_emitDecoderDeallocation(env);
-    env.println("labcomm2014_memory_free(r->memory, 1, " + 
-                env.qualid + ".a);");
-  }
-
-  public void Field.C_emitDecoderDeallocation(C_env env) {
-    getType().C_emitDecoderDeallocation(env.nestStruct("." + getName()));
-  }
-
-  public void Decl.C_emitDecoderRegisterHandler(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitDecoderRegisterHandler(C_env env)" + 
-		    " not declared");
-  }
-
-  public void TypeDecl.C_emitDecoderRegisterHandler(C_env env) {
-  }
-
-  public void SampleDecl.C_emitDecoderRegisterHandler(C_env env) {
-    env.println("int labcomm2014_decoder_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_decoder *d,");
-    env.println("void (*handler)(");
-    env.indent();
-    env.println(env.prefix + getName() + " *v,");
-    env.println("void *context");
-    env.unindent();
-    env.println("),");
-    env.println("void *context");
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println("return labcomm2014_internal_decoder_register(");
-    env.indent();
-    env.println("d,");
-    env.println("&signature_" + env.prefix + getName() + ",");
-    env.println("(labcomm2014_decoder_function)decode_" + env.prefix + getName() + ",");
-    env.println("(labcomm2014_handler_function)handler,");
-    env.println("context");
-    env.unindent();
-    env.println(");");
-    env.unindent();
-    env.println("}");
-  }
-
-}
-
-aspect C_copy {
-
-  private void SampleDecl.C_emitCopyFunctionParam(C_env env, String src,
-						  String dst)
-  {
-    env.println("void labcomm2014_copy_" +
-                env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_memory *mem,");
-    env.println(env.prefix + getName() + " *" + dst + ",");
-    env.println(env.prefix + getName() + " *" + src);
-    env.unindent();
-    env.print(")");
-  }
-
-  public void Decl.C_emitCopyDeclaration(C_env env) {
-  }
-
-  public void SampleDecl.C_emitCopyDeclaration(C_env env) {
-    C_emitCopyFunctionParam(env, "src", "dst");
-    env.println(";");
-  }
-
-  public void Decl.C_emitCopy(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitCopy(C_env env)" + 
-		    " not declared");
-  }
-
-  public void TypeDecl.C_emitCopy(C_env env) {
-  }
-
-  public void SampleDecl.C_emitCopy(C_env env) {
-    final String dst = "dst";
-    final String src = "src";
-    C_env env_src = env.nestStruct(src).setPointer();
-    C_env env_dst = env.nestStruct(dst).setPointer();
-
-    C_emitCopyFunctionParam(env_src, src, dst);
-    env_src.println("");
-    env_src.println("{");
-    env_src.indent();
-    getType().C_emitCopy(env_src, env_dst);
-    env_src.unindent();
-    env_src.println("}");
-  }
-
-  public void Type.C_emitCopy(C_env env_src, C_env env_dst) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitCopy(C_env env)" + 
-		    " not declared");
-  }
-
-  public void VoidType.C_emitCopy(C_env env_src, C_env env_dst) {
-  }
-
-  public void PrimType.C_emitCopy(C_env env_src, C_env env_dst) {
-    if (C_isDynamic()) {
-      env_src.println(String.format(
-	  "%s%s = labcomm2014_memory_alloc(mem, 1, strlen(%s%s)+1);",
-	  env_dst.accessor(), env_dst.qualid,
-	  env_src.accessor(), env_src.qualid));
-      env_src.println(String.format(
-	  "memcpy(%s%s, %s%s, strlen(%s%s)+1);",
-	  env_dst.accessor(), env_dst.qualid,
-	  env_src.accessor(), env_src.qualid,
-	  env_src.accessor(), env_src.qualid));
-    } else {
-      env_src.println(env_dst.accessor() + env_dst.qualid + " = " +
-		      env_src.accessor() + env_src.qualid + ";");
-    }
-  }
-
-  public void UserType.C_emitCopy(C_env env_src, C_env env_dst) {
-    lookupType(getName()).getType().C_emitCopy(env_src, env_dst);
-  }
-
-  public void StructType.C_emitCopy(C_env env_src, C_env env_dst) {
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).C_emitCopy(env_src, env_dst);
-    }
-  }
-
-  public void ArrayType.C_emitCopy(C_env env_src, C_env env_dst) {
-    C_emitCopyDecodeLimit(env_src, env_dst);
-    C_emitCopyArrayAllocate(env_src, env_dst);
-    env_src.println("{");
-    env_src.indent();
-    C_emitLoopVariables(env_src);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String iterator = "i_" + env_src.depth + "_" + i;
-      env_src.println("for (" + iterator + " = 0" +
-		  " ; " +
-		  iterator + " < " + getExp(i).C_getLimit(env_src, i) +
-		  " ; " +
-		  iterator + "++) {");
-      env_src.indent();
-    }
-    C_emitCalcIndex(env_src);
-    getType().C_emitCopy(C_Nest(env_src), C_Nest(env_dst));
-    for (int i = getNumExp() - 1 ; i >= 0 ; i--) {
-      env_src.unindent();
-      env_src.println("}");
-    }
-    env_src.unindent();
-    env_src.println("}");
-  }
-
-  public void Field.C_emitCopy(C_env env_src, C_env env_dst) {
-    String fnam = env_src.memberAccessor() + getName();
-    getType().C_emitCopy(env_src.nestStruct(fnam), env_dst.nestStruct(fnam));
-  }
-
-  public void Exp.C_emitCopyDecodeLimit(C_env env_src, C_env env_dst, int i) {
-    // Ordinary array has no length-member.
-  }
-
-  public void VariableSize.C_emitCopyDecodeLimit(C_env env_src, C_env env_dst, int i) {
-    String src = env_src.qualid + env_src.memberAccessor() + "n_" + i;
-    String dst = env_dst.qualid + env_dst.memberAccessor() + "n_" + i;
-    env_src.println(dst + " = " + src + ";");
-  }
-
-  public void ArrayType.C_emitCopyDecodeLimit(C_env env_src, C_env env_dst) {
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      getExp(i).C_emitCopyDecodeLimit(env_src, env_dst, i);
-    }
-  }
-
-  public void ArrayType.C_emitCopyArrayAllocate(C_env env_src, C_env env_dst) {
-  }
-
-  public void VariableArrayType.C_emitCopyArrayAllocate(C_env env_src,
-							C_env env_dst)
-  {
-    env_src.print(env_dst.qualid + env_dst.memberAccessor() +
-                  "a = labcomm2014_memory_alloc(mem, 1, sizeof(" +
-		  env_src.qualid + env_src.memberAccessor() + "a[0])");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env_src.print(" * " + getExp(i).C_getLimit(env_src, i));
-    }
-    env_dst.println(");");
-  }
-
-  // Code for deallocation of dynamically allocated data in a copy.
-
-  private void SampleDecl.C_emitCopyDeallocationFunctionParam(C_env env,
-							      String par)
-  {
-    env.println("void labcomm2014_copy_free_" +
-                env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_memory *mem,");
-    env.println(env.prefix + getName() + " *" + par);
-    env.unindent();
-    env.print(")");
-  }
-
-  public void Decl.C_emitCopyDeallocationDeclaration(C_env env) {
-  }
-
-  public void SampleDecl.C_emitCopyDeallocationDeclaration(C_env env) {
-    C_emitCopyDeallocationFunctionParam(env, "c");
-    env.println(";");
-  }
-
-  public void Decl.C_emitCopyDeallocation(C_env env) {
-    throw new Error(this.getClass().getName() +
-		    ".C_emitCopy(C_env env)" +
-		    " not declared");
-  }
-
-  public void TypeDecl.C_emitCopyDeallocation(C_env env) {
-  }
-
-  public void SampleDecl.C_emitCopyDeallocation(C_env env) {
-    String par = "par";
-    env = env.nestStruct(par).setPointer();
-
-    C_emitCopyDeallocationFunctionParam(env, par);
-    env.println("");
-    env.println("{");
-    env.indent();
-    getType().C_emitCopyDeallocation(env);
-    env.unindent();
-    env.println("}");
-  }
-
-  public void Type.C_emitCopyDeallocation(C_env env) {
-    throw new Error(this.getClass().getName() +
-  		    ".C_emitCopyDeallocation(C_env env)" +
-  		    " not declared");
-  }
-
-  public void VoidType.C_emitCopyDeallocation(C_env env) {
-  }
-
-  public void PrimType.C_emitCopyDeallocation(C_env env) {
-    if (C_isDynamic()) {
-      env.println("labcomm2014_memory_free(mem, 1, " +
-                  env.accessor() + env.qualid + ");");
-    }
-  }
-
-  public void UserType.C_emitCopyDeallocation(C_env env) {
-    if (C_isDynamic()) {
-      lookupType(getName()).getType().C_emitCopyDeallocation(env);
-    }
-  }
-
-  public void StructType.C_emitCopyDeallocation(C_env env) {
-    if (C_isDynamic()) {
-      for (int i = 0 ; i < getNumField() ; i++) {
-  	getField(i).C_emitCopyDeallocation(env);
-      }
-    }
-  }
-
-  public void ArrayType.C_emitCopyDeallocation(C_env env) {
-    if (getType().C_isDynamic()) {
-      env.println("{");
-      env.indent();
-      C_emitLoopVariables(env);
-      for (int i = 0 ; i < getNumExp() ; i++) {
-  	String iterator = "i_" + env.depth + "_" + i;
-  	env.println("for (" + iterator + " = 0" +
-  		    " ; " +
-  		    iterator + " < " + getExp(i).C_getLimit(env, i) +
-  		    " ; " +
-  		    iterator + "++) {");
-  	env.indent();
-      }
-      C_emitCalcIndex(env);
-      getType().C_emitCopyDeallocation(C_Nest(env));
-      for (int i = 0 ; i < getNumExp() ; i++) {
-  	env.unindent();
-  	env.println("}");
-      }
-      env.unindent();
-      env.println("}");
-    }
-  }
-
-  public void VariableArrayType.C_emitCopyDeallocation(C_env env) {
-    super.C_emitCopyDeallocation(env);
-    env.println("labcomm2014_memory_free(mem, 1, " +
-                env.qualid + env.memberAccessor() + "a);");
-  }
-
-  public void Field.C_emitCopyDeallocation(C_env env) {
-    getType().C_emitCopyDeallocation(env.nestStruct(env.memberAccessor()
-						    + getName()));
-  }
-}
-
-aspect C_DecoderIoctl {
-
-  public void Decl.C_emitDecoderIoctl(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitDecoderIoctl(C_env env)" + 
-		    " not declared");
-  }
-
-  public void TypeDecl.C_emitDecoderIoctl(C_env env) {
-  }
-
-  public void SampleDecl.C_emitDecoderIoctl(C_env env) {
-    env.println("int labcomm2014_decoder_ioctl_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_decoder *d,");
-    env.println("int ioctl_action,");
-    env.println("...");
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println("int result;");
-    env.println("va_list va;");
-    env.println("va_start(va, ioctl_action);");
-    env.println("result = labcomm2014_internal_decoder_ioctl(");
-    env.indent();
-    env.println("d, &signature_" + env.prefix + getName() + ", ");
-    env.println("ioctl_action, va);");
-    env.unindent();
-    env.println("va_end(va);");
-    env.println("return result;");
-    env.unindent();
-    env.println("}");
-  }
-}
-
-
-aspect C_Encoder {
-
-  public void Decl.C_emitEncoder(C_env env) {
-    throw new Error(this.getClass().getName() + 
-        ".C_emitEncoder()" + 
-        " not declared");
-  }
-
-  public void TypeDecl.C_emitEncoder(C_env env) {
-    // do nothing for type decls
-  }
-
-  public void SampleDecl.C_emitEncoder(C_env env) {
-    env = env.nestStruct("(*v)");
-    env.println("static int encode_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_writer *w");
-    if(!isVoid() ) {
-        env.println(", "+env.prefix + getName() + " *v");
-    }
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println("int result = 0;");
-    getType().C_emitEncoder(env);
-    env.println("return result;");
-    env.unindent();
-    env.println("}");
-
-    // Typesafe encode wrapper
-    env.println("int labcomm2014_encode_" + env.prefix + getName() + "(");
-    env.println("struct labcomm2014_encoder *e");
-    if(!isVoid() ) {
-        env.println(", "+env.prefix + getName() + " *v");
-    }
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println("return labcomm2014_internal_encode(e, &signature_" + 
-		env.prefix + getName() + 
-		", (labcomm2014_encoder_function)encode_" + 
-                env.prefix + getName() +
-		(!isVoid()?", v":", NULL")+");");
-    env.unindent();
-    env.println("}");
-  }
-
-  public void Type.C_emitEncoder(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitEncoder(C_env env)" + 
-		    " not declared");
-  }
-
-  public void VoidType.C_emitEncoder(C_env env) {
-    env.println("result = 0;");
-  }
-
-  public void PrimType.C_emitEncoder(C_env env) {
-    env.print("result = ");
-    switch (getToken()) {
-      case LABCOMM_SAMPLE: { 
-        env.println("labcomm2014_write_int(w, " + 
-                    "labcomm2014_internal_encoder_signature_to_index(w->encoder, " +
-                    env.qualid + "));");
-      } break;
-      default: {
-        env.println("labcomm2014_write_" + getName() + 
-                    "(w, " + env.qualid + ");");
-      } break;
-    }
-    env.println("if (result != 0) { return result; }");
-  }
-
-  public void UserType.C_emitEncoder(C_env env) {
-    decl().getType().C_emitEncoder(env);
-  }
-
-  public void StructType.C_emitEncoder(C_env env) {
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).C_emitEncoder(env);
-    }
-  }
-
-  public void ArrayType.C_emitEncoder(C_env env) {
-    C_emitEncoderEncodeLimit(env);
-    env.println("{");
-    env.indent();
-    C_emitLoopVariables(env);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String iterator = "i_" + env.depth + "_" + i;
-      env.println("for (" + iterator + " = 0" +
-		  " ; " +
-		  iterator + " < " + getExp(i).C_getLimit(env, i) +
-		  " ; " +
-		  iterator + "++) {");
-      env.indent();
-    }
-    C_emitCalcIndex(env);
-    getType().C_emitEncoder(C_Nest(env));
-    for (int i = getNumExp() - 1 ; i >= 0 ; i--) {
-      env.unindent();
-      env.println("}");
-    }
-    env.unindent();
-    env.println("}");
-  }
-
-  public void Field.C_emitEncoder(C_env env) {
-    getType().C_emitEncoder(env.nestStruct("." + getName()));
-  }
-
-  public void Exp.C_emitEncoderEncodeLimit(C_env env, int i) {
-  }
-
-  public void VariableSize.C_emitEncoderEncodeLimit(C_env env, int i) {
-    env.println("labcomm2014_write_packed32(w, " + env.qualid + ".n_" + i + ");");
-  }
-
-  public void ArrayType.C_emitEncoderEncodeLimit(C_env env) {
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      getExp(i).C_emitEncoderEncodeLimit(env, i);
-    }
-  }
-
-  public void Decl.C_emitEncoderRegisterHandler(C_env env) {
-    throw new Error(this.getClass().getName() + 
-  		    ".C_emitEncoderRegisterHandler(C_env env)" + 
-  		    " not declared");
-  }
-  
-  protected void Decl.C_emitEncoderTypeRegister(C_env env) {
-    env.println("int labcomm2014_encoder_type_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_encoder *e");
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println("//TODO: add error handling for dependencies");
-
-    C_emitUserTypeDeps(env, null, true); 
-
-    if(!isSampleDecl() || hasDependencies()) {
-      env.println("return labcomm2014_internal_encoder_type_register(");
-      env.indent();
-      env.println("e,");
-      env.println("&signature_" + env.prefix + getName() + "");
-      env.unindent();
-      env.println(");");
-    } else {
-      env.println("// the type has no dependencies, do nothing");
-      env.println("return 0;");
-    }
-    env.unindent();
-    env.println("}");
-  }
-  public void TypeDecl.C_emitEncoderRegisterHandler(C_env env) {
-    C_emitEncoderTypeRegister(env);
-  }
-  
-  public void SampleDecl.C_emitEncoderRegisterHandler(C_env env) {
-    C_emitEncoderTypeRegister(env);
-    env.println("int labcomm2014_encoder_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_encoder *e");
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    C_emitUserTypeDeps(env, null, false); //XXX HERE BE DRAGONS
-                                          //currently set to false to turn off
-                                          //outputting of code
-    env.println("int result = labcomm2014_internal_encoder_register(");
-    env.indent();
-    env.println("e,");
-    env.println("&signature_" + env.prefix + getName() + ",");
-    env.println("(labcomm2014_encoder_function)encode_" + env.prefix + getName());
-    env.unindent();
-    env.println(");");
-    env.println("if(result >= 0) {\n");
-    env.indent();
-    env.println("labcomm2014_encoder_type_register_" + env.prefix + getName()+"(e);");
-    env.println("labcomm2014_internal_encoder_type_bind(");
-    env.indent();
-    env.println("e,");
-    env.println("&signature_" + env.prefix + getName() + ",");
-    env.println( (hasDependencies() ? "1" : "0")  + ");");
-    env.unindent();
-    env.println("}");
-    env.unindent();
-    env.println("return result;");
-    env.unindent();
-    env.println("}");
-  }
-}
-
-aspect C_EncoderIoctl {
-
-  public void Decl.C_emitEncoderIoctl(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitEncoderIoctl()" + 
-		    " not declared");
-  }
-
-  public void TypeDecl.C_emitEncoderIoctl(C_env env) {
-  }
-
-  public void SampleDecl.C_emitEncoderIoctl(C_env env) {
-    env.println("int labcomm2014_encoder_ioctl_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm2014_encoder *e,");
-    env.println("int ioctl_action,");
-    env.println("...");
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println("int result;");
-    env.println("va_list va;");
-    env.println("va_start(va, ioctl_action);");
-    env.println("result = labcomm2014_internal_encoder_ioctl(");
-    env.indent();
-    env.println("e, &signature_" + env.prefix + getName() + ", ");
-    env.println("ioctl_action, va);");
-    env.unindent();
-    env.println("va_end(va);");
-    env.println("return result;");
-    env.unindent();
-    env.println("}");
-  }
-
-}
-
-aspect C_TypeDependencies {
-  public void Decl.C_emitUserTypeDeps(C_env env, String via, boolean outputCode) {
-    if( hasDependencies() ) {
-        Iterator<Decl> it = type_dependencies().iterator();
-        while(it.hasNext()) {
-            Decl t = it.next();
-
-            t.C_emitUserTypeDeps(env, t.getName(), outputCode);
-            if(outputCode) {
-               env.println("labcomm2014_encoder_type_register_"+env.prefix + t.getName()+"(e);");
-            } else {  // Just output a comment
-	        String refpath = (via == null) ? "directly" : "indirectly via "+via;
-	       env.println(" //Depends ("+refpath+") on "+t.getName() );
-            }
-        }
-    } 
-  }
-
-  public void Decl.C_emitUserTypeRefs(C_env env, String via, boolean outputCode) {
-    if( isReferenced() ) {
-        Iterator<Decl> it = type_references().iterator();
-        while(it.hasNext()) {
-            Decl t = it.next();
-
-            t.C_emitUserTypeRefs(env, t.getName(), outputCode);
-            if(outputCode) {
-               env.println("labcomm2014_encoder_type_register_"+env.prefix + t.getName()+"(e);");
-            } else {  // Just output a comment
-	        String refpath = (via == null) ? "directly" : "indirectly via "+via;
-	       env.println(" //Is referenced ("+refpath+")  by "+t.getName() );
-            }
-        }
-    } 
-  }
-}
-
-aspect C_Signature {
-
-  public void ASTNode.C_emitSignature(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitSignature(C_env env)" + 
-		    " not declared");
-  }
-
-  syn String Decl.C_DeclTypeString();
-  eq SampleDecl.C_DeclTypeString() = "LABCOMM_SAMPLE";
-  eq TypeDecl.C_DeclTypeString() = "LABCOMM_TYPEDEF";
-
-  public void Decl.C_emitSignature(C_env env) {
-    if( (true || isReferenced() || isSampleDecl())){
-      Signature signature = getSignature();
-      signature.C_emitSignature(env, !isSampleDecl());
-      C_emitFlatSignature(env);
-    } else {
-      env.println("// not emitting signature for " + getName() +
-                  "referenced=" + isReferenced() +
-                  "sampledecl=" + isSampleDecl());
-    }
-  }
-
-  public void ASTNode.C_emitFlatSignature(C_env env) {
-    throw new Error(this.getClass().getName() + 
-                    ".C_emitFlatSignature(C_env env)" + 
-                    " not declared");
-  }
-
-  public void TypeDecl.C_emitFlatSignature(C_env env) {
-    C_emitSizeofValue(env);
-    env.println("static struct labcomm2014_signature " +
-                "signature_" + env.prefix + getName() + " = {");
-    env.indent();
-    env.println("\"" + getName() + "\",");
-    //env.println("sizeof_" + env.prefix + getName() + ",");
-    //HERE BE DRAGONS? do we need sizeof for typedefs?
-    env.println("NULL,");
-    env.println("0,");
-    env.println("NULL,");
-    env.println("0,"); // index
-    env.println("sizeof(signature_tree_" + env.prefix + getName() + "),");
-    env.println("signature_tree_" + env.prefix + getName() + "");
-    env.unindent();
-    env.println(" };");
-    env.println("const struct labcomm2014_signature " +
-                "*labcomm2014_signature_" + env.prefix + getName() + 
-                " = &signature_" + env.prefix + getName() + ";");
-  }
-
-  public void SampleDecl.C_emitFlatSignature(C_env env){
-    env.println("static unsigned char signature_bytes_" + 
-  	        env.prefix + getName() + "[] = {");
-    SignatureList signature = flatSignature(env.version);
-    for (int i = 0 ; i < signature.size() ; i++) {
-      String comment = signature.getComment(i);
-      if (comment != null) {
-        env.println(signature.getIndent(i) + "// " + comment);
-      }
-      byte[] data = signature.getData(i, env.version);
-      if (data != null) {
-        env.print(signature.getIndent(i));
-        for (int j = 0 ; j < data.length ; j++) {
-          env.print(data[j] + ", ");
-        }
-        env.println("");
-      }
-    }
-    env.println("};");
-
-    C_emitSizeofValue(env);
-    env.println("static struct labcomm2014_signature " +
-                "signature_" + env.prefix + getName() + " = {");
-    env.indent();
-    env.println("\"" + getName() + "\",");
-    env.println("sizeof_" + env.prefix + getName() + ",");
-    env.println("sizeof(signature_bytes_" + env.prefix + getName() + "),");
-    env.println("signature_bytes_" + env.prefix + getName() + ",");
-    env.println("0,"); // index
-    env.println("sizeof(signature_tree_" + env.prefix + getName() + "),");
-    env.println("signature_tree_" + env.prefix + getName() + "");
-    env.unindent();
-    env.println(" };");
-    env.println("const struct labcomm2014_signature " +
-                "*labcomm2014_signature_" + env.prefix + getName() + 
-                " = &signature_" + env.prefix + getName() + ";");
-  }
-
-    public void Signature.C_emitSignature(C_env env, boolean decl){
-      getSignatureList().C_emitSignature(env, decl);
-    }
-
-    public abstract void SignatureLine.C_emitSignature(C_env env, boolean decl);
-
-    public void TypeRefSignatureLine.C_emitSignature(C_env env, boolean isDecl){ 
-      env.print(getIndentString());
-    //  env.println("LABCOMM_SIGDEF_SIGNATURE(labcomm2014_signature_" + env.prefix + decl.getName() +"),");
-      env.println("LABCOMM_SIGDEF_SIGNATURE(signature_" + env.prefix + decl.getName() +"),");
-    }
-
-    public void DataSignatureLine.C_emitSignature(C_env env, boolean decl){ 
-          String comment = getComment();
-          if (comment != null && comment.length() > 0) {
-            env.println(getIndentString() + "// " + comment);
-          }
-          byte[] data = getData(env.version);
-          if (data != null && data.length > 0) {
-            env.print(getIndentString());
-            env.print("LABCOMM_SIGDEF_BYTES("+data.length+", \"");
-            for (int j = 0 ; j < data.length ; j++) {
-              byte d = data[j];
-              //if(d>='a'&&d<='z' || d>='A'&&d<='Z'|| d>='0'&&d<='9'  )
-              //  env.print(""+(char)d);
-              //else
-              env.print("\\x"+Integer.toHexString(d));
-            }
-            env.println("\"),");
-        }
-    }
-//
-//
-//      byte[] data = getData(env.version);
-//        if (data != null) {
-//            for (int j = 0 ; j < data.length ; j++) {
-//                env.print(getIndentString());
-//                //env.print("printf(\"labcomm2014_write_byte( w, (unsigned char)"+ String.format("0x%02X ", data[j]) +")\\n\"); ");
-//                env.print("labcomm2014_write_byte( w, (unsigned char)"+ String.format("0x%02X ", data[j]) +"); ");
-//                env.println("if (result != 0) { return result; }");
-//            }
-//            env.println();
-//        }
-//
-//}
-  public void SignatureList.C_emitSignature(C_env env, boolean decl) { 
-  env.println("static struct labcomm2014_signature_data signature_tree_" + 
-  	 env.prefix + parentDecl().getName() + "[] = {");
-  env.indent();
-  for (int i = 0 ; i < size() ; i++) {
-    SignatureLine l = getSignatureLine(i);
-    l.C_emitSignature(env, decl);
-  }
-  
-  env.println("LABCOMM_SIGDEF_END");
-  env.println("};");
-  env.unindent();
-  env.println();
-  }
-
-
-
-//  public void SampleDecl.C_emitSignature(C_env env) {
-//    env.println("static unsigned char signature_bytes_" + 
-//		       env.prefix + getName() + "[] = {");
-//    SignatureList signature = signature(env.version);
-//    for (int i = 0 ; i < signature.size() ; i++) {
-//      String comment = signature.getComment(i);
-//      if (comment != null) {
-//        env.println(signature.getIndent(i) + "// " + comment);
-//      }
-//      byte[] data = signature.getData(i);
-//      if (data != null) {
-//        env.print(signature.getIndent(i));
-//        for (int j = 0 ; j < data.length ; j++) {
-//          env.print(data[j] + ", ");
-//        }
-//        env.println("");
-//      }
-//    }
-//    env.println("};");
-//    env.println("struct labcomm2014_signature labcomm2014_signature_" + 
-//		env.prefix + getName() + " = {");
-//    env.indent();
-//    env.println("LABCOMM_SAMPLE, \"" + getName() + "\",");
-//    env.println("(int (*)(struct labcomm2014_signature *, void *))labcomm2014_sizeof_" + 
-//		env.prefix + getName() + ",");
-//    env.println("sizeof(signature_bytes_" + env.prefix + getName() + "),");
-//    env.println("signature_bytes_" + env.prefix + getName() + ",");
-//    env.println("0");
-//    env.unindent();
-//    env.println(" };");
-//  }
-
-}
-aspect C_Constructor {
-  public void ASTNode.C_emitConstructor(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitConstructor(C_env env)" + 
-		    " not declared");
-  }
-
-  public void Program.C_emitConstructor(C_env env) {
-    env.println("LABCOMM_CONSTRUCTOR void init_" +
-		env.prefix + "_signatures(void)");
-    env.println("{");
-    env.indent();
-    env.println("static int initialized = 0;");
-    env.println("if (initialized == 0) {");
-    env.indent();
-    env.println("initialized = 1;");
-    for (int i = 0; i < getNumDecl(); i++) {
-      getDecl(i).C_emitConstructor(env);
-    }
-    env.unindent();
-    env.println("}"); 
-    env.unindent();
-    env.println("}"); 
-  }
-
-  public void TypeDecl.C_emitConstructor(C_env env) {
-    if (isReferenced()) {
-      env.println("labcomm2014_set_local_index(&signature_" +
-                  env.prefix + getName() + ");");
-    }
-  }
-
-  public void SampleDecl.C_emitConstructor(C_env env) {
-    env.println("labcomm2014_set_local_index(&signature_" + 
-		env.prefix + getName() + ");");
-  }
-
-
-  public void ASTNode.C_emitConstructorDeclaration(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_emitConstructorDeclaration(C_env env)" + 
-		    " not declared");
-  }
-
-  public void Program.C_emitConstructorDeclaration(C_env env) {
-    env.println("void init_" + env.prefix + "_signatures(void);");
-  }
-
-}
-
-aspect C_Sizeof {
-
-  public void Decl.C_emitSizeofDeclaration(C_env env) {
-  }
-
-  public void SampleDecl.C_emitSizeofDeclaration(C_env env) {
-    env.println("extern int labcomm2014_sizeof_" + env.prefix + getName() +
-        "(" + env.prefix + getName() + " *v);");
-  }
-
-  public int Decl.C_fixedSizeof() {
-    return getType().C_fixedSizeof();
-  }
-
-  public void Decl.C_emitSizeof(C_env env) {
-  }
-
-  public void SampleDecl.C_emitSizeof(C_env env) {
-    env = env.nestStruct("(*v)");
-    env.println("int labcomm2014_sizeof_" + env.prefix + getName() +
-        "(" + env.prefix + getName() + " *v)");
-    env.println("{");
-    env.indent();
-    env.println("return labcomm2014_internal_sizeof(" +
-                "&signature_" + env.prefix + getName() +
-                ", v);");
-    env.unindent();
-    env.println("}");
-  }
-
-  public int Type.C_fixedSizeof() {
-    throw new Error(this.getClass().getName() + 
-            ".C_fixedSizeof()" + 
-            " not declared");
-  }
-
-  public int VoidType.C_fixedSizeof() {
-    return 0;
-  }
-
-  public int PrimType.C_fixedSizeof() {
-    switch (getToken()) {
-      case LABCOMM_BOOLEAN: { return 1; } 
-      case LABCOMM_BYTE: { return 1; } 
-      case LABCOMM_SHORT: { return 2; } 
-      case LABCOMM_INT: { return 4; } 
-      case LABCOMM_LONG: { return 8; }
-      case LABCOMM_FLOAT: { return 4; }
-      case LABCOMM_DOUBLE: { return 8; }
-      case LABCOMM_SAMPLE: { return 4; }
-      default: { 
-    throw new Error(this.getClass().getName() + 
-            ".C_fixedSizeof()" + 
-            " unknown size (" + getName() + ")"); 
-      } 
-    }
-  }
-
-  public int UserType.C_fixedSizeof() {
-    return lookupType(getName()).getType().C_fixedSizeof();
-  }
-
-  public int StructType.C_fixedSizeof() {
-    int result = 0;
-    for (int i = 0 ; i < getNumField() ; i++) {
-      result += getField(i).getType().C_fixedSizeof();
-    }
-    return result;
-  }
-
-  public int ArrayType.C_fixedSizeof() {
-    int elements = 1;
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      int n = Integer.parseInt(((IntegerLiteral)getExp(i)).getValue());
-      elements = elements * n;
-    }
-    return getType().C_fixedSizeof() * elements;
-  }
-
-  public void Decl.C_emitSizeofValue(C_env env) {
-  }
-
-  public void SampleDecl.C_emitSizeofValue(C_env env) {
-    env = env.nestStruct("(*v)");
-    env.println("static int sizeof_" + env.prefix + getName() + "(void *vv)");
-    env.println("{");
-    env.indent();
-    env.println("int result = 0;");
-    if (C_isDynamic()) {
-      env.println(env.prefix + getName() + " *v = vv;");
-      getType().C_emitSizeof(env);
-    } else {
-      env.println("result += " + C_fixedSizeof() + ";");
-    }    
-    env.println("return result;");
-    env.unindent();
-    env.println("}");
-  }
-
-  public void Type.C_emitSizeof(C_env env) {
-    throw new Error(this.getClass().getName() + 
-            ".C_emitSizeof(C_env env)" + 
-            " not declared");
-  }
-
-  public void PrimType.C_emitSizeof(C_env env) {
-    switch (getToken()) {
-      case LABCOMM_STRING: { 
-        env.print("{ int l = strlen(" + env.qualid + "); ");
-    env.println("result += labcomm2014_size_packed32(l) + l; }"); 
-      } break;
-      default: { 
-    throw new Error(this.getClass().getName() + 
-            ".C_emitSizeof(C_env env)" + 
-            " known size (" + getName() + ")"); 
-      } 
-    }
-  }
-
-  public void UserType.C_emitSizeof(C_env env) {
-    lookupType(getName()).getType().C_emitSizeof(env);
-  }
-
-  public void StructType.C_emitSizeof(C_env env) {
-    int fixed = 0;
-    for (int i = 0 ; i < getNumField() ; i++) {
-      if (getField(i).getType().C_isDynamic()) {
-        getField(i).getType().C_emitSizeof(
-        env.nestStruct("." + getField(i).getName()));
-      } else {
-        fixed += getField(i).getType().C_fixedSizeof();
-      }
-    }
-    if (fixed > 0) {
-      env.println("result += " + fixed + ";");
-    }
-  }
-
-  public void Exp.C_emitSizeof(C_env env, int i) {
-  }
-
-  public void VariableSize.C_emitSizeof(C_env env, int i) {
-    env.println("result += labcomm2014_size_packed32(" + 
-                env.qualid + env.memberAccessor() + "n_" + i + ");");
-  }
-
-  public void ArrayType.C_emitSizeof(C_env env) {
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      getExp(i).C_emitSizeof(env, i);
-    }
-    if (getType().C_isDynamic()) {
-      env.println("{");
-      env.indent();
-      C_emitLoopVariables(env);
-      for (int i = 0 ; i < getNumExp() ; i++) {
-        String iterator = "i_" + env.depth + "_" + i;
-        env.println("for (" + iterator + " = 0" +
-                    " ; " +
-                    iterator + " < " + getExp(i).C_getLimit(env, i) +
-                    " ; " +
-                    iterator + "++) {");
-        env.indent();
-      }
-      C_emitCalcIndex(env);
-      getType().C_emitSizeof(C_Nest(env));
-      for (int i = 0 ; i < getNumExp() ; i++) {
-        env.unindent();
-        env.println("}");
-      }
-      env.unindent();
-      env.println("}");
-    } else {
-      env.print("result += " + getType().C_fixedSizeof());
-      for (int i = 0 ; i < getNumExp() ; i++) {
-        env.print(" * " + getExp(i).C_getLimit(env, i));
-      }
-      env.println(";");      
-    }
-  }
-}
-
-aspect C_forAll {
-
-  public void Program.C_emitForAll(C_env env) {
-    env.print("#define LABCOMM_FORALL_SAMPLES_" + env.lcName + 
-		"(func, sep)");
-    env.indent();
-    boolean needSeparator = false;
-    for (int i = 0; i < getNumDecl(); i++) {
-      String s = getDecl(i).C_forAll(env);
-      if (s != null) {
-	if (needSeparator) { env.print(" sep"); }
-	env.println(" \\");
-	env.print(s);
-	needSeparator = true;
-      }
-    }
-    env.println("");
-    env.unindent();
-  }
-  
-  public String Decl.C_forAll(C_env env) {
-    return null;
-  }
-
-  public String SampleDecl.C_forAll(C_env env) {
-    return "func(" + getName() + ", " + env.prefix + getName() + ")";
-  }
-
-}
-
-aspect C_Info {
-
-  public void Program.C_info(PrintStream out, String prefix, int version) {
-    C_env env = new C_env("", "", prefix, out, version);
-    for (int i = 0; i < getNumDecl(); i++) {
-      getDecl(i).C_info(env);
-    }
-  }
-
-  public void Decl.C_info(C_env env) {
-    throw new Error(this.getClass().getName() + 
-		    ".C_info((C_env env)" + 
-		    " not declared");
-  }
-
-  public void TypeDecl.C_info(C_env env) {
-    env.println(",C,typedef," + env.prefix + getName() + "," + 
-                 env.prefix + getName() + "," +
-                 C_info_type_or_void(env.prefix));
-  }
-
-  public void SampleDecl.C_info(C_env env) {
-    env.println(",C,sample," + env.prefix + getName() + "," + 
-                 env.prefix + getName() + "," +
-                 C_info_type_or_void(env.prefix));
-  }
-
-  // make void types explicitly as they require special treatment
-  // in encoder/decoder calls
-  protected String Decl.C_info_type_or_void(String prefix) {
-    if(isVoid() ) {
-      return "void";
-    } else {
-      return prefix + getName() ;
-    }
-  }
-}
diff --git a/compiler/2014/DeclNames.jrag b/compiler/2014/DeclNames.jrag
deleted file mode 100644
index 042739b0f9d229f550d38a76cfc5b19e445eee22..0000000000000000000000000000000000000000
--- a/compiler/2014/DeclNames.jrag
+++ /dev/null
@@ -1,14 +0,0 @@
-aspect DeclNames {
-	inh String Type.declName();
-	eq Decl.getType().declName() = getName();
-
-	inh String Field.declName();
-	eq StructType.getField(int i).declName() = declName();
-    
-        //TODO: aspect should be renamed to parent-something
-
-        inh Decl Type.parentDecl();
-        inh Decl Field.parentDecl();
-        eq Decl.getType().parentDecl() = this;
-        eq StructType.getField(int i).parentDecl() = parentDecl();
-}
diff --git a/compiler/2014/ErrorCheck.jrag b/compiler/2014/ErrorCheck.jrag
deleted file mode 100644
index caa80815456d4c1a390f2f80f7a5a7e5f74c0b8d..0000000000000000000000000000000000000000
--- a/compiler/2014/ErrorCheck.jrag
+++ /dev/null
@@ -1,31 +0,0 @@
-import java.util.Collection;
-
-aspect ErrorCheck {
-
-	syn int ASTNode.lineNumber() = getLine(getStart());
-
-	protected String ASTNode.errors = null;
-	
-	protected void ASTNode.error(String s) {
-	    s = "Error at " + lineNumber() + ": " + s;
-	    if(errors == null) {
-	      errors = s;
-	    } else {
-	      errors = errors + "\n" + s;
-	    }
-	}
-
-	protected boolean ASTNode.hasErrors() {
-		return errors != null;
-	}
-	public void ASTNode.errorCheck(Collection collection) {
-	    nameCheck();
-            typeCheck();
-	    if(hasErrors())
-		collection.add(errors);
-	    for(int i = 0; i < getNumChild(); i++) {
-		getChild(i).errorCheck(collection);
-	    }
-	}
-
-}
diff --git a/compiler/2014/FlatSignature.jrag b/compiler/2014/FlatSignature.jrag
deleted file mode 100644
index b96c119ce386f0a0d2b7e9e2c1edb001050e5f27..0000000000000000000000000000000000000000
--- a/compiler/2014/FlatSignature.jrag
+++ /dev/null
@@ -1,123 +0,0 @@
-import java.util.*;
-
-aspect FlatSignature {  
-
-  public SignatureList Decl.flatSignature(int version) {
-    SignatureList result = getSignature().getFlatSignatureList();
-    return result;
-  }
-  
-  public void ASTNode.flatSignature(SignatureList list) {
-    throw new Error(this.getClass().getName() + 
-                    ".flatSignature(SignatureList list)" + 
-                    " not declared");
-  }
-
-  public void TypeDecl.flatSignature(SignatureList list) {
-    getType().flatSignature(list);
-  }
-
-  public void SampleDecl.flatSignature(SignatureList list) {
-    getType().flatSignature(list);
-  }
-
-//  public void SampleRefType.flatSignature(SignatureList list) {
-//    list.addInt(LABCOMM_SAMPLE_REF, "sample");
-//  }
-
-  public void VoidType.flatSignature(SignatureList list) {
-    list.addInt(LABCOMM_STRUCT, "void");
-    list.addInt(0, null);
-  }
-
-  public void PrimType.flatSignature(SignatureList list) {
-    list.addInt(getToken(), null);
-  }
-
-  public void UserType.flatSignature(SignatureList list) {
-    lookupType(getName()).flatSignature(list);
-  }
-
-  public void ArrayType.flatSignature(SignatureList list) {
-    list.addInt(LABCOMM_ARRAY, signatureComment());
-    list.indent();
-    list.addInt(getNumExp(), null);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      getExp(i).flatSignature(list);
-    }
-    getType().flatSignature(list);
-    list.unindent();
-    list.add(null, "}");
-  }
-
-  public void StructType.flatSignature(SignatureList list) {
-    list.addInt(LABCOMM_STRUCT, "struct { " + getNumField() + " fields");
-    list.indent();
-    list.addInt(getNumField(), null);
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).flatSignature(list);
-    }
-    list.unindent();
-    list.add(null, "}");
-  }
-
-  public void Field.flatSignature(SignatureList list) {
-    list.addString(getName(), signatureComment());
-    getType().flatSignature(list);
-  }
-
-  public void IntegerLiteral.flatSignature(SignatureList list) {
-    list.addInt(Integer.parseInt(getValue()), null);
-  }
-
-  public void VariableSize.flatSignature(SignatureList list) {
-    list.addInt(0, null);
-  }
-
-  public String ArrayType.signatureComment() {
-    StringBuffer result = new StringBuffer("array [");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      if (i > 0) {
-	result.append(", ");
-      }
-      result.append(getExp(i).signatureComment());
-    }
-    result.append("]");
-    return result.toString();
-  }
-
-  public String ASTNode.signatureComment() {
-    throw new Error(this.getClass().getName() + 
-                    ".signatureComment()" + 
-                    " not declared");
-  }
-
-  public String Field.signatureComment() {
-    return getType().signatureComment() + " '" + getName() +"'";
-  }
-
-//  public String SampleRefType.signatureComment() {
-//    return "sample";
-//  }
-
-  public String PrimType.signatureComment() {
-    return getName();
-  }
-
-  public String UserType.signatureComment() {
-    return getName();
-  }
-
-  public String StructType.signatureComment() {
-    return "struct";
-  }
-
-  public String IntegerLiteral.signatureComment() {
-    return getValue();
-  }
-
-  public String VariableSize.signatureComment() {
-    return "_";
-  }
-
-}
diff --git a/compiler/2014/Java_CodeGen.jrag b/compiler/2014/Java_CodeGen.jrag
deleted file mode 100644
index 62a59eff2b4d6db81c899e25dfbc817121f70aaa..0000000000000000000000000000000000000000
--- a/compiler/2014/Java_CodeGen.jrag
+++ /dev/null
@@ -1,1062 +0,0 @@
-import java.io.*;
-import java.util.*;
-
-aspect Java_CodeGenEnv {
-
-  // Environment wrapper for Java-code generation
-  // handles indentation, file writing,
-
-  public class Java_env {
-
-    public final int version;  //labcomm version to generate code for
-    public final String verStr;
-    private int indent;
-    private int depth;
-    private Java_printer printer;
-    private HashMap unique = new HashMap();
-
-    final private class Java_printer {
-
-      private boolean newline = true;
-      private File file;
-      private PrintStream out;
-      private IOException exception;
-
-
-      public Java_printer(File f) {
-  	file = f;
-        File parentFile = f.getParentFile();
-        if(parentFile != null) {
-            parentFile.mkdirs();
-        }
-      }
-
-     public Java_printer(PrintStream out) {
-        this.out = out;
-      }
-
-      public void close() throws IOException {
-	if (out != null) {
-  	  out.close();
-        }
-	if (exception != null) {
-	  throw exception;
-        }
-      }
-
-      public PrintStream getPrintStream() {
-	return(out);
-      }
-
-      public void checkOpen() {
-	if (out == null && exception == null) {
-          try {
-    	    out = new PrintStream(new FileOutputStream(file));
-          } catch (IOException e) {
-	    exception = e;
-          }
-        }
-      }
-
-      public void print(Java_env env, String s) {
-	checkOpen();
-        if (newline) {
-          newline = false;
-          for (int i = 0 ; i < env.indent ; i++) {
-            out.print("  ");
-          }
-        }
-        out.print(s);
-      }
-
-      public void println(Java_env env, String s) {
-	checkOpen();
-        print(env, s);
-        out.println();
-        newline = true;
-      }
-    }
-
-    private Java_env(int version, int indent) {
-      this.version = version;
-      this.verStr = LabCommVersion.versionString(version);
-      this.indent = indent;
-    }
-
-    private Java_env(int version, Java_printer printer) {
-      this(version, 0);
-      this.printer = printer;
-    }
-
-    public Java_env(int version, File f) {
-      this(version, 0);
-      this.printer = new Java_printer(f);
-    }
-
-    public Java_env(int version, PrintStream out) {
-      this(version, 0);
-      this.printer = new Java_printer(out);
-    }
-
-    public void close() throws IOException {
-      printer.close();
-    }
-
-    public PrintStream getPrintStream() {
-      return printer.getPrintStream();
-    }
-    public void indent(int amount) {
-      indent += amount;
-    }
-
-    public void indent() {
-      indent(1);
-    }
-
-    public void unindent(int amount) {
-      indent -= amount;
-    }
-
-    public void unindent() {
-      unindent(1);
-    }
-
-    public void print(String s) {
-      printer.print(this, s);
-    }
-
-    public void println(String s) {
-      printer.println(this, s);
-    }
-
-    public void println() {
-      printer.println(this, "");
-    }
-
-    public int getDepth() {
-      return depth;
-    }
-
-    public String print_for_begin(String limit) {
-      print("for (int i_" + depth + " = 0 ; ");
-      print("i_" + depth + " < " + limit + " ; ");
-      println("i_" + depth + "++) {");
-      indent();
-      depth++;
-      return "[i_" + (depth - 1) + "]";
-    }
-
-    public void print_for_end() {
-      depth--;
-      unindent();
-      println("}");
-    }
-
-    public void print_block_begin() {
-      println("{");
-      indent();
-    }
-
-    public void print_block_end() {
-      unindent();
-      println("}");
-    }
-
-    public String getUnique(Object o) {
-      String result = (String)unique.get(o);
-      if (result == null) {
-   	result = "_" + (unique.size() + 1) + "_";
-      }
-      unique.put(o, result);
-      return result;
-    }
-
-  }
-
-}
-
-aspect Java_StructName {
-
-  inh int Decl.Java_Depth();
-  inh int Type.Java_Depth();
-  eq Program.getDecl(int i).Java_Depth() = 0;
-  eq StructType.getField(int i).Java_Depth() = Java_Depth() + 1;
-
-  inh String Type.Java_structName();
-  eq Program.getDecl(int i).Java_structName() = getDecl(i).getName();
-  eq StructType.getField(int i).Java_structName() {
-    if (Java_Depth() == 0) {
-      return "struct_" + getField(i).getName();
-    } else {
-      return Java_structName() + "_" + getField(i).getName();
-    }
-  }
-}
-
-aspect Java_Void {
-
-  syn boolean Decl.isVoid() = getType().isVoid();
-  syn boolean UserType.isVoid() = decl().isVoid();
-  syn boolean Type.isVoid() = false;
-  syn boolean VoidType.isVoid() = true;
-
-}
-
-aspect Java_CodeGen {
-
-  public void Program.J_gen(PrintStream ps, String pack, int version) throws IOException {
-    Java_env env;
-    env = new Java_env(version, ps);
-    for (int i = 0; i < getNumDecl(); i++) {
-      Decl d = getDecl(i);
-      try {
-        d.Java_emitClass(env, pack);
-      } catch (Error e) {
-	System.err.println(d.getName());
-	throw e;
-      }
-    }
-    env.close();
-  }
-
-  public void Program.J_gen(String dir, String pack, int version) throws IOException {
-    Java_env env;
-    for (int i = 0; i < getNumDecl(); i++) {
-      Decl d = getDecl(i);
-      try {
-        env = new Java_env(version, new File(dir, d.getName() + ".java"));
-        d.Java_emitClass(env, pack);
-        env.close();
-      } catch (Error e) {
-	System.err.println(d.getName());
-	throw e;
-      }
-    }
-  }
-
-  /** Experimental method for generating code to a map <classname, source>
-    */
-  public void Program.J_gen(Map<String,String> src, String pack, int version) throws IOException {
-    Java_env env;
-    for (int i = 0; i < getNumDecl(); i++) {
-      Decl d = getDecl(i);
-      try {
-        ByteArrayOutputStream bs = new ByteArrayOutputStream();
-        PrintStream out = new PrintStream(bs);
-        env = new Java_env(version, out);
-        d.Java_emitClass(env, pack);
-        env.close();
-        src.put(d.getName(), bs.toString());
-      } catch (Error e) {
-	System.err.println(d.getName());
-	throw e;
-      }
-    }
-  }
-
-}
-
-aspect Java_Class {
-
-  public void Decl.Java_emitClass(Java_env env, String pack) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitClass(Java_env env, String pack)" +
-		    " not declared");
-  }
-
-  public void Decl.Java_emitDeclPP(Java_env env) {
-      // Hackish prettyprint preamble
-      env.println("/* ");
-      pp(env.getPrintStream());
-
-      Java_emitUserTypeDeps(env, null, false);
-      Java_emitUserTypeRefs(env, null, false);
-      env.println("*/");
-
-  }
-
-  public void Decl.Java_emitUserTypeDeps(Java_env env, String via, boolean outputCode) {
-  // XXX TODO will generate unnecessary recursion for types. fix this per commented out code
-  // XXX      but ensure that types with references actually register themselves.. (i.e., add "nested" argument)
-  //public abstract void Decl.Java_emitUserTypeDeps(Java_env env, String via, boolean outputCode);
-
-  //public void TypeDecl.Java_emitUserTypeDeps(Java_env env, String via, boolean outputCode) {
-  //  // do nothing for type decls; sampledecl iterates over all dependencies and outputs
-  //  // all type decls
-  //}
-  //public void SampleDecl.Java_emitUserTypeDeps(Java_env env, String via, boolean outputCode) {
-//  if(env.versionHasMetaData() && hasDependencies() || isReferenced() ) {
-//      if(env.versionHasMetaData() && isSampleDecl() && outputCode) {
-//         env.println("if(sendMetaData){");
-//         env.indent();
-//      }
-        Iterator<Decl> it = type_dependencies().iterator();
-        while(it.hasNext()) {
-            Decl t = it.next();
-
-            t.Java_emitUserTypeDeps(env, t.getName(), outputCode);
-            if( outputCode){// && t.getType().isUserType() ) {
-               env.println(t.getName()+".register(e);");
-            } else {  // Just output a comment
-	        String refpath = (via == null) ? "directly" : "indirectly via "+via;
-	       env.println(" //Depends ("+refpath+") on "+t.getName() );
-            }
-        }
-//      if(env.versionHasMetaData() && isSampleDecl() && outputCode) {
-//         env.unindent();
-//         env.println("}");
-//      }
-//  }
-  }
-  public void Decl.Java_emitUserTypeRefs(Java_env env, String via, boolean outputCode) {
-    if( isReferenced() ) {
-        Iterator<Decl> it = type_references().iterator();
-        while(it.hasNext()) {
-            Decl t = it.next();
-
-            t.Java_emitUserTypeRefs(env, t.getName(), outputCode);
-            if(outputCode) {
-               env.println(t.getName()+".register(e);");
-            } else {  // Just output a comment
-	        String refpath = (via == null) ? "directly" : "indirectly via "+via;
-	       env.println(" //Is referenced ("+refpath+")  by "+t.getName() );
-            }
-        }
-    }
- }
-
-
-  public void Decl.Java_emitRegisterEncoder(Java_env env) {
-    env.println("public static void register(Encoder e) throws IOException {");
-    env.indent();
-    env.println("register(e, true);");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public static void register(Encoder e, boolean sendMetaData) throws IOException {");
-    env.indent();
-    Java_emitUserTypeDeps(env, null, true);
-    env.println("e.register(dispatcher);");
-    env.unindent();
-    env.println("}");
-    env.println("public static void registerSampleRef(Encoder e) throws IOException{");
-    env.indent();
-    env.println("e.registerSampleRef(dispatcher);");
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-
-  public void TypeDecl.Java_emitClass(Java_env env, String pack) {
-      Java_emitDeclPP(env);
-      if (pack != null && pack.length() > 0) {
-          env.println("package " + pack + ";");
-      }
-
-      env.println("import se.lth.control.labcomm"+env.verStr+".Constant;");
-      env.println("import se.lth.control.labcomm"+env.verStr+".SampleType;");
-
-      if (getType().Java_needInstance() || hasDependencies() || isReferenced()) {
-          env.println("import se.lth.control.labcomm"+env.verStr+".Encoder;");
-          env.println("import se.lth.control.labcomm"+env.verStr+".SampleDispatcher;");
-          env.println("import se.lth.control.labcomm"+env.verStr+".SampleHandler;");
-//          env.println();
-//      }
-//
-//      if (getType().Java_needInstance()) {
-          env.println("import java.io.IOException;");
-          env.println("import se.lth.control.labcomm"+env.verStr+".Decoder;");
-      }
-      // For types without type_dependencies and not needing an instance,
-      // currently just an empty class is generated
-
-      env.println("public class " + getName() + " implements SampleType {");
-      env.println();
-
-      env.indent();
-      if (getType().Java_needInstance()) {
-        getType().Java_emitInstance(env);
-        Java_emitEncoder(env);
-        Java_emitDecoder(env);
-      }
-
-      //if(hasDependencies() || isReferenced()) {
-      //if( getType().isUserType() && isReferenced()) {
-      if( isReferenced()) {
-        Java_emitRegisterEncoder(env);
-        Java_emitDispatcher(env, false);
-      }
-      Java_emitSignature(env);
-
-      env.println("}");
-      env.unindent();
-      env.println();
-  }
-
-
-  public void SampleDecl.Java_emitClass(Java_env env, String pack) {
-    Java_emitDeclPP(env);
-
-    if (pack != null && pack.length() > 0) {
-      env.println("package " + pack + ";");
-    }
-
-    env.println("import java.io.IOException;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".Constant;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".Decoder;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".SampleDispatcher;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".Encoder;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".SampleHandler;");
-    env.println("import se.lth.control.labcomm"+env.verStr+".Sample;");
-    env.println();
-    env.print("public class " + getName());
-//  TODO: ?
-//  Code for making samples of user types extend their type
-//  currently commented out. Is this a good idea or not?
-//
-//    if(getType().isUserType()) {
-//        env.print(" extends "+getType().getTypeName());
-//    }
-    env.println(" implements Sample {");
-    env.println();
-    env.indent();
-    getType().Java_emitInstance(env);
-    env.println("public interface Handler extends SampleHandler {");
-    env.print("  public void handle_" + getName() + "(");
-    if (!isVoid()) {
-      getType().Java_emitType(env);
-      env.print(" value");
-    }
-    env.println(") throws Exception;");
-    env.println("}");
-    env.println();
-    env.println("public static void register(Decoder d, Handler h) throws IOException {");
-    env.indent();
-    env.println("d.register(dispatcher, h);");
-    env.unindent();
-    env.println("}");
-    env.println("public static void registerSampleRef(Decoder d) throws IOException {");
-    env.indent();
-    env.println("d.registerSampleRef(dispatcher);");
-    env.unindent();
-    env.println("}");
-    env.println();
-
-
-    Java_emitRegisterEncoder(env);
-    Java_emitDispatcher(env, true);
-    Java_emitEncoder(env);
-    Java_emitDecoder(env);
-
-    Java_emitSignature(env);
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-
-  public void TypeDecl.Java_emitSignature(Java_env env) {
-    Signature signature = getSignature();
-    signature.Java_emitSignature(env, true);
-  }
-
-  public void Decl.Java_emitSignature(Java_env env) {
-    //always emit the flat signature, as it is needed
-    //for matching at the decoder side (which cannot know
-    //the type_ids of dependent types. Therefore, flat sigs
-    //are used for matching
-    Java_emitFlatSignature(env);
-    if(isReferenced() || (isSampleDecl() && hasDependencies() )){
-      Signature signature = getSignature();
-      signature.Java_emitSignature(env, !isSampleDecl());
-    }
-  }
-
-  public void Decl.Java_emitFlatSignature(Java_env env){
-    env.println("private static byte[] signature = new byte[] {");
-      env.indent();
-      SignatureList signature = flatSignature(env.version);
-      for (int i = 0 ; i < signature.size() ; i++) {
-        String comment = signature.getComment(i);
-        if (comment != null) {
-          env.println(signature.getIndent(i) + "// " + comment);
-        }
-        byte[] data = signature.getData(i, env.version);
-        if (data != null) {
-          env.print(signature.getIndent(i));
-          for (int j = 0 ; j < data.length ; j++) {
-          env.print(data[j] + ", ");
-        }
-        env.println();
-      }
-    }
-    env.unindent();
-    env.println("};");
-    env.unindent();
-    env.println();
-  }
-
-  //XXX TODO: refactor: split into a static class ("TypeDefSingleton"?)and a (smaller) dispatcher
-  public void Decl.Java_emitDispatcher(Java_env env, boolean isSample) {
-    // String genericStr = ""; //env.versionHasMetaData()?"<"+getName()+">":""; 
-    String genericStr = "<"+getName()+">"; 
-    env.println("private static Dispatcher dispatcher = new Dispatcher();");
-    env.println();
-    env.println("public SampleDispatcher getDispatcher() {");
-    env.indent();
-    env.println("return dispatcher;");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("private static class Dispatcher implements SampleDispatcher "+genericStr+"{");
-    env.indent();
-    env.println();
-    env.println("public Class"+genericStr+" getSampleClass() {");
-    env.indent();
-    env.println("return " + getName() + ".class;");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public String getName() {");
-    env.indent();
-    env.println("return \"" + getName() + "\";");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public byte getTypeDeclTag() {");
-    env.indent();
-    if(env.version == 2006) {
-      if(isSample) {
-        env.println("return Constant.SAMPLE;");
-      } else {
-        env.println("return Constant.TYPEDEF;");
-      }
-    } else {
-      if(isSample) {
-        env.println("return Constant.SAMPLE_DEF;");
-      } else {
-        env.println("return Constant.TYPE_DEF;");
-      }
-    }
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public boolean isSample() {");
-    env.indent();
-    env.println("return "+isSample+";");
-    env.unindent();
-    env.println("}");
-    env.println("public boolean hasDependencies() {");
-    env.indent();
-    env.println("return "+hasDependencies()+";");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("/** return the flat signature. */");
-    env.println("public byte[] getSignature() {");
-    env.indent();
-    if(isSample) {
-        env.println("return signature;");
-    } else {
-        env.println("throw new Error(\"a TYPE_DEF has no flat signature\");");
-    }
-    env.unindent();
-    env.println("}");
-    env.println();
-//    env.println("public void encodeSignature(Encoder e) throws IOException{");
-//    env.indent();
-//    env.println("emitSignature(e);");
-//    env.unindent();
-//    env.println("}");
-//    env.println();
-    env.println("public void encodeTypeDef(Encoder e, int index) throws IOException{");
-    env.indent();
-    if(!isSample || hasDependencies()) {
-      env.println("emitSignature(e);");
-    } else {
-      env.println("// the type has no dependencies, do nothing");
-    }
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public boolean canDecodeAndHandle() {");
-    env.indent();
-    env.println("return "+isSample+";");
-    env.unindent();
-    env.println("}");
-    env.println();
-    env.println("public void decodeAndHandle(Decoder d,");
-    env.println("                            SampleHandler h) throws Exception {");
-    env.indent();
-    if( isSample) {
-        if (isVoid()) {
-          env.println(getName() + ".decode(d);");
-          env.println("((Handler)h).handle_" + getName() + "();");
-        } else {
-          env.println("((Handler)h).handle_" + getName() + "(" + getName() + ".decode(d));");
-        }
-    } else {
-        env.println("throw new Exception(\"A typedef has no handler, the corresponding method on the sample class should be called.\");");
-    }
-    env.unindent();
-    env.println("}");
-    env.println("");
-    env.unindent();
-    env.println("}");
-    env.println("");
-
- }
-
-
-  public void TypeDecl.Java_emitEncoder(Java_env env) {
-    env.print("public static void encode(Encoder e");
-    if (!isVoid()) {
-      env.print(", ");
-      getType().Java_emitType(env);
-      env.print(" value");
-    }
-    env.println(") throws IOException {");
-    env.indent();
-    getType().Java_emitEncoder(env, "value");
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-
-  public void SampleDecl.Java_emitEncoder(Java_env env) {
-    env.print("public static void encode(Encoder e");
-    if (!isVoid()) {
-      env.print(", ");
-      getType().Java_emitType(env);
-      env.print(" value");
-    }
-    env.println(") throws IOException {");
-    env.indent();
-    env.println("e.begin(" + getName() + ".class);");
-    getType().Java_emitEncoder(env, "value");
-    env.println("e.end(" + getName() + ".class);");
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-
-  public void Type.Java_emitEncoder(Java_env env, String name) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitEncoder(Java_env env, String name)" +
-		    " not declared");
-  }
-
-  public void VoidType.Java_emitEncoder(Java_env env, String name) {
-  }
-
-  public void PrimType.Java_emitEncoder(Java_env env, String name) {
-    switch (getToken()) {
-      case LABCOMM_BOOLEAN: { env.print("e.encodeBoolean"); } break;
-      case LABCOMM_BYTE: { env.print("e.encodeByte"); } break;
-      case LABCOMM_SHORT: { env.print("e.encodeShort"); } break;
-      case LABCOMM_INT: { env.print("e.encodeInt"); } break;
-      case LABCOMM_LONG: { env.print("e.encodeLong"); } break;
-      case LABCOMM_FLOAT: { env.print("e.encodeFloat"); } break;
-      case LABCOMM_DOUBLE: { env.print("e.encodeDouble"); } break;
-      case LABCOMM_STRING: { env.print("e.encodeString"); } break;
-      case LABCOMM_SAMPLE: { env.print("e.encodeSampleRef"); } break;
-    }
-    env.println("(" + name + ");");
-  }
-
-  public void ArrayType.Java_emitEncoder(Java_env env, String name) {
-    int baseDepth = env.getDepth();
-    String prefix = "";
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String limit = getExp(i).Java_emitEncoder(env, name + prefix);
-      env.print_block_begin();
-      env.println("int i_" + (baseDepth + i) + "_max = " + limit + ";");
-      prefix = prefix + "[0]";
-    }
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String limit = "i_" + (baseDepth + i) + "_max";
-      name = name + env.print_for_begin(limit);
-    }
-    getType().Java_emitEncoder(env, name);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print_for_end();
-      env.print_block_end();
-    }
-  }
-
-  public String Exp.Java_emitEncoder(Java_env env, String name) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitEncoder(Java_env env, String name)" +
-		    " not declared");
-  }
-
-  public String IntegerLiteral.Java_emitEncoder(Java_env env, String name) {
-    return getValue();
-  }
-
-  public String VariableSize.Java_emitEncoder(Java_env env, String name) {
-    env.println("e.encodePacked32(" + name + ".length);");
-    return name + ".length";
-  }
-
-  public void StructType.Java_emitEncoder(Java_env env, String name) {
-    for (int i = 0 ; i < getNumField() ; i++) {
-      Field f = getField(i);
-      f.getType().Java_emitEncoder(env, name + "." + f.getName());
-    }
-  }
-
-  public void UserType.Java_emitEncoder(Java_env env, String name) {
-    if (Java_needInstance()) {
-      env.println(getName() + ".encode(e, " + name + ");");
-    } else {
-      decl().getType().Java_emitEncoder(env, name);
-    }
-  }
-
-  public void Decl.Java_emitDecoder(Java_env env) {
-    env.print("public static ");
-    getType().Java_emitType(env);
-    env.println(" decode(Decoder d) throws IOException {");
-    env.indent();
-    if (!isVoid()) {
-      getType().Java_emitType(env);
-      env.println(" result;");
-      getType().Java_emitDecoder(env, "result");
-      env.println("return result;");
-    }
-    env.unindent();
-    env.println("}");
-    env.println();
-  }
-
-  public void Type.Java_emitDecoder(Java_env env, String name) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitDecoder(Java_env env, String name)" +
-		    " not declared");
-  }
-
-  public void VoidType.Java_emitDecoder(Java_env env, String name) {
-  }
-
-  public void PrimType.Java_emitDecoder(Java_env env, String name) {
-    env.print(name + " = ");
-    switch (getToken()) {
-      case LABCOMM_BOOLEAN: { env.println("d.decodeBoolean();"); } break;
-      case LABCOMM_BYTE: { env.println("d.decodeByte();"); } break;
-      case LABCOMM_SHORT: { env.println("d.decodeShort();"); } break;
-      case LABCOMM_INT: { env.println("d.decodeInt();"); } break;
-      case LABCOMM_LONG: { env.println("d.decodeLong();"); } break;
-      case LABCOMM_FLOAT: { env.println("d.decodeFloat();"); } break;
-      case LABCOMM_DOUBLE: { env.println("d.decodeDouble();"); } break;
-      case LABCOMM_STRING: { env.println("d.decodeString();"); } break;
-      case LABCOMM_SAMPLE: { env.println("d.decodeSampleRef();"); } break;
-    }
-  }
-
-  public void ArrayType.Java_emitDecoder(Java_env env, String name) {
-    env.println("{");
-    env.indent();
-    int baseDepth = env.getDepth();
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print("int i_" + (baseDepth + i) + "_max = ");
-      getExp(i).Java_emitDecoder(env);
-      env.println(";");
-    }
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      String limit = "i_" + (baseDepth + i) + "_max";
-      env.print(name + " = ");
-      Java_emitNew(env, limit, getNumExp() - i);
-      env.println(";");
-      name = name + env.print_for_begin(limit);
-    }
-    getType().Java_emitDecoder(env, name);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print_for_end();
-    }
-    env.unindent();
-    env.println("}");
-  }
-
-  public void Exp.Java_emitDecoder(Java_env env) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitDecoder(Java_env env)" +
-		    " not declared");
-  }
-
-  public void IntegerLiteral.Java_emitDecoder(Java_env env) {
-    env.print(getValue());
-  }
-
-  public void VariableSize.Java_emitDecoder(Java_env env) {
-    env.print("d.decodePacked32()");
-  }
-
-  public void StructType.Java_emitDecoder(Java_env env, String name) {
-    env.print(name + " = new ");
-    Java_emitType(env);
-    env.println("();");
-    for (int i = 0 ; i < getNumField() ; i++) {
-      Field f = getField(i);
-      f.getType().Java_emitDecoder(env, name + "." + f.getName());
-    }
-  }
-
-  public void UserType.Java_emitDecoder(Java_env env, String name) {
-    if (Java_needInstance()) {
-      env.println(name + " = " + getName() + ".decode(d);");
-    } else {
-      decl().getType().Java_emitDecoder(env, name);
-    }
-  }
-
-  public void Type.Java_emitNew(Java_env env, String size) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitNew(Java_env env, String size)" +
-		    " not declared");
-  }
-
-  public void ArrayType.Java_emitNew(Java_env env, String size, int depth) {
-    env.print("new ");
-    getType().Java_emitTypePrefix(env);
-    env.print("[" + size + "]");
-    getType().Java_emitTypeSuffix(env);
-    for (int i = 1 ; i < depth ; i++) {
-      env.print("[]");
-    }
-  }
-
-  public void Type.Java_emitTypePrefix(Java_env env) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitTypePrefix(Java_env env)" +
-		    " not declared");
-  }
-
-  public void PrimType.Java_emitTypePrefix(Java_env env) {
-    switch (getToken()) {
-      case LABCOMM_STRING: { env.print("String"); } break;
-      case LABCOMM_SAMPLE: { env.print("Class"); } break;
-      default: { env.print(getName()); } break;
-    }
-  }
-
-  public void UserType.Java_emitTypePrefix(Java_env env) {
-    if (Java_needInstance()) {
-      env.print(getName());
-    } else {
-      decl().getType().Java_emitTypePrefix(env);
-    }
-  }
-
-  public void ArrayType.Java_emitTypePrefix(Java_env env){
-    getType().Java_emitTypePrefix(env);
-  }
-
-  public void StructType.Java_emitTypePrefix(Java_env env){
-    env.print(Java_structName());
-  }
-
-  public void Type.Java_emitTypeSuffix(Java_env env) {
-  }
-
-  public void UserType.Java_emitTypeSuffix(Java_env env) {
-    if (! Java_needInstance()) {
-      decl().getType().Java_emitTypeSuffix(env);
-    }
-  }
-
-  public void ArrayType.Java_emitTypeSuffix(Java_env env){
-    getType().Java_emitTypeSuffix(env);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print("[]");
-    }
-  }
-
-  public boolean Type.Java_needInstance() {
-    throw new Error(this.getClass().getName() +
-		    ".Java_needInstance()" +
-		    " not declared");
-  }
-
-  public boolean VoidType.Java_needInstance() {
-    return false;
-  }
-
-  public boolean PrimType.Java_needInstance() {
-    return false;
-  }
-
-  public boolean UserType.Java_needInstance() {
-    return decl().getType().Java_needInstance();
-  }
-
-  public boolean StructType.Java_needInstance() {
-    return true;
-  }
-
-  public boolean ArrayType.Java_needInstance() {
-    return getType().Java_needInstance();
-  }
-
-  public boolean Type.Java_isPrimitive() {
-    return false;
-  }
-
-  public boolean PrimType.Java_isPrimitive() {
-    return true;
-  }
-
-  public void Type.Java_emitInstance(Java_env env) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitInstance(Java_env env)" +
-		    " not declared");
-  }
-
-  public void VoidType.Java_emitInstance(Java_env env) {
-  }
-
-  public void PrimType.Java_emitInstance(Java_env env) {
-  }
-
-  public void ArrayType.Java_emitInstance(Java_env env) {
-    getType().Java_emitInstance(env);
-  }
-
-  public void StructType.Java_emitInstance(Java_env env) {
-    if (Java_Depth() > 0) {
-      env.println("public static class " + Java_structName() + " {");
-      env.indent();
-    }
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).getType().Java_emitInstance(env);
-    }
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).Java_emitField(env);
-    }
-    if (Java_Depth() > 0) {
-      env.unindent();
-      env.println("}");
-    }
-    env.println();
-  }
-
-  public void UserType.Java_emitInstance(Java_env env) {
-  }
-
-  public void Field.Java_emitField(Java_env env) {
-    env.print("public ");
-    getType().Java_emitType(env);
-    env.println(" " + getName() + ";");
-  }
-
-  public void Type.Java_emitType(Java_env env) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_emitType(Java_env env)" +
-		    " not declared");
-  }
-
-  public void VoidType.Java_emitType(Java_env env) {
-    env.print("void");
-  }
-
-  public void PrimType.Java_emitType(Java_env env) {
-    switch (getToken()) {
-      case LABCOMM_STRING: { env.print("String"); } break;
-      case LABCOMM_SAMPLE: { env.print("Class"); } break;
-      default: { env.print(getName()); } break;
-    }
-  }
-
-  public void UserType.Java_emitType(Java_env env) {
-    decl().getType().Java_emitType(env);
-  }
-
-  public void ArrayType.Java_emitType(Java_env env){
-    getType().Java_emitType(env);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      env.print("[]");
-    }
-  }
-
-  public void StructType.Java_emitType(Java_env env){
-    env.print(Java_structName());
-  }
-}
-
-aspect Java_Signature {
-    public void Signature.Java_emitSignature(Java_env env, boolean decl){
-      // XXX should sendOnlyFlatSignatures be kept somewhere?
-      //SignatureList sl = (parentDecl().sendOnlyFlatSignatures(env)) ? getFlatSignatureList() : getSignatureList();
-      SignatureList sl = getSignatureList();
-      sl.Java_emitSignature(env, decl);
-    }
-
-//    public void Signature.Java_emitHierarchicalSignature(Java_env env, boolean decl){
-//      SignatureList sl = getSignatureList();
-//      sl.Java_emitSignature(env, decl);
-//    }
-//
-    public abstract void SignatureLine.Java_emitSignature(Java_env env, boolean decl);
-
-    public void TypeRefSignatureLine.Java_emitSignature(Java_env env, boolean isDecl){
-      env.print(getIndentString());
-      env.println("e.encodePacked32(e.getTypeId("+decl.getName()+".class));");
-    }
-
-    public void DataSignatureLine.Java_emitSignature(Java_env env, boolean decl){
-        byte[] data = getData(env.version);
-          if (data != null) {
-              env.print(getIndentString());
-              for (int j = 0 ; j < data.length ; j++) {
-                  //env.print("e.encodeByte((byte)"+data[j]+");");
-                  env.print("e.encodeByte((byte)"+ String.format("0x%02X ", data[j]) +"); ");
-              }
-              env.println();
-          }
-  }
-    public void SignatureList.Java_emitSignature(Java_env env, boolean decl) {
-      env.println("private static void emitSignature(Encoder e) throws IOException{");
-      env.indent();
-      for (int i = 0 ; i < size() ; i++) {
-        String comment = getComment(i);
-        if (comment != null && comment.length() > 0) {
-            env.println(getIndent(i) + "// " + comment);
-        }
-        SignatureLine l = getSignatureLine(i);
-        l.Java_emitSignature(env, decl);
-      }
-      env.println("}");
-      env.unindent();
-  }
-
-}
-
-aspect Java_Info {
-
-  public void Program.Java_info(PrintStream out, int version) {
-    Java_env env = new Java_env(version, out);
-    for (int i = 0; i < getNumDecl(); i++) {
-      getDecl(i).Java_info(env);
-    }
-  }
-
-  public void Decl.Java_info(Java_env env) {
-    throw new Error(this.getClass().getName() +
-		    ".Java_info(Java_env env)" +
-		    " not declared");
-  }
-
-  public void TypeDecl.Java_info(Java_env env) {
-    env.print(",Java,typedef," + getName() + ",");
-    getType().Java_emitType(env);
-    env.print(",not_applicable_for_Java");
-    env.println();
-  }
-
-  public void SampleDecl.Java_info(Java_env env) {
-    env.print(",Java,sample," + getName() + ",");
-    getType().Java_emitType(env);
-    env.print(",not_applicable_for_Java");
-    env.println();
-  }
-
-}
diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast
deleted file mode 100644
index d3d5e592fc95cb38bf9fd3844d8b3ad2d3cb9081..0000000000000000000000000000000000000000
--- a/compiler/2014/LabComm.ast
+++ /dev/null
@@ -1,37 +0,0 @@
-Program ::= Decl*;
-
-abstract Decl ::= Type <Name:String> /Signature/;
-
-TypeDecl   : Decl;
-SampleDecl : Decl;
-
-//Signatures are in the abstract grammar, so that
-//they can be extended and refined by aspects.
-
-Signature                 ::= SignatureList FlatSignatureList:SignatureList; 
-SignatureList             ::= SignatureLine*;
-abstract SignatureLine 	  ::= <Indent:int> <Comment:String>; 
-abstract DataSignatureLine : SignatureLine;
-ByteArraySignatureLine     : DataSignatureLine ::= <Data:byte[]>;
-IntSignatureLine           : DataSignatureLine ::= <Data:int>;
-StringSignatureLine        : DataSignatureLine ::= <Data:String>;
-TypeRefSignatureLine       : SignatureLine     ::= Decl;
-
-Field ::= Type <Name:String>;
-
-abstract Type;
-VoidType           : Type;
-//SampleRefType      : Type;
-PrimType           : Type ::= <Name:String> <Token:int>;
-UserType           : Type ::= <Name:String>;
-StructType         : Type ::= Field*;
-ParseArrayType     : Type ::= Type Dim*;
-abstract ArrayType : Type ::= Type Exp*;
-VariableArrayType  : ArrayType;
-FixedArrayType     : ArrayType;
-
-Dim ::= Exp*;
-
-abstract Exp;
-IntegerLiteral : Exp ::= <Value:String>;
-VariableSize   : Exp;
diff --git a/compiler/2014/LabComm.java b/compiler/2014/LabComm.java
deleted file mode 100644
index 2844ed2b87e39b9e9e6a625498baf2bb130b89a1..0000000000000000000000000000000000000000
--- a/compiler/2014/LabComm.java
+++ /dev/null
@@ -1,404 +0,0 @@
-package se.lth.control.labcomm2014.compiler;
-
-import java.io.*;
-import java.util.*;
-
-public class LabComm {
-
-  private static void println(String s) {
-    System.out.println(s);
-  }
-
-  private static void print_help() {
-    println("\n Usage: java -jar labcom.jar [options*] FILE");
-    println("");
-    println(" --help                  Shows this help text");
-    println(" -v                      Be verbose");
-    println(" --ver=VERSION           Generate code for labcomm VERSION (=2006 or 2014)");
-    println("[ C options ]");
-    println(" -C                      Generates C/H code in FILE.[ch]");
-    println(" --cprefix=PREFIX        Prefixes C types with PREFIX");
-    println(" --cinclude=FILE         Include FILE in generated .c");
-    println(" --c=CFILE               Generates C code in CFILE");
-    println(" --h=HFILE               Generates H code in HFILE");
-    println("[ C# options]");
-    println(" --cs                    Generates C# code in FILE.cs");
-    println(" --cs=CSFILE             Generates C# code in CSFILE");
-    println(" --csnamespace=NAMESPACE Place C# classes in NAMESPACE");
-    println("[ Java options ]");
-    println(" --java=JDIR             Generates Java files in JDIR");
-    println(" --javapackage=PACKAGE   Place Java classes in PACKAGE");
-    println("[ Python options ]");
-    println(" -P                      Generates Python code in FILE.py");
-    println(" --python=PFILE          Generates Python code in PFILE");
-    println("[ RAPID options ]");
-    println(" --rapid                 Generates RAPID code in FILE.sys");
-    println("[ Misc options ]");
-    println(" --pretty=PFILE          Pretty prints to PFILE");
-    println(" --typeinfo=TIFILE       Generates typeinfo in TIFILE");
-  }
-    
-  /** To be cleaned up.
-   */
-  private static void checkVersion(int v) {
-     if(! (v == 2006 || v == 2014) ) {
-	System.err.println(" Unknown version: " + v);
-	System.err.println(" Supported versions: 2006, 2014 ");
-	System.exit(2);
-     }
-  }
-
-  private static void genH(Program p, String hName, 
-			   Vector cIncludes, String coreName, String prefix, int ver) {
-    try {
-      FileOutputStream f;
-      PrintStream out;
-      
-      f = new FileOutputStream(hName);
-      out = new PrintStream(f);
-      p.C_genH(out, cIncludes, coreName, prefix, ver);
-      out.close();
-    } catch (IOException e) {
-      System.err.println("IOException: " + hName + " " + e);
-    }
-  }
-
-  private static void genC(Program p, String cName, 
-			   Vector cIncludes, String coreName, String prefix, int ver) {
-    try {
-      FileOutputStream f;
-      PrintStream out;
-
-      f = new FileOutputStream(cName);
-      out = new PrintStream(f);
-      p.C_genC(out, cIncludes, coreName, prefix, ver);
-      out.close();
-    } catch (IOException e) {
-      System.err.println("IOException: " + cName + " " + e);
-    }
-  }
-
-  private static void genCS(Program p, String csName, String csNamespace, int ver) {
-//      throw new Error("C# generation currently disabled");
-    try {
-      p.CS_gen(csName, csNamespace, ver);
-    } catch (IOException e) {
-      System.err.println("IOException: " + csName + " " + 
-			 csNamespace + " " + e);
-    }
-  }
-
-  private static void genJava(Program p,  String dirName, String packageName, int ver) {
-    try {
-      p.J_gen(dirName, packageName, ver);
-    } catch (IOException e) {
-      System.err.println("IOException: " + dirName + " " + 
-			 packageName + " " + e);
-    }
-  }
-
-  private static void genPython(Program p, String filename, String prefix, int ver) {
-    try {
-      FileOutputStream f;
-      PrintStream out;
-
-      f = new FileOutputStream(filename);
-      out = new PrintStream(f);
-      p.Python_gen(out, prefix, ver);
-      out.close();
-    } catch (IOException e) {
-      System.err.println("IOException: " + filename + " " + e);
-    }
-  }
-
-  private static void genRAPID(Program p, String filename, String prefix, int ver) {
-    try {
-      p.RAPID_gen(filename, prefix, ver);
-    } catch (IOException e) {
-      System.err.println("IOException: " + filename + " " + e);
-    }
-  }
-
-  /** Helper class to contain command line options 
-      and their associated behaviour
-   **/
-  private static class Opts {
-    final String[] args;
-    String coreName = null;
-    String prefix = null;
-    boolean verbose = false;
-    int ver = 2014; //Version 2014 as default
-    String cFile = null;
-    String hFile = null;
-    Vector cIncludes = new Vector();
-    String cPrefix; // gets default value (prefix) in processFilename
-    String csFile = null;
-    String csNamespace = null;
-    String javaDir = null;
-    String javaPackage = "";
-    String pythonFile = null;
-    String prettyFile = null;
-    String typeinfoFile = null;
-    String rapidFile = null;
-    String fileName = null;
-
-   Opts(String[] args) {
-     this.args = args;
-   }
-
-    private static String getCoreName(String s) {
-      int i = s.lastIndexOf('.');
-      return s.substring(0, i > 0 ? i : s.length());
-    }
-  
-    private static String getFileName(String s) {
-      return s.substring(s.lastIndexOf('/') + 1, s.length());
-    }
-  
-    private static String getBaseName(String s) {
-      s = getFileName(s);
-      int i = s.lastIndexOf('.');
-      return s.substring(0, i > 0 ? i : s.length());
-    }
-  
-    private static String getPrefix(String s) {
-      return s.substring(s.lastIndexOf('/') + 1, s.length());
-    }
-  
-    boolean processFilename(){
-      // Scan for first non-option
-      for (int i = 0 ; i < args.length ; i++) {
-        if (! args[i].startsWith("-")) {
-  	fileName = args[i];
-  	break;
-        }
-      }
-      if (fileName != null) {
-        coreName = getBaseName(fileName);
-        prefix = getPrefix(coreName);
-       cPrefix = prefix;
-      }
-      return fileName != null;
-    }
-    
-    void processArgs(){
-      for (int i = 0 ; i < args.length ; i++) {
-        if (fileName == null ||
-            args[i].equals("-help") || 
-            args[i].equals("-h") || 
-            args[i].equals("--help")) {
-          print_help();
-          System.exit(0);
-        } else if (args[i].equals("-v")) {
-          verbose=true;
-        } else if (args[i].startsWith("--ver=")) {
-          ver = Integer.parseInt(args[i].substring(6));
-          checkVersion(ver);
-        } else if (args[i].equals("-C")) {
-          cFile = coreName + ".c";
-          hFile = coreName + ".h";
-        } else if (args[i].startsWith("--cinclude=")) {
-          cIncludes.add(args[i].substring(11));
-        } else if (args[i].startsWith("--cprefix=")) {
-          cPrefix = args[i].substring(10);
-        } else if (args[i].startsWith("--c=")) {
-          cFile = args[i].substring(4);
-        } else if (args[i].startsWith("--h=")) {
-          hFile = args[i].substring(4);
-        } else if (args[i].equals("--cs")) {
-          csFile = coreName + ".cs";
-        } else if (args[i].startsWith("--cs=")) {
-          csFile = args[i].substring(5);
-        } else if (args[i].startsWith("--csnamespace=")) {
-          csNamespace = args[i].substring(14);
-        } else if (args[i].startsWith("--java=")) {
-          javaDir = args[i].substring(7);
-        } else if (args[i].startsWith("--javapackage=")) {
-          javaPackage = args[i].substring(14);
-        } else if (args[i].equals("-P")) {
-          pythonFile = coreName + ".py";
-        } else if (args[i].startsWith("--python=")) {
-          pythonFile = args[i].substring(9);
-        } else if (args[i].startsWith("--pretty=")) {
-          prettyFile = args[i].substring(9);
-        } else if (args[i].startsWith("--typeinfo=")) {
-          typeinfoFile = args[i].substring(11);
-        } else if (args[i].equals("--rapid")) {
-          rapidFile = coreName + ".sys";
-        } else if (i == args.length - 1) {
-          fileName = args[i];
-        } else {
-          System.err.println(" Unknown argument " + args[i]);
-          print_help();
-          System.exit(2);
-        }
-      }
-     if(prefix==null){
-  	System.err.println("   WARNING! prefix==null");
-        prefix="";
-     }
-   }
-
-   Program parseFile(){
-     Program ast = null;
-     try {
-       // Check for errors
-       LabCommScanner scanner = new LabCommScanner(
-                                  new FileReader(fileName));
-       LabCommParser parser = new LabCommParser();
-       Program p = (Program)parser.parse(scanner);
-       Collection errors = new LinkedList();
-       p.errorCheck(errors);
-         
-       if (errors.isEmpty()) {
-         ast = p;
-       } else {
-         for (Iterator iter = errors.iterator(); iter.hasNext(); ) {
-           String s = (String)iter.next();
-           System.out.println(s);
-         }
-       }
-     } catch (FileNotFoundException e) {
-       System.err.println("Could not find file: " + fileName);
-     } catch (IOException e) {
-       System.err.println("IOException: " + fileName + " " + e);
-     } catch (beaver.Parser.Exception e) {
-       System.err.println(e.getMessage());
-     }
-     return ast;
-   }
-
-   boolean generateC(Program ast) {
-     boolean wroteFile = false; 
-     Vector hIncludes = new Vector(cIncludes);
-     if (hFile != null) {
-       cIncludes.add(hFile);
-     }
-     if (cFile != null) {
-       printStatus("C: " , cFile);
-       genC(ast, cFile, cIncludes, coreName, cPrefix, ver);
-       wroteFile = true;
-     }
-     if (hFile != null) {
-       printStatus("H: " , hFile);
-       genH(ast, hFile, hIncludes, coreName, cPrefix, ver);
-       wroteFile = true;
-     }
-     return wroteFile;
-   }
-  
-   boolean generateCS(Program ast) {
-     boolean wroteFile = false; 
-     if (csFile != null) {
-       printStatus("C#: " , csFile); 
-       genCS(ast, csFile, csNamespace, ver);
-       wroteFile = true;
-     }
-     return wroteFile;
-   }
-  
-   boolean generateJava(Program ast) {
-     boolean wroteFile = false; 
-     if (javaDir != null) {
-       printStatus("Java: " , javaDir);
-       genJava(ast, javaDir, javaPackage, ver);
-       wroteFile = true;
-     }
-     return wroteFile;
-   }
-  
-   boolean generatePython(Program ast) {
-     boolean wroteFile = false; 
-     if (pythonFile != null) {
-       printStatus("Python: " , pythonFile); 
-       genPython(ast, pythonFile, prefix, ver);
-       wroteFile = true;
-     }
-     return wroteFile;
-   }
-  
-   boolean generateRAPID(Program ast) {
-     boolean wroteFile = false; 
-     if (rapidFile != null) {
-       printStatus("RAPID: " , rapidFile);
-       genRAPID(ast, rapidFile, coreName, ver);
-       wroteFile = true;
-     }
-     return wroteFile;
-   }
-   boolean generatePrettyPrint(Program ast) {
-     boolean wroteFile = false; 
-     if (prettyFile != null) {
-       printStatus("Pretty: " , prettyFile); 
-       try {
-         FileOutputStream f = new FileOutputStream(prettyFile);
-         PrintStream out = new PrintStream(f);
-         ast.pp(out);
-         out.close();
-         wroteFile = true;
-       } catch (IOException e) {
-         System.err.println("IOException: " + prettyFile + " " + e);
-       } 
-     }
-     return wroteFile;
-   }
-  
-   boolean generateTypeinfo(Program ast) {
-     boolean wroteFile = false; 
-     if (typeinfoFile != null) {
-       printStatus("TypeInfo: " , typeinfoFile); 
-       try {
-         FileOutputStream f = new FileOutputStream(typeinfoFile);
-         PrintStream out = new PrintStream(f);
-         ast.C_info(out, cPrefix, ver);
-         ast.Java_info(out, ver);
-         ast.CS_info(out, csNamespace, ver);
-         wroteFile = true;
-       } catch (IOException e) {
-         System.err.println("IOException: " + typeinfoFile + " " + e);
-       }
-     }
-     return wroteFile;
-    }
-
-    private void printStatus(String kind, String filename){
-       if (verbose) { 
-         System.err.println("Generating "+kind+": " + filename); 
-       }
-    }
-  }
-
-
-  public static void main(String[] args) {
-    Opts opts = new Opts(args);
-    if(!opts.processFilename()) {
-      print_help();
-      System.exit(1);
-    } else {
-      opts.processArgs();
-      Program ast =  opts.parseFile();
-
-      if (ast != null) {
-	
-	boolean fileWritten = false;
-
-        fileWritten |= opts.generateC(ast);
-        fileWritten |= opts.generateCS(ast);
-        fileWritten |= opts.generateJava(ast);
-        fileWritten |= opts.generatePython(ast);
-        fileWritten |= opts.generateRAPID(ast);
-        fileWritten |= opts.generatePrettyPrint(ast);
-        fileWritten |= opts.generateTypeinfo(ast);
-
-        // if no output to files, prettyprint on stdout
-	if (!fileWritten) {
-	  ast.pp(System.out);
-	}
-      } else {
-          // Catch-all for compilation errors
-          System.err.println("Error in specification");
-          System.exit(3);
-      }
-    }
-  } 
-}
diff --git a/compiler/2014/LabCommParser.parser b/compiler/2014/LabCommParser.parser
deleted file mode 100644
index e7fb759c1511b95fff7fc3a05b18ba2b1e75e850..0000000000000000000000000000000000000000
--- a/compiler/2014/LabCommParser.parser
+++ /dev/null
@@ -1,133 +0,0 @@
-%header {:
-  package se.lth.control.labcomm2014.compiler;
-  import se.lth.control.labcomm2014.compiler.*;
-:};
-%embed {:
-  public static class SourceError extends Error {
-    public SourceError(String msg) {
-      super(msg);
-    }
-  }
-  class Events extends Parser.Events {
-    public void syntaxError(Symbol token) {
-      StringBuffer s = new StringBuffer();
-      s.append(token.getLine(token.getStart()) + ", " + token.getColumn(token.getStart()) + "\n");
-      s.append("  *** Syntactic error: unexpected token " + Terminals.NAMES[token.getId()]);
-      throw new SourceError(s.toString());
-        //super.syntaxError(token);
-        //throw new RuntimeException(token.getLine(token.getStart()) + ", " +
-	// token.getColumn(token.getStart()) + ": Syntax Error");
-    }
-    public void scannerError(Scanner.Exception e) {
-      StringBuffer s = new StringBuffer();
-      s.append(e.line + ", " + e.column + "\n");
-      s.append("  *** Lexical error: " + e.getMessage());
-      throw new SourceError(s.toString());
-        //super.scannerError(e);
-        //throw new RuntimeException("Unexpected token");
-    }
-
-  }
-
-        {
-            report = new Events(); // Use error handler in parser
-        }
-:};
-
-Program goal =
-     /* Empty program */               {: return new Program(); :}
-  |  decl_list.l                       {: return new Program(l); :}
-  ;
-
-List decl_list =
-    decl.d                          {: return new List().add(d); :}
-  | decl_list.l decl.d              {: return l.add(d); :}
-  ;
-
-Decl decl =
-    type_decl.t                     {: return t; :}
-  | sample_decl.s	            {: return s; :}
-  ;
-
-List var_decl_list =
-    var_decl.v                      {: return new List().add(v); :}
-  | var_decl_list.l var_decl.v      {: return l.add(v); :}
-  ;
-
-Field var_decl =
-    type.t IDENTIFIER SEMICOLON     {: return new Field(t, IDENTIFIER); :}
-  | type.t IDENTIFIER dim_list.d SEMICOLON
-    {: return new Field(new ParseArrayType(t, d), IDENTIFIER); :}
-  ;
-
-TypeDecl type_decl =
-    TYPEDEF type.t IDENTIFIER SEMICOLON {: return new TypeDecl(t, IDENTIFIER); :}
-  | TYPEDEF type.t IDENTIFIER dim_list.d SEMICOLON
-    {: return new TypeDecl(new ParseArrayType(t, d), IDENTIFIER); :}
-  ;
-
-SampleDecl sample_decl =
-    SAMPLE type.t IDENTIFIER SEMICOLON
-      {: return new SampleDecl(t, IDENTIFIER); :}
-  | SAMPLE type.t IDENTIFIER dim_list.d SEMICOLON
-      {: return new SampleDecl(new ParseArrayType(t, d), IDENTIFIER); :}
-  ;
-
-Type type =
-    prim_type.p                     {: return p; :}
-  | user_type.u                     {: return u; :}
-  | struct_type.s                   {: return s; :}
-  | void_type.v                     {: return v; :}
-  ;
-
-PrimType prim_type =
-    BOOLEAN
-      {: return new PrimType(BOOLEAN, ASTNode.LABCOMM_BOOLEAN); :}
-  | BYTE
-      {: return new PrimType(BYTE, ASTNode.LABCOMM_BYTE); :}
-  | SHORT
-      {: return new PrimType(SHORT, ASTNode.LABCOMM_SHORT); :}
-  | INT
-      {: return new PrimType(INT, ASTNode.LABCOMM_INT); :}
-  | LONG
-      {: return new PrimType(LONG, ASTNode.LABCOMM_LONG); :}
-  | FLOAT
-      {: return new PrimType(FLOAT, ASTNode.LABCOMM_FLOAT); :}
-  | DOUBLE
-      {: return new PrimType(DOUBLE, ASTNode.LABCOMM_DOUBLE); :}
-  | STRING
-      {: return new PrimType(STRING, ASTNode.LABCOMM_STRING); :}
-  | SAMPLE
-      {: return new PrimType(SAMPLE, ASTNode.LABCOMM_SAMPLE); :}
-  ;
-
-UserType user_type =
-    IDENTIFIER                      {: return new UserType(IDENTIFIER); :}
-  ;
-
-StructType struct_type =
-    STRUCT LBRACE var_decl_list.l RBRACE {: return new StructType(l); :}
-  ;
-
-VoidType void_type = 
-    VOID {: return new VoidType(); :} 
-;
-
-List dim_list =
-    dim.d                           {: return new List().add(d); :}
-  | dim_list.l  dim.d               {: return l.add(d); :}
-  ;
-
-Dim dim =
-    LBRACK exp_list.e RBRACK        {: return new Dim(e); :}
-  ;
-
-List exp_list =
-    exp.e                           {: return new List().add(e); :}
-  | exp_list.l COMMA exp.e          {: return l.add(e); :}
-  ;
-
-Exp exp =
-    INTEGER_LITERAL                 {: return new IntegerLiteral(INTEGER_LITERAL); :}
-  | UNDERSCORE                      {: return new VariableSize(); :}
-  ;
diff --git a/compiler/2014/LabCommScanner.flex b/compiler/2014/LabCommScanner.flex
deleted file mode 100644
index b58cbb6be2e454ef90b750cb61d12fcef890d48c..0000000000000000000000000000000000000000
--- a/compiler/2014/LabCommScanner.flex
+++ /dev/null
@@ -1,87 +0,0 @@
-package se.lth.control.labcomm2014.compiler;
-
-import beaver.Symbol;
-import beaver.Scanner;
-import se.lth.control.labcomm2014.compiler.LabCommParser.Terminals;
-
-%%
-
-%public 
-%final 
-%class LabCommScanner
-%extends Scanner
-
-%type Symbol 
-%function nextToken 
-%yylexthrow Scanner.Exception
-
-%unicode
-%line %column
-
-%{
-  StringBuffer strbuf = new StringBuffer(128);
-
-  private Symbol sym(short id) {
-    return new Symbol(id, yyline + 1, yycolumn + 1, len(), str());
-  }
-
-  private Symbol sym(short id, String value) {
-    return new Symbol(id, yyline + 1, yycolumn + 1, len(), value);
-  }
-
-  private String str() { return yytext(); }
-  private int len() { return yylength(); }
-%}
-
-LineTerminator = \n|\r|\r\n
-InputCharacter = [^\r\n]
-
-WhiteSpace = [ ] | \t | \f | {LineTerminator}
-
-Comment = {TraditionalComment}
-        | {EndOfLineComment}
-
-TraditionalComment = "/*" [^*] ~"*/" | "/*" "*"+ "/" | "/*" "*"+ [^/*] ~"*/"
-EndOfLineComment = "//" {InputCharacter}* {LineTerminator}?
-
-Identifier = [:jletter:][:jletterdigit:]*
-
-DecimalNumeral = 0 | {NonZeroDigit} {Digits}? 
-Digits = {Digit}+
-Digit = 0 | {NonZeroDigit}
-NonZeroDigit = [1-9]
-
-%%
-
-<YYINITIAL> {
-  {WhiteSpace}                   { }
-  {Comment}                      { }
-
-  "sample"                       { return sym(Terminals.SAMPLE); }
-  "typedef"                      { return sym(Terminals.TYPEDEF); }
-  "struct"                       { return sym(Terminals.STRUCT); }
-  "void"                         { return sym(Terminals.VOID); }
-  "boolean"                      { return sym(Terminals.BOOLEAN); }
-  "byte"                         { return sym(Terminals.BYTE); }
-  "short"                        { return sym(Terminals.SHORT); }
-  "int"                          { return sym(Terminals.INT); }
-  "long"                         { return sym(Terminals.LONG); }
-  "float"                        { return sym(Terminals.FLOAT); }
-  "double"                       { return sym(Terminals.DOUBLE); }
-  "string"                       { return sym(Terminals.STRING); }
-
-  {DecimalNumeral}               { return sym(Terminals.INTEGER_LITERAL); }
-  "_"                            { return sym(Terminals.UNDERSCORE); }
-  "{"                            { return sym(Terminals.LBRACE); }
-  "}"                            { return sym(Terminals.RBRACE); }
-  "["                            { return sym(Terminals.LBRACK); }
-  "]"                            { return sym(Terminals.RBRACK); }
-  ";"                            { return sym(Terminals.SEMICOLON); }
-  ","                            { return sym(Terminals.COMMA); }
-  
-  {Identifier}                   { return sym(Terminals.IDENTIFIER); }
-}
-
-// fall through errors
-.|\n                             { throw new RuntimeException("Illegal character \""+str()+ "\" at line "+yyline+", column "+yycolumn); }
-<<EOF>>                          { return sym(Terminals.EOF); }
diff --git a/compiler/2014/LabCommTokens.jrag b/compiler/2014/LabCommTokens.jrag
deleted file mode 100644
index 27a52c16f1925ad48f4cc17376a3e43ecb8c91fb..0000000000000000000000000000000000000000
--- a/compiler/2014/LabCommTokens.jrag
+++ /dev/null
@@ -1,22 +0,0 @@
-aspect LabCommTokens {
-
-  public static final int ASTNode.LABCOMM_VERSION =    0x01;  
-  public static final int ASTNode.LABCOMM_SAMPLE_DEF = 0x02;  // The flat signature
-  public static final int ASTNode.LABCOMM_SAMPLE_REF = 0x03;  
-  public static final int ASTNode.LABCOMM_TYPE_DEF  =  0x03;  // and type declarations, hierarchically
-  public static final int ASTNode.LABCOMM_TYPE_BINDING=0x05;
-
-  public static final int ASTNode.LABCOMM_ARRAY =      0x10;
-  public static final int ASTNode.LABCOMM_STRUCT =     0x11;
-
-  public static final int ASTNode.LABCOMM_BOOLEAN =    0x20; 
-  public static final int ASTNode.LABCOMM_BYTE =       0x21;
-  public static final int ASTNode.LABCOMM_SHORT =      0x22;
-  public static final int ASTNode.LABCOMM_INT =        0x23;
-  public static final int ASTNode.LABCOMM_LONG =       0x24;
-  public static final int ASTNode.LABCOMM_FLOAT =      0x25;
-  public static final int ASTNode.LABCOMM_DOUBLE =     0x26;
-  public static final int ASTNode.LABCOMM_STRING =     0x27;
-  public static final int ASTNode.LABCOMM_SAMPLE =     0x28;
-
-}
diff --git a/compiler/2014/NameAnalysis.jrag b/compiler/2014/NameAnalysis.jrag
deleted file mode 100644
index 92dbb41d52c56b4f533649831dda41e60aea5d0a..0000000000000000000000000000000000000000
--- a/compiler/2014/NameAnalysis.jrag
+++ /dev/null
@@ -1,67 +0,0 @@
-
-aspect NameAnalysis {
-
-  inh String Decl.lookupName(String name);
-  eq Program.getDecl(int index).lookupName(String name) {
-    for (int i = 0; i < index; i++) {
-      String s = getDecl(i).getName();
-      if (s.equals(name)) {
-      	return s;
-      }
-    }
-    return null;
-  }
-  inh String Field.lookupName(String name);
-  eq StructType.getField(int index).lookupName(String name) {
-    for (int i = 0; i < index; i++) {
-      String s = getField(i).getName();
-      if (s.equals(name)) {
-      	return s;
-      }
-    }
-    return null;
-  }
-
-  inh TypeDecl Decl.lookupType(String name);
-  inh TypeDecl UserType.lookupType(String name);
-  eq Program.getDecl(int index).lookupType(String name) {
-    for(int i = 0; i < index; i++) {
-      Decl d = getDecl(i);  
-      if(d instanceof TypeDecl && d.getName().equals(name)) {
-	return (TypeDecl)d;
-      }
-    }
-    return null;
-  }
-
-  syn TypeDecl Type.decl(); 
-  eq Type.decl() = null;
-  eq UserType.decl() = lookupType(getName());
-  eq PrimType.decl() = null; //HERE BE DRAGONS XXX
-  
-  
-  public void ASTNode.nameCheck() {
-    for (int i = 0; i < getNumChild(); i++) {
-      getChild(i).nameCheck();
-    }
-  }
-  
-  public void Decl.nameCheck() {
-    if (lookupType(getName()) != null || lookupName(getName()) != null) {
-      error(getName() + " multiply declared");
-    }
-  }
-  
-  public void Field.nameCheck() {
-    if(lookupName(getName()) != null) {
-      error(getName() + " multiply declared");
-    }
-  }
-  
-  public void UserType.nameCheck() {
-    if (decl() == null) {
-      error("Use of undeclared type");
-    } 
-  }
-
-}
diff --git a/compiler/2014/PrettyPrint.jrag b/compiler/2014/PrettyPrint.jrag
deleted file mode 100644
index 3808c952309d375c828023c199472d2e6b9e43de..0000000000000000000000000000000000000000
--- a/compiler/2014/PrettyPrint.jrag
+++ /dev/null
@@ -1,117 +0,0 @@
-import java.io.PrintStream;
-
-aspect PPIndentation {
-
-  inh String Exp.pp_indent();
-  inh String Field.pp_indent();
-  inh String StructType.pp_indent();
-  eq StructType.getField(int index).pp_indent() = pp_indent() + "  ";
-  eq Program.getDecl(int index).pp_indent() = "";
-  
-}
-
-aspect PrettyPrint {
-  
-  public void ASTNode.pp(PrintStream out) {
-    throw new Error(this.getClass().getName() + 
-		    ".pp(PrintStream out)" + 
-		    " not declared");
-  }
-
-  public void Program.pp(PrintStream out) {
-    for(int i = 0; i < getNumDecl(); i++) {
-    	getDecl(i).pp(out);
-    }
-  }
-
-   // Pretty print declarations
-  public void TypeDecl.pp(PrintStream out) {
-    out.print("typedef ");
-    getType().ppIdentifier(out, getName());
-    out.println(";");
-  }
-
-  public void SampleDecl.pp(PrintStream out) {
-    out.print("sample ");
-    getType().ppIdentifier(out, getName());
-    out.println(";");
-  }
-
-  public void Field.pp(PrintStream out) {
-    out.print(pp_indent());
-    getType().ppIdentifier(out, getName());
-    out.println(";");
-  }
-
-  // Pretty print variable of a given type 
-  public void Type.ppIdentifier(PrintStream out, String id) { 
-    ppPrefix(out);
-    out.print(" ");
-    out.print(id);
-  }
-
-  public void ArrayType.ppIdentifier(PrintStream out, String id) {
-    ppPrefix(out);
-    out.print(" ");
-    out.print(id);
-    ppSuffix(out);
-  }
-
-  // PrettyPrint prefix type info
-  public void Type.ppPrefix(PrintStream out) {
-    throw new Error(this.getClass().getName() + 
-		    ".ppPrefix(PrintStream out)" + 
-		    " not declared");
-  }
-
-  public void VoidType.ppPrefix(PrintStream out) { 
-    out.print("void");
-  }
-
-//  public void SampleRefType.ppPrefix(PrintStream out) { 
-//    out.print("sample");
-//  }
-
-  public void PrimType.ppPrefix(PrintStream out) { 
-    out.print(getName());
-  }
-
-  public void UserType.ppPrefix(PrintStream out) { 
-    out.print(getName());
-  }
-
-  public void ArrayType.ppPrefix(PrintStream out) {
-    getType().ppPrefix(out);
-  }
-
-  public void StructType.ppPrefix(PrintStream out) {
-    out.println("struct {");
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).pp(out);
-    }
-    out.print(pp_indent());
-    out.print("}");
-  }
-
-  // PrettyPrint suffix type info (array dimensions)
-  public void Type.ppSuffix(PrintStream out) { }
-
-  public void ArrayType.ppSuffix(PrintStream out) { 
-    out.print("[");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      if (i > 0) { out.print(", "); }
-      getExp(i).pp(out);
-    }
-    out.print("]");
-    getType().ppSuffix(out);
-  }
-
-  public void IntegerLiteral.pp(PrintStream out) {
-    out.print(getValue());
-  }
-
-  public void VariableSize.pp(PrintStream out) {
-    out.print("_");
-  }
-
-}
diff --git a/compiler/2014/RAPID_CodeGen.jrag b/compiler/2014/RAPID_CodeGen.jrag
deleted file mode 100644
index b367ee5720eb34ff4cd308cd4eeab56a6d1002cd..0000000000000000000000000000000000000000
--- a/compiler/2014/RAPID_CodeGen.jrag
+++ /dev/null
@@ -1,369 +0,0 @@
-
-aspect RAPID_env {
-	public class RAPID_env {
-                public final int version;
-		private String prefix;
-		private StringBuilder types;
-		private StringBuilder constants;
-		private StringBuilder procedures;
-		private PrintStream ps;
-
-		public RAPID_env(PrintStream ps, String prefix, int version)
-		{
-			this.version = version;
-			this.types = new StringBuilder();
-			this.constants = new StringBuilder();
-			this.procedures = new StringBuilder();
-			this.prefix = prefix;
-			this.ps = ps;
-		}
-
-		public String prefix() { return this.prefix; }
-
-		public String addRecord(String name, java.util.List<String> components)
-		{
-			String recordName = this.prefix + "_" + name;
-			types.append("\tRECORD " + recordName);
-			types.append("\n");
-			for (String c : components) {
-				types.append("\t\t" + c + "\n");
-			}
-			types.append("\tENDRECORD");
-			types.append("\n\n");
-			return recordName;
-		}
-
-		public void addConstant(String type, String name, String value) {
-			this.constants.append("\tLOCAL CONST " + type + " " + name +
-					" := " + value + ";\n");
-		}
-
-		public void addProc(String name, java.util.List<String> params,
-					java.util.List<String> stmts)
-		{
-			this.procedures.append("\tLOCAL PROC " + name + "(");
-			for (int i = 0; i < params.size(); i++) {
-				this.procedures.append(params.get(i));
-				if (i < params.size() - 1) {
-					this.procedures.append(", ");
-				}
-			}
-			this.procedures.append(")\n");
-			for (String stmt : stmts) {
-				this.procedures.append("\t\t" + stmt + "\n");
-			}
-			this.procedures.append("\tERROR\n\t\tRAISE ;\n\tENDPROC\n\n");
-		}
-
-		public void flush()
-		{
-			ps.println("MODULE " + prefix() + "(SYSMODULE)");
-			ps.println();
-			ps.print(types.toString());
-			ps.println();
-			ps.println("\tLOCAL CONST string prefix:=\"" + this.prefix + "\";");
-			ps.print(constants.toString());
-			ps.println();
-			ps.print(procedures.toString());
-			ps.println();
-			ps.print("ENDMODULE");
-		}
-	}
-}
-
-aspect RAPID_CodeGen {
-
-	public void ASTNode.RAPID_gen(RAPID_env env) {
-		throw new UnsupportedOperationException();
-	}
-
-	public void Program.RAPID_gen(String file, String prefix, int version)
-			throws IOException
-	{
-		PrintStream ps = new PrintStream(new FileOutputStream(new File(file)));
-		RAPID_env env = new RAPID_env(ps, prefix, version);
-		RAPID_gen(env);
-	}
-
-	public void Program.RAPID_gen(RAPID_env env)
-	{
-		for (int i = 0; i < getNumDecl(); i++) {
-			getDecl(i).RAPID_gen(env);
-		}
-		env.flush();
-	}
-
-	public void Decl.RAPID_gen(RAPID_env env) {
-		throw new UnsupportedOperationException("RAPID code generation (currently) does not support "+getClass().getSimpleName());
-	}
-
-	public void TypeDecl.RAPID_gen(RAPID_env env) {
-		System.out.println("***WARNING! TypeDecl.RapidGen(.) a NOP after sig reorganization.");
-		System.out.println("            (Tell a developer to) remove this warning when tested");
-	}
-
-	public void Decl.RAPID_emitFlatSignature(RAPID_env env, String sig_len_name, String sig_name) {
-		System.out.println("***WARNING! Code not tested after reorganization of signatures.");
-		System.out.println("            (Tell a developer to) remove this warning when tested");
-		SignatureList sig = flatSignature(env.version);
-		StringBuilder sb = new StringBuilder();
-		sb.append("[");
-		byte[] d = null;
-		int sig_len = 0;
-		for (int i = 0; i < sig.size(); i++) {
-			d = sig.getData(i, env.version);
-			for (int j = 0; d != null && j < d.length; j++) {
-				sb.append(d[j] + ",");
-				sig_len++;
-			}
-		}
-		sb.delete(sb.length() - 1, sb.length());
-		sb.append("]");
-		env.addConstant("num", sig_len_name, "" + sig_len);
-		env.addConstant("byte", sig_name + "{" + sig_len_name + "}",
-		sb.toString());
-	} 
-
-	public void SampleDecl.RAPID_gen(RAPID_env env) {
-		// Add type declarations
-		String fullName = getType().RAPID_AddType(env, getName());
-		// Add signature constants
-		String sig_len_name = "signature_len_" + getName();
-		String sig_name = "signature_" + getName();
-
-		RAPID_emitFlatSignature(env, sig_len_name, sig_name);
-
-		// Add decode procedures
-		ArrayList<String> params = new ArrayList<String>();
-		ArrayList<String> stmts = new ArrayList<String>();
-		params.add("VAR LabComm_Decoder_Sample s");
-		params.add("string handler");
-		stmts.add("s.prefix := prefix;");
-		stmts.add("s.name := \"" + getName() + "\";");
-		stmts.add("s.handler := handler;");
-		env.addProc("Dec_Reg_" + getName(), params, stmts);	
-
-		params.clear();
-		stmts.clear();
-		params.add("VAR LabComm_Decoder_Sample s");
-		params.add("VAR rawbytes sig");
-		params.add("num user_id");
-		stmts.add("VAR byte tmp_sig{" + sig_len_name + "};");
-		stmts.add("IF RawBytesLen(sig)<>" + sig_len_name + " THEN");
-		stmts.add("\tRETURN;");
-		stmts.add("ENDIF");
-		stmts.add("FOR i FROM 1 TO " + sig_len_name + " DO");
-		stmts.add("\tUnpackRawBytes sig, i, tmp_sig{i}, \\Hex1;");
-		stmts.add("ENDFOR");
-		stmts.add("IF tmp_sig<>" + sig_name + " THEN");
-		stmts.add("\tRETURN;");
-		stmts.add("ENDIF");
-		stmts.add("s.user_id := user_id;");
-		env.addProc("Reg_If_Signature_Of_" + getName(), params, stmts);
-
-		params.clear();
-		stmts.clear();
-		params.add("VAR Decoder d");
-		params.add("VAR LabComm_Stream st");
-		params.add("VAR LabComm_Decoder_Sample s");
-		stmts.add("VAR " + fullName + " tmp;");
-		getType().RAPID_AddDecodeInstr(env, stmts, "tmp", "st");
-		stmts.add("% s.handler % tmp;");
-		env.addProc("Decode_And_Handle_" + getName(), params, stmts);
-
-		params.clear();
-		stmts.clear();
-		params.add("VAR Encoder e");
-		params.add("VAR LabComm_Stream st");
-		params.add("VAR LabComm_Encoder_Sample s");
-		stmts.add("s.prefix := prefix;");
-		stmts.add("s.name := \"" + getName() + "\";");
-		stmts.add("Encoder_Register_Sample e, st, s;");
-		env.addProc("Enc_Reg_" + getName(), params, stmts);
-
-		params.clear();
-		stmts.clear();
-		params.add("VAR Encoder e");
-		params.add("VAR LabComm_Stream s");
-		stmts.add("VAR rawbytes buffer;");
-		stmts.add("FOR i FROM 1 TO " + sig_len_name + " DO");
-		stmts.add("\tPackRawBytes " + sig_name +
-					"{i}, buffer, \\Network, i, \\Hex1;");
-		stmts.add("ENDFOR");
-		stmts.add("SocketSend s.soc, \\RawData:=buffer, \\NoOfBytes:=" +
-					sig_len_name + ";");
-		env.addProc("Encode_Signature_" + getName(), params, stmts);
-
-		params.clear();
-		stmts.clear();
-		params.add("VAR Encoder e");
-		params.add("VAR LabComm_Stream st");
-		params.add("VAR LabComm_Encoder_Sample s");
-		params.add("VAR " + fullName + " val");
-		stmts.add("Encode_Packed st, s.user_id;");
-		getType().RAPID_AddEncodeInstr(env, stmts, "val", "st");
-		env.addProc("Encode_" + getName(), params, stmts);
-	}
-
-	public String Type.RAPID_AddType(RAPID_env env, String name) {
-		throw new UnsupportedOperationException("RAPID code generation does (currently) not support "+getClass().getSimpleName());
-	}
-
-	public String StructType.RAPID_AddType(RAPID_env env, String name) {
-		ArrayList<String> components = new ArrayList<String>();
-		for (int i = 0; i < getNumField(); i++) {
-			Field f = getField(i);
-			components.add(
-					f.getType().RAPID_AddType(env, name + "_" + f.getName()) +
-					" " + f.getName() + ";");
-		}
-		String typeName = env.addRecord(name, components);
-		return typeName;
-	}
-
-	public String FixedArrayType.RAPID_AddType(RAPID_env env, String name) {
-		String typeName = getType().RAPID_AddType(env, name + "_e");
-		if (getNumExp() > 1) {
-			throw new UnsupportedOperationException("RAPID generation only (currently) supports one-dimensional arrays");
-		}
-		ArrayList<String> components = new ArrayList<String>();
-		for (int i = 1; i <= getExp(0).RAPID_getValue(); i++) {
-			components.add(typeName + " e" + i + ";");
-		}
-		String completeName = env.addRecord("list_" + name, components);
-		return completeName;
-	}
-
-	public String PrimType.RAPID_AddType(RAPID_env env, String name) {
-		if (getToken() == LABCOMM_SHORT ||
-			getToken() == LABCOMM_FLOAT ||
-			getToken() == LABCOMM_INT) {
-			return "num";
-		} else if (getToken() == LABCOMM_LONG) {
-			return "dnum";
-		} else if (getToken() == LABCOMM_STRING) {
-			return "string";
-		} else if (getToken() == LABCOMM_BOOLEAN) {
-			return "bool";
-		} else if (getToken() == LABCOMM_BYTE) {
-			return "byte";
-		}
-		throw new UnsupportedOperationException("RAPID code generation does not (currently) support "+getName());
-	}
-
-	public void Type.RAPID_AddDecodeInstr(RAPID_env env,
-			java.util.List<String> instrs,
-			String var_name, String stream_name) {
-		throw new UnsupportedOperationException("RAPID code generation does not (currently) support "+getClass().getSimpleName());
-	}
-
-	public void StructType.RAPID_AddDecodeInstr(RAPID_env env,
-			java.util.List<String> instrs,
-			String var_name, String stream_name) {
-		for (int i = 0; i < getNumField(); i++) {
-			getField(i).getType().RAPID_AddDecodeInstr(env, instrs,
-					var_name + "." + getField(i).getName(), stream_name);
-		}
-	}
-
-	public void FixedArrayType.RAPID_AddDecodeInstr(RAPID_env env,
-			java.util.List<String> instrs,
-			String var_name, String stream_name) {
-		for (int i = 1; i <= getExp(0).RAPID_getValue(); i++) {
-			getType().RAPID_AddDecodeInstr(env, instrs,
-					var_name + ".e" + i, stream_name);
-		}
-	}
-
-	public void PrimType.RAPID_AddDecodeInstr(RAPID_env env,
-			java.util.List<String> instrs,
-			String var_name, String stream_name) {
-		switch(getToken()) {
-			case LABCOMM_BYTE:
-				instrs.add("Decode_Byte " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_BOOLEAN:
-				instrs.add("Decode_Bool " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_SHORT:
-				instrs.add("Decode_Short " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_INT:
-				instrs.add("Decode_Int " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_LONG:
-				instrs.add("Decode_Long " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_FLOAT:
-				instrs.add("Decode_Float " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_STRING:
-				instrs.add("Decode_String " + stream_name + "," + var_name + ";");
-				break;
-			default:
-				throw new UnsupportedOperationException("RAPID code generation does not (currently) support "+getName());
-		}
-	}
-
-	public void Type.RAPID_AddEncodeInstr(RAPID_env env,
-			java.util.List<String> instrs,
-			String var_name, String stream_name) {
-		throw new UnsupportedOperationException("RAPID code generation does not (currently) support "+getClass().getSimpleName());
-	}
-
-	public void StructType.RAPID_AddEncodeInstr(RAPID_env env,
-			java.util.List<String> instrs,
-			String var_name, String stream_name) {
-		for (int i = 0; i < getNumField(); i++) {
-			getField(i).getType().RAPID_AddEncodeInstr(env, instrs,
-					var_name + "." + getField(i).getName(), stream_name);
-		}
-	}
-
-	public void FixedArrayType.RAPID_AddEncodeInstr(RAPID_env env,
-			java.util.List<String> instrs,
-			String var_name, String stream_name) {
-		for (int i = 1; i <= getExp(0).RAPID_getValue(); i++) {
-			getType().RAPID_AddEncodeInstr(env, instrs,
-					var_name + ".e" + i, stream_name);
-		}
-	}
-
-	public void PrimType.RAPID_AddEncodeInstr(RAPID_env env,
-			java.util.List<String> instrs,
-			String var_name, String stream_name) {
-		switch(getToken()) {
-			case LABCOMM_BYTE:
-				instrs.add("Encode_Byte " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_BOOLEAN:
-				instrs.add("Encode_Bool " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_SHORT:
-				instrs.add("Encode_Short " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_INT:
-				instrs.add("Encode_Int " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_LONG:
-				instrs.add("Encode_Long " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_FLOAT:
-				instrs.add("Encode_Float " + stream_name + "," + var_name + ";");
-				break;
-			case LABCOMM_STRING:
-				instrs.add("Encode_String " + stream_name + "," + var_name + ";");
-				break;
-			default:
-				throw new UnsupportedOperationException("RAPID code generation does not (currently) support "+getName());
-		}
-	}
-
-	public int Exp.RAPID_getValue() {
-		throw new UnsupportedOperationException("RAPID code generation does not (currently) support "+getClass().getSimpleName());
-	}
-
-	public int IntegerLiteral.RAPID_getValue() {
-		return Integer.parseInt(getValue());
-	}
-}
diff --git a/compiler/2014/Signature.jrag b/compiler/2014/Signature.jrag
deleted file mode 100644
index b32e53580aa900e31357333904aeeb115180bcf0..0000000000000000000000000000000000000000
--- a/compiler/2014/Signature.jrag
+++ /dev/null
@@ -1,229 +0,0 @@
-import java.util.*;
-
-aspect Signature {  
-
-  syn boolean Decl.isSampleDecl();
-  eq TypeDecl.isSampleDecl() = false;
-  eq SampleDecl.isSampleDecl() = true;
-
-  syn boolean Decl.sendOnlyFlatSignatures(Java_env env) = (env.version==2006);
-
-  eq Decl.getSignature().parentDecl() = this;
-  eq Signature.getSignatureList().parentDecl() = parentDecl();
-
-  inh Decl Signature.parentDecl();
-  inh Decl SignatureList.parentDecl();
-
-
-  syn nta Signature Decl.getSignature() { 
-    SignatureList sl = new SignatureList();
-    genSigLineForDecl(sl, true);
-    SignatureList fsl = new SignatureList();
-    flatSignature(fsl);
-    Signature sig = new Signature();
-    sig.setSignatureList(sl);
-    sig.setFlatSignatureList(fsl);
-    setSignature(sig);
-    return sig;
-  }
-
-  public String SignatureLine.getIndentString() {
-    StringBuffer result = new StringBuffer();
-    int indent = getIndent();
-    for (int i = 0 ; i < indent ; i++) {
-      result.append("  ");
-    }
-    return result.toString();
-  }
-
-    syn byte[] SignatureLine.getData(int version) = null;
-    //  return new byte[0];
-
-    private Decl TypeRefSignatureLine.decl;
-    public TypeRefSignatureLine.TypeRefSignatureLine(int indent, Decl decl, String comment) {
-      super(indent, comment);
-      this.decl = decl;
-    }
-    public void SignatureList.addTypeRef(Decl type, String comment) {
-        addSignatureLine(new TypeRefSignatureLine(indent, type, comment));
-    }
-
-    public ByteArraySignatureLine.ByteArraySignatureLine(int indent, byte[] data, String comment) {
-      super(indent, comment);
-      setData(data);
-    }
-
-    public IntSignatureLine.IntSignatureLine(int indent, int data, String comment) {
-      super(indent, comment);
-      setData(data);
-    }
-
-    public void SignatureList.add(byte[] data, String comment) {
-      addSignatureLine(new ByteArraySignatureLine(indent, data, comment));
-    }
-
-    public void SignatureList.addInt(int data, String comment) {
-      addSignatureLine(new IntSignatureLine(indent, data, comment));
-    }
-
-    protected byte[] DataSignatureLine.getIntBytes(int value, int version) {
-      byte data[];
-      switch(version) {
-        case 2006:             // Use old encoding with 32 bit integers
-	    data = new byte[4];
-	    for (int i = 0 ; i < 4 ; i++) {
-	        data[3 - i] = (byte)((value >> (8 * i)) & 0xff);
-	    }
-	    //add(data, comment);
-        break;
-        case 2014:             // Use new encoding with varints
-	    byte[] tmp = new byte[5];
- 	    long v = value & 0xffffffff;
-            int i, j;
-            for (i = 0 ; i == 0 || v != 0 ; i++, v = (v >> 7)) {
-		tmp[i] = (byte)(v & 0x7f);
-            }
-	    byte[] packed = new byte[i];
-            for (i = i - 1, j = 0 ; i >= 0 ; i--, j++) {
-		packed[j] = (byte)(tmp[i] | (i!=0?0x80:0x00));
-            }
-	    //add(packed, comment);
-            data = packed;
-        break;
-        default: 
-            throw new RuntimeException("Unsupported version = "+version+". This should never happen.");
-      }
-      return data;
-    }
-
-    eq IntSignatureLine.getData(int version) {
-      return getIntBytes(getData(), version);
-    }
-
-    public void SignatureList.addString(String data, String comment) {
-      addSignatureLine(new StringSignatureLine(indent, comment, data));
-    }
-    eq StringSignatureLine.getData(int version) {
-      byte[] lenBytes = getIntBytes(getData().length(), version);
-      byte[] data = new byte[lenBytes.length+getData().length()];
-
-      // first add the encoded length
-      for (int i = 0 ; i < lenBytes.length ; i++) {
-        data[i] = lenBytes[i];
-      }
-      // and then the actual chars
-      for (int i = 0 ; i < getData().length() ; i++) {
-        int idx = lenBytes.length + i;
-        data[idx] = (byte)(getData().charAt(i) & 0xff);
-      }
-      return data;
-    }
-
-    public int SignatureList.size() {
-      return getNumSignatureLine();
-    }
-
-    public String SignatureList.getIndent(int i) {
-      StringBuffer result = new StringBuffer();
-      int indent = getSignatureLine(i).getIndent();
-      for (i = 0 ; i < indent ; i++) {
-        result.append("  ");
-      }
-      return result.toString();
-    }
-
-    public byte[] SignatureList.getData(int i, int version) {
-      return getSignatureLine(i).getData(version);
-    }
-
-    public String SignatureList.getComment(int i) {
-      return getSignatureLine(i).getComment();
-    }
-
-    private int SignatureList.indent;
-
-    public void SignatureList.indent() {
-      indent++;
-    }
-
-    public void SignatureList.unindent() {
-      indent--;
-    }
-
-
-  public void ASTNode.genSigLineForDecl(SignatureList list, boolean decl) {
-    throw new Error(this.getClass().getName() + 
-                    ".genSigLineForDecl(SignatureList list)" + 
-                    " not declared");
-  }
-
-  public void TypeDecl.genSigLineForDecl(SignatureList list, boolean decl) {
-    if(decl){
-      getType().genSigLineForDecl(list, decl);
-    }else{
-      list.addTypeRef(this, "//TODO (from list.addTypeRef)");
-    }
-  }
-
-  public void SampleDecl.genSigLineForDecl(SignatureList list, boolean decl) {
-    getType().genSigLineForDecl(list, decl);
-  }
-
-  public void VoidType.genSigLineForDecl(SignatureList list, boolean decl) {
-    list.addInt(LABCOMM_STRUCT, "void");
-    list.addInt(0, null);
-  }
-
-//  public void SampleRefType.genSigLineForDecl(SignatureList list, boolean decl) {
-//    list.addInt(LABCOMM_SAMPLE_REF, "sample");
-//  }
-  public void PrimType.genSigLineForDecl(SignatureList list, boolean decl) {
-    list.addInt(getToken(), null);
-  }
-
-  /* For UserType, the decl parameter is ignored, as a UserType
-   * will always be a TypeRef
-   */
-  public void UserType.genSigLineForDecl(SignatureList list, boolean decl) {
-      
-      TypeDecl thet = lookupType(getName());
-      list.addTypeRef(thet, null);
-  }
-
-  public void ArrayType.genSigLineForDecl(SignatureList list, boolean decl) {
-    list.addInt(LABCOMM_ARRAY, signatureComment());
-    list.indent();
-    list.addInt(getNumExp(), null);
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      getExp(i).genSigLineForDecl(list, false);
-    }
-    getType().genSigLineForDecl(list, false);
-    list.unindent();
-    list.add(null, "}");
-  }
-
-  public void StructType.genSigLineForDecl(SignatureList list, boolean decl) {
-    list.addInt(LABCOMM_STRUCT, "struct { " + getNumField() + " fields");
-    list.indent();
-    list.addInt(getNumField(), null);
-    for (int i = 0 ; i < getNumField() ; i++) {
-      getField(i).genSigLineForDecl(list, false);
-    }
-    list.unindent();
-    list.add(null, "}");
-  }
-
-  public void Field.genSigLineForDecl(SignatureList list, boolean decl) {
-    list.addString(getName(), signatureComment());
-    getType().genSigLineForDecl(list, decl);
-  }
-
-  public void IntegerLiteral.genSigLineForDecl(SignatureList list, boolean decl) {
-    list.addInt(Integer.parseInt(getValue()), null);
-  }
-
-  public void VariableSize.genSigLineForDecl(SignatureList list, boolean decl) {
-    list.addInt(0, null);
-  }
-
-}
diff --git a/compiler/2014/TypeCheck.jrag b/compiler/2014/TypeCheck.jrag
deleted file mode 100644
index a640ace5098013bef6cad31767a96220aa66b8a7..0000000000000000000000000000000000000000
--- a/compiler/2014/TypeCheck.jrag
+++ /dev/null
@@ -1,36 +0,0 @@
-aspect TypeCheck {
-  public void ASTNode.typeCheck() {
-      // calls to the different type checks to be performed
-      nullTypeCheck();
-  }
-
-// void is not allowed as a field in a struct or an array element
-  
-  syn boolean Type.isNull();
-  eq Type.isNull() = false;
-  eq VoidType.isNull() = true;
-  eq UserType.isNull() = decl().isNull();
-
-  syn boolean TypeDecl.isNull();
-  eq TypeDecl.isNull() = getType().isNull();
-  
-  public void ASTNode.nullTypeCheck() {}
- 
-  public void Field.nullTypeCheck() {
-    if(getType().isNull()) {
-      error("field " + getName() + " of struct "+ declName()+ " may not be of type void");
-    }
-  }
-
-  public void ParseArrayType.nullTypeCheck() {
-    if(getType().isNull()) {
-      error("elements of array "+declName()+" may not be of type void");
-    }
-  }
-
-  public void ArrayType.nullTypeCheck() {
-    if(getType().isNull()) {
-      error("elements of array "+declName()+" may not be of type void");
-    }
-  }
-} 
diff --git a/compiler/2014/TypeReferences.jrag b/compiler/2014/TypeReferences.jrag
deleted file mode 100644
index 0a7cd9b0a1cd9a0a92ab49f4f4c509eb2a16fe56..0000000000000000000000000000000000000000
--- a/compiler/2014/TypeReferences.jrag
+++ /dev/null
@@ -1,46 +0,0 @@
-aspect User_Types {
-  syn String Type.getTypeName();
-  eq Type.getTypeName() = getClass().getName();
-  eq PrimType.getTypeName() = getName();
-  eq UserType.getTypeName() = getName();
-
-  syn boolean Type.isUserType();
-  eq Type.isUserType() = false;
-  eq UserType.isUserType() = true;
-}
-
-aspect Type_References {
- 
-  // The dependencies on other type declarations for a Decl.
-  coll Set<Decl> Decl.type_dependencies() [new HashSet<Decl>()] with add;
-
-  Field contributes ((UserType)getType()).decl()   
-  when parentDecl() != null && getType().isUserType()
-  to Decl.type_dependencies() 
-  for parentDecl();
-
-  UserType contributes decl()   
-  when parentDecl() != null 
-  to Decl.type_dependencies() 
-  for parentDecl();
-  /*
-  Field contributes getType().decl()   
-  when parentDecl() != null && getType().isLeafType()
-  to Decl.type_dependencies() 
-  for parentDecl();
-  */
-
-
-  // The references from other type declarations to a Decl.
-  coll Set<Decl> Decl.type_references() [new HashSet<Decl>()] with add;
-
-  Decl contributes this
-  to Decl.type_references()
-  for each type_dependencies();
-
-  syn boolean Decl.hasDependencies();
-  eq Decl.hasDependencies() = !type_dependencies().isEmpty();
-
-  syn boolean Decl.isReferenced();
-  eq Decl.isReferenced() = !type_references().isEmpty();
-}
diff --git a/compiler/2014/Version.jrag b/compiler/2014/Version.jrag
deleted file mode 100644
index f080578c8a56af923615829f1c11aeee46d65c9e..0000000000000000000000000000000000000000
--- a/compiler/2014/Version.jrag
+++ /dev/null
@@ -1,15 +0,0 @@
-aspect Version {
-
-    /* An auxilliary class for handling naming and prefixes connected
-     * to the LabComm version
-     */
-    class LabCommVersion {
-        public static String versionString(int version) {
-            return (version == 2006) ? "2006" : "";
-        }       
-
-        public static boolean versionHasPragma(int version) {
-            return version != 2006;
-        }
-    }
-}
diff --git a/compiler/LabComm.java b/compiler/LabComm.java
deleted file mode 100644
index a6f4c6b1ad8c245bff57ccbec4692b0ce207989c..0000000000000000000000000000000000000000
--- a/compiler/LabComm.java
+++ /dev/null
@@ -1,36 +0,0 @@
-import java.util.Vector;
-
-public class LabComm {
-
-  public static void main(String[] args) throws Exception {
-    String ver = null;
-    Vector<String> outargs = new Vector<String>();
-    
-    for (String s: args) {
-      if (s.startsWith("--ver=")) {
-        String newver = s.substring(6);
-        if (ver != null && !ver.equals(newver)) {
-          throw new Exception("Mismatching versions '" + ver +
-                              "' != '" + newver);
-          
-        }
-        ver = newver;
-      } else {
-        outargs.add(s);
-      }
-    }
-    for (String s: outargs) {
-      System.out.println(s);
-    }
-    if (ver != null && ver.equals("2006")) {
-      outargs.add(0, "--ver=2006");
-      se.lth.control.labcomm2006.compiler.LabComm.main(outargs.toArray(
-                                                         new String[0]));
-    } else if (ver == null || ver.equals("2014")) {
-      outargs.add(0, "--ver=2014");
-      se.lth.control.labcomm2014.compiler.LabComm.main(outargs.toArray(
-                                                         new String[0]));
-    } 
-  }
-
-}
diff --git a/compiler/Makefile b/compiler/Makefile
index f9353420fff395a687f06dac758c2382c131f72a..66aaf9cbac39dd925c9a82a66e738d8b0691bdd9 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -9,7 +9,7 @@ clean: ant-clean
 	rm -f *~
 
 .PHONY: distclean
-distclean: clean
+distclean: clean ant-distclean
 
 .PHONY: ant-%
 ant-%:
diff --git a/compiler/build.xml b/compiler/build.xml
index 7d63d688aad5b200bc8b3fffdf5c5e2058756fa6..dc87a7c868cc5146c519ada2807c2020903e54f5 100644
--- a/compiler/build.xml
+++ b/compiler/build.xml
@@ -127,7 +127,6 @@
     <srcfiles dir='.'>
       <include name="*.java"/>
       <include name="2006/*.java"/>
-      <include name="2014/*.java"/>
       <include name="${outdir}/**/*.java"/>
     </srcfiles>
     <mapper type="merge" 
@@ -138,7 +137,7 @@
 <target name="compile" depends="compile.cu" unless="compile.u">
   <echo message = "compiling"/>
   <javac debug="true" srcdir="." destdir="${outdir}"
-         includes="*.java 2006/*.java 2014/*.java gen/**/*.java" 
+         includes="*.java 2006/*.java gen/**/*.java" 
          classpath="${outdir}:${tools}/beaver-rt.jar:${tools}/junit.jar"
          includeantruntime="false"
          fork="true" memoryMaximumSize="128M">
@@ -170,29 +169,6 @@
   </jar>
 </target>
 
-<target name="jar.all.cu">
-  <uptodate property="jar.all.u">
-    <srcfiles dir=".">
-      <include name="${outdir}/**/*.class"/>
-    </srcfiles>
-    <mapper type="merge" 
-            to="labcomm_compiler.jar"/>
-  </uptodate>
-</target>
-
-<target name="jar.all" depends="jar.all.cu" unless="jar.all.u">
-  <echo message = "Generating labcomm_compiler.jar"/>
-  <jar destfile="labcomm_compiler.jar">
-    <fileset dir="${outdir}" 
-             includes="**/*.class"/>
-    <zipfileset src="tools/beaver-rt.jar" includes="beaver/*.class"/>
-    <manifest>
-      <attribute name="Main-Class" 
-                 value="LabComm"/>
-    </manifest>
-  </jar>
-</target>
-
 <target name="do.version">
   <!-- Wrapper that sets up package and package_path based on ${version} -->
   <local name="package"/>
@@ -223,11 +199,6 @@
     <param name="version" value="2006"/>
     <param name="outdir" value="gen"/>
   </antcall>
-  <antcall target="do.version">
-    <param name="do" value="all.version"/>
-    <param name="version" value="2014"/>
-    <param name="outdir" value="gen"/>
-  </antcall>
   <antcall target="compile">
     <param name="outdir" value="gen"/>
   </antcall>
@@ -236,14 +207,6 @@
     <param name="version" value="2006"/>
     <param name="outdir" value="gen"/>
   </antcall>
-  <antcall target="do.version">
-    <param name="do" value="jar.version"/>
-    <param name="version" value="2014"/>
-    <param name="outdir" value="gen"/>
-  </antcall>
-  <antcall target="jar.all">
-    <param name="outdir" value="gen"/>
-  </antcall>
 </target>
 
 <target name="clean">
diff --git a/compiler/labcomm b/compiler/labcomm
deleted file mode 100755
index 604b83a9e365b4a6dc36adc4faca54a3be2b2f1d..0000000000000000000000000000000000000000
--- a/compiler/labcomm
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-java -jar /lib/labcomm_compiler.jar "$@"
diff --git a/compiler/labcomm2014 b/compiler/labcomm2014
deleted file mode 100755
index 901a413a2575e4361fbdbd53925a9f4b9074f231..0000000000000000000000000000000000000000
--- a/compiler/labcomm2014
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-java -jar /lib/labcomm2014_compiler.jar "$@"
diff --git a/doc/tech_report.tex b/doc/tech_report.tex
deleted file mode 100644
index 651076d99809b5d5fd7068e1147f4b24ad6c4207..0000000000000000000000000000000000000000
--- a/doc/tech_report.tex
+++ /dev/null
@@ -1,910 +0,0 @@
-% *** en embryo of a technical report describing the labcomm design rationale and implementation ***
-
-\documentclass[a4paper]{article}
-\usepackage{listings}
-%\usepackage{verbatims}
-%\usepackage{todo}
-
-\begin{document}
-\title{Labcomm tech report}
-\author{Anders Blomdell and Sven Gesteg\aa{}rd Robertz }
-\date{draft, \today}
-
-\maketitle
-
-\begin{abstract}
-
-LabComm is a binary protocol suitable for transmitting and storing samples of
-process data. It is self-describing and independent of programming language,
-processor, and network used (e.g., byte order, etc).  It is primarily intended
-for situations where the overhead of communication has to be kept at a minimum,
-hence LabComm only requires one-way communication to operate. The one-way
-operation also has the added benefit of making LabComm suitable as a storage
-format.
-
-LabComm provides self-describing channels, as communication starts with the
-transmission of an encoded description of all possible sample types that can
-occur, followed by any number of actual samples in any order the sending
-application sees fit.
-
-The LabComm system is based on a binary protocol and
-and a compiler that generates encoder/decoder routines for popular languages
-including C, Java, and Python. There is also a standard library for the
-languages supported by the compiler, containing generic routines for
-encoding and decoding types and samples, and interaction with
-application code.
-
-The LabComm compiler accepts type and sample declarations in a small language
-that is similar to C or Java type-declarations.
-\end{abstract}
-\section{Introduction}
-
-%[[http://rfc.net/rfc1057.html|Sun RPC]]
-%[[http://asn1.org|ASN1]].
-
-LabComm has got it's inspiration from Sun RPC~\cite{SunRPC}
-and ASN1~\cite{ASN1}. LabComm is primarily intended for situations
-where the overhead of communication has to be kept at a minimum, hence LabComm
-only requires one-way communication to operate. The one-way operation also has
-the added benefit of making LabComm suitable as a storage format.
-
-Two-way comminication adds complexity, in particular for hand-shaking
-during establishment of connections, and the LabComm library provides
-support for (for instance) avoiding deadlocks during such hand-shaking.
-
-\pagebreak
-\section{Communication model}
-
-LabComm provides self-describing communication channels, by always transmitting
-a machine readable description of the data before actual data is
-sent\footnote{Sometimes referred to as \emph{in-band} self-describing}.
-Therefore, communication on a LabComm channel has two phases
-
-\begin{enumerate}
-\item the transmission of signatures (an encoded description including data
-types and names, see appendix~\ref{sec:ProtocolGrammar} for details) for all sample types
-that can be sent on the channel
-\item the transmission of any number of actual samples in any order
-\end{enumerate}
-
-During operation, LabComm will ensure (i.e., monitor) that a communication
-channel is fully configured, meaning that both ends agree on what messages that
-may be passed over that channel.  If an unregistered sample type is sent or
-received, the LabComm encoder or decoder will detect it and take action.
-In more dynamic applications, it is possible to reconfigure a channel in order to add,
-remove, or change the set of registered sample types. This is discussed
-in Section~\ref{sec:reconfig}.
-
-The roles in setting up, and maintaining, the configuration of a channel are as follows:
-
-\paragraph{The application software} (or higher-level protocol) is required to
-
-\begin{itemize}
-\item register all samples to be sent on a channel with the encoder
-\item register handlers for all samples to be received  on a channel with the decoder
-\end{itemize}
-
-\paragraph{The transmitter (encoder)}
-
-\begin{itemize}
- \item ensures that the signature of a sample is transmitted on the channel before samples are
-       written to that channel
-\end{itemize}
-
-\paragraph{The receiver (decoder)}
-
-\begin{itemize}
- \item checks, for each signature, that the application has registered a handler for that sample type
- \item if an unhandled signature is received, pauses the channel and informs the application
-\end{itemize}
-
-The fundamental communication model applies to all LabComm channels and
-deals with the individual unidirectional channels. In addition to that,
-the labcomm libraries support the implementation of higher-level
-handshaking and establishment of bidirectional channels both through
-means of interacting with the underlying transport layer (e.g., for
-marking packets containing signatures as \emph{important}, for
-transports that handle resending of dropped packets selectively), or
-requesting retransmission of signatures.
-
-In order to be both lean and generic, LabComm does not provide a
-complete protocol for establishing and negotiating bidirectional
-channels, but does provide support for building such protocols on top
-of LabComm.
-\subsection{Reconfiguration}
-\label{sec:reconfig}
-
-The fundamental communication model can be generalized to the life-cycle
-of a concrete communication channel, including the transport layer,
-between two end-points. Then, the communication phases are
-\begin{enumerate}
-  \item \emph{Establishment} of communication channel at the transport layer
-  \item \emph{Configuration} of the LabComm channel (registration of sample
-    types)
-  \item \emph{Operation} (transmission of samples)
-\end{enumerate}
-where it is possible to \emph{reconfigure} a channel by transitioning
-back from phase 3 to phase 2. That allows dynamic behaviour, as a sample
-type can be added or redefined at run-time. It also facilitates error
-handling in two-way channels.
-
-One example of this, more dynamic, view of a labcomm channel is that the
-action taken when an unregistered sample is sent or received is to
-revert back to the configuration phase and redo the handshaking to
-ensure that both sides agree on the set of sample types (i.e.,
-signatures) that are currently configured for the channel.
-
-From the system perspective, the LabComm protocol is involved in
-phases 2 and 3. The establishement of the \emph{transport-layer}
-channels is left to external application code. In the Labcomm library,
-that application code is connected to the LabComm routines through
-the \emph{reader} and \emph{writer} interfaces,
-with default implementations for sockets or file descriptors (i.e.,
-files and streams).
-
-
-\section{The Labcomm language}
-
-The LabComm language is used to describe data types, and from such data
-descriptions, the compiler generates code for encoding and decoding
-samples. The language is quite similar to C struct declarations, with
-some exceptions. We will now introduce the language through a set of
-examples.
-
-These examples do not cover the entire language
-specification (see appendix~\ref{sec:LanguageGrammar} for the complete
-grammar), but serve as a gentle introduction to the LabComm
-language covering most common use-cases.
-
-\subsection{Primitive types}
-
-\begin{verbatim}
-  sample boolean a_boolean;
-  sample byte a_byte;
-  sample short a_short;
-  sample int an_int;
-  sample long a_long;
-  sample float a_float;
-  sample double a_double;
-  sample string a_string;
-\end{verbatim}
-
-\subsection{The void type}
-
-There is a type, \verb+void+, which can be used to send
-a sample that contains no data. 
-
-\begin{verbatim}
-typedef void an_empty_type;
-
-sample an_empty_type no_data1;
-sample void no_data2;
-\end{verbatim}
-
-\verb+void+ type can may not be used as a field in a struct or
-the element type of an array.
-
-
-\subsection{Arrays}
-
-\begin{verbatim}
-  sample int fixed_array[3];
-  sample int variable_array[_];                // Note 1
-  sample int fixed_array_of_array[3][4];       // Note 2
-  sample int fixed_rectangular_array[3, 4];    // Note 2
-  sample int variable_array_of_array[_][_];    // Notes 1 & 2
-  sample int variable_rectangular_array[_, _]; // Notes 1 & 2
-\end{verbatim}
-
-\begin{enumerate}
-\item In contrast to C, LabComm supports both fixed and variable (denoted
-by~\verb+_+) sized arrays.
-
-\item In contrast to Java, LabComm supports multidimensional arrays and not
-only arrays of arrays.
-
-\end{enumerate}
-
-\subsection{Structures}
-
-\begin{verbatim}
-  sample struct {
-    int an_int_field;
-    double a_double_field;
-  } a_struct;
-\end{verbatim}
-
-\subsection{Sample type refereces}
-
-In addition to the primitive types, a sample may contain
-a reference to a sample type. References are declared using
-the \verb+sample+ keyword.
-
-Examples:
-
-\begin{verbatim}
-sample sample a_ref;
-
-sample sample ref_list[4];
-
-sample struct { 
-    sample ref1;
-    sample ref2;
-    int x;
-    int y;
-} refs_and_ints;
-\end{verbatim}
-
-Sample references are need to be registered on both encoder and decoder
-side, using the functions
-
-\begin{verbatim}
-int labcomm_decoder_sample_ref_register(
-    struct labcomm_decoder *decoder\nonumber
-    const struct labcomm_signature *signature);
-
-int labcomm_encoder_sample_ref_register(
-    struct labcomm_encoder *encoder\nonumber
-    const struct labcomm_signature *signature);
-\end{verbatim}
-
-The value of an unregistered sample reference will be decoded as \verb+null+.
-
-\subsection{User defined types}
-
-User defined types are declared with the \verb+typedef+ reserved word,
-and can then be used in type and sample declarations.
-
-\begin{verbatim}
-  typedef struct {
-    int field_1;
-    byte field_2;
-  } user_type[_];
-  sample user_type a_user_type_instance;
-  sample user_type another_user_type_instance;
-\end{verbatim}
-
-\section{The LabComm system}
-
-The LabComm system consists of a compiler for generating code from the data
-descriptions, and libraries providing LabComm communication facilities in,
-currently, C, Java, Python, C\#, and RAPID\footnote{excluding variable
-size samples, as RAPID has limited support for dynamic memory allocation}.
-
-
-\subsection{The LabComm compiler}
-
-The LabComm compiler generates code for the declared samples, including marshalling and
-demarshalling code, in the supported target languages.
-
-The compiler itself is implemented in Java using the JastAdd~\cite{jastadd} compiler compiler.
-
-\subsection{The LabComm library}
-
-The LabComm libraries contain functionality for the end-to-end transmission
-of samples. They are divided into two layers, where the upper layer implements
-the general encoding and decoding of samples, and the lower one deals with
-the transmission of the encoded byte stream on a particular transport layer.
-
-Thus, the LabComm communication stack looks like this:
-\begin{figure}[h!]
-\begin{verbatim}
-    _______________________
-    |     Application     |
-    +---------------------+
-    | encoder  | decoder  |    to/from labcomm encoded byte stream
-    +----------+----------+
-    | writer   | reader   |    transmit byte stream over particular transport
-    +----------+----------+
-    | transport layer / OS|
-    +---------------------+
-\end{verbatim}
-\end{figure}
-\subsubsection{LabComm actions}
-
-(similar to ioctl())
-The encoder/writer and decoder/reader interfaces consist of a set of actions
-
-One example of this is that there is a a separate writer action for
-transmitting signatures, allowing the writer to treat a signature differently
-from encoded samples, e.g., to allow handshaking during channel setup.
-
-User actions allow the application or a higher level
-protocol to communicate with the underlying transport layer through the LabComm
-encoder.
-
-One example is reliable communication, which is controlled from the application
-but needs to be implemented for each transport at at the reader/writer level.
-(Or not, e.g., TCP)
-
-\section{LabComm is not...}
-
-\begin{itemize}
-\item a protocol for two-way connections
-\item intrinsically supporting reliable communication
-\item providing semantic service-descriptions
-\end{itemize}
-
-But
-
-\begin{itemize}
-\item it is suitable for the individual channels of a structured connection
-\item the user action mechanism allows using feature of different transport layers
-  through labcomm (i.e., it allows encapsulation of the transport layer)
-\item the names of samples can be chosen and mapped according to a suitable taxonomy or ontology
-\end{itemize}
-
-
-
-\section{Example and its encoding}
-
-With the following `example.lc` file:
-
-\lstinputlisting[basicstyle=\footnotesize\ttfamily]{../examples/wiki_example/example.lc}
-and this \verb+example_encoder.c+ file
-\lstinputlisting[basicstyle=\footnotesize\ttfamily,language=C]{../examples/wiki_example/example_encoder.c}
-
-\newpage
-
-Running \verb+./example_encoder one two+, will yield the following result in example.encoded:
-\begin{verbatim}
-00000000  01 0c 0b 4c 61 62 43 6f  6d 6d 32 30 31 34 02 30 |...LabComm2014.0|
-00000010  40 0b 6c 6f 67 5f 6d 65  73 73 61 67 65 22 11 02 |@.log_message"..|
-00000020  08 73 65 71 75 65 6e 63  65 23 04 6c 69 6e 65 10 |.sequence#.line.|
-00000030  01 00 11 02 04 6c 61 73  74 20 04 64 61 74 61 27 |.....last .data'|
-00000040  02 08 41 04 64 61 74 61  01 25 40 04 00 00 00 01 |..A.data.%@.....|
-00000050  00 40 09 00 00 00 02 01  01 03 6f 6e 65 40 0e 00 |.@........one@..|
-00000060  00 00 03 02 00 03 6f 6e  65 01 03 74 77 6f 41 04 |......one..twoA.|
-00000070  00 00 00 00 41 04 3f 80  00 00 41 04 40 00 00 00 |....A.?...A.@...|
-00000080
-\end{verbatim}
-
-i.e.,
-\begin{verbatim}
-<version> <length: 12> <string: <len: 11> <"LabComm2014">>
-<sample_decl> <length: 48 
-              <user_id: 0x40> 
-              <string: <len: 11> <"log_message">
-  <signature_length: 34>
-  <struct_decl:
-    <number_of_fields: 2>
-    <string: <len: 8> <"sequence"> <type: <integer_type>>
-    <string: <len: 4> <"line">> <type: <array_decl
-      <number_indices: 1> <variable_index>
-      <type: <struct_decl:
-        <number_of_fields:2>
-        <string: <len: 4> <"last">> <type: <boolean_type>>
-        <string: <len: 4> <"data">> <type: <string_type>>
-      >>
-   >
->
-<sample_decl> <length: 8> <user_id: 0x41> <string: <len: 4> <"data">>
-  <signature_length: 1> <float_type>
-<sample_data> <user_id: 40> <length: 4>  <packed_sample_data>
-<sample_data> <user_id: 40> <length: 9>  <packed_sample_data>
-<sample_data> <user_id: 40> <length: 14>  <packed_sample_data>
-\end{verbatim}
-
-\section{Type and sample declarations}
-
-LabComm has two constructs for declaring sample types, \emph{sample
-declarations} and \emph{type declarations}. A sample declaration is used
-for the concrete sample types that may be transmitted, and is always
-encoded as a \emph{flattened} signature. That means that a sample
-containing user types, like
-
-\begin{verbatim}
-typedef struct {
-  int x;
-  int y;
-} point;
-
-sample struct {
-  point start;
-  point end;
-} line;
-\end{verbatim}
-
-is flattened to 
-
-\begin{verbatim}
-sample struct {
-  struct {
-    int x;
-    int y;
-  } start;
-  struct {
-    int x;
-    int y;
-  } end;
-} line;
-\end{verbatim}
-
-Sample declarations are always sent, and is the fundamental identity of
-a type in LabComm. 
-
-Type declarations is the hierarchical counterpart to sample
-declarations: here, fields of user types are encoded as a reference to
-the type instead of being flattened. As the flattened sample decl is the
-fundamental identity of a type, type declarations can be regarded as
-meta-data, describing the internal structure of a sample. They are
-intended to be read by higher-level software and human system developers
-and integrators.
-
-Sample declarations and type declarations have separate name-spaces in
-the sense that the numbers assigned to them by a labcomm encoder 
-come from two independent number series. To identify which
-\verb+TYPE_DECL+ a particular \verb+SAMPLE_DECL+ corresponds to, the
-\verb+TYPE_BINDING+ packet is used.
-
-For sample types that do not depend on any typedefs, no \verb+TYPE_DECL+
-is sent, and the \verb+TYPE_BINDING+ binds the sample id to the special
-value zero to indicate that the type definition is identical to the
-flattened signature.
-
-\subsection{Example}
-
-The labcomm declaration
-\lstinputlisting[basicstyle=\footnotesize\ttfamily]{../examples/user_types/test.lc}
-can be is encoded as
-\begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
-TYPE_DECL 0x40 "coord" <int> val
-TYPE_DECL 0x41 "point" <struct> <2 fields> 
-                                "x" <type: 0x40> 
-                                "y" <type: 0x40>
-TYPE_DECL 0x42 "line" <struct> <2 fields> 
-                                "start" <type: 0x41> 
-                                "end" <type: 0x41>
-TYPE_DECL 0x43 "foo" <struct> <3 fields> 
-                                "a" <int> 
-                                "b" <int> 
-                                "c" <boolean>
-TYPE_DECL 0x44 "twolines" <struct> <3 fields> 
-                                "l1" <type:0x42> 
-                                "l2" <type:0x42> 
-                                "f" <type:0x43>
-
-SAMPLE_DECL 0x40 "twolines" <flat signature>
-
-TYPE_BINDING 0x40 0x44
-\end{lstlisting}
-
-Note that the id 0x40 is used both for the \verb+TYPE_DECL+ of
-\verb+coord+ and the \verb+SAMPLE_DECL+ of \verb+twoline+, and that the
-\verb+TYPE_BINDING+ binds the sample id \verb+0x40+ to the type id
-\verb+0x44+.
-
-\subsection{Run-time behaviour}
-
-When a sample type is registered on an encoder, a \verb+SAMPLE_DECL+
-(i.e., the flat signature) is always generated on that encoder channel.
-
-If the sample depends on user types (i.e., typedefs), \verb+TYPE_DECL+
-packets are encoded, recursively, for the dependent types and a 
-corresponding \verb+TYPE_BINDING+ is encoded.
-
-If a \verb+TYPE_DECL+ is included via multiple sample types, or
-dependency paths, an encoder may choose to only encode it once, but is
-not required to do so. However, if multiple \verb+TYPE_DECL+ packets are
-sent for the same \verb+typedef+, the encoder must use the same
-\verb+type_id+.
-
-\subsection{Decoding in-band type descriptions}
-
-In LabComm, the in-band data descriptions are equivalent to \footnote{in
-the sense that they contain all information needed to recreate} the data
-description source (i.e., the ``.lc-file'').
-%
-As the type declarations (a.k.a. \emph{signatures}) are written before
-sample data on every channel, they can be used to interpret data with
-an unknown (by the receiver) format.
-
-The libraries provide functionality to subscribe to (i.e., register a
-\emph{handler} for) sample and type declarations.
-
-On the low level, the handler receives an instance of the signature
-data structure corresponding to the received declaration.
-
-
-For higher-level processing, the Java library provides the
-\verb+ASTbuilder+ class, which builds an abstract syntax tree in
-the internal representation of the LabComm compiler.
-That enables the user to use the complete functionality of the
-LabComm compiler, e.g. code generation,  on declarations received in a
-LabComm stream. 
-
-
-In combination with on-the-fly compilation and class-loading (or
-linking) that makes it possible to dynamically create handlers for
-previously unknown data types. Thereby, it enables dynamic configuration
-of LabComm endpoints in static languages without the overhead of
-interpreting signatures (at the one-time cost of code generation and
-compilation).
-
-
-
-
-
-
-
-\section{Ideas/Discussion}:
-
-The labcomm language is more expressive than its target languages regarding data types.
-E.g., labcomm can declare both arrays of arrays and matries where Java only has arrays of arrays
-In the generated Java code, a labcomm matrix is implemented as an array of arrays.
-
-Another case (not yet included) is unsigned types, which Java doesn't have. If we include
-unsigned long in labcomm, that has a larger range of values than is possible to express using
-Java primitive types. However, it is unlikely that the entire range is actually used, so one
-way of supporting the common cases is to include run-time checks for overflow in the Java encoders
-and decoders.
-
-\section{Related work}
-  
-Two in-band self-descibing communication protocols are Apache
-Avro\cite{avro} and EDN, the extensible data notation developed for
-Clojure and Datomic\cite{EDN}.
-
-EDN encodes \emph{values} as UTF-8 strings. The documentation says
-``edn is a system for the conveyance of values. It is not a type system,
-and has no schemas.'' That said, it is \emph{extensible} in the sense
-that it has a special \emph{dispatch charachter}, \verb+#+, which can  
-be used to add a \emph{tag} to a value. A tag indicates a semantic
-interpretation of a value, and that allows the reader to support
-handlers for specific tags, enabling functionality similar to that of
-labcomm.
-
-\subsection{Apache Avro}
-
-Apache Avro is similar to LabComm in that it has a textual language
-for declaring data, a binary protocol for transmitting data, and code
-generation for several languages.
-
-Avro is a larger system, including RPC \emph{protocols}, support for
-using different \emph{codecs} for data compression, and \emph{schema
-resolution} to support handling schema evolution and transparent 
-interoperability between different versions of a schema.
-
-\subsubsection*{Data types} 
-
-In the table, the Avro type names are listed, and matched to the
-corresponding LabComm type:
-
-\begin{tabular}{|l|c|c|}
-\hline
-  Type &            Labcomm  &               Avro \\
-  \hline Primitive types \\ \hline
-
-int    &         4 bytes     &           varint  \\
-long   &         8 bytes     &           varint  \\
-float  &         4 bytes     &           4 bytes \\
-long   &         8 bytes     &           8 bytes \\
-string &         varint + utf8[]   &     varint + utf8[] \\ 
-bytes  &         varint + byte[]   &     varint + byte[]\\
-
-  \hline Complex types  \\ \hline
-
-struct/record &  concat of fields     &  concat of fields \\ 
-arrays        &  varIdx[] : elements  &  block[]          \\
-map           &    n/a                &  block[]          \\
-union         &   n/a                 & (varint idx) : value \\
-fixed         &   byte[n]             &  the number of bytes declared in
-the schema\\
-\hline
-\end{tabular}
-
-  where 
-
-\begin{verbatim}  
-  block ::= (varint count) : elem[count]      [*1]
-  count == 0 --> no more blocks
-
-
-[*1] for arrays, count == 0 --> end of array
-     if count < 0, there are |count| elements
-     preceded by a varint block_size to allow
-     fast skipping
-\end{verbatim}  
-
-In maps, keys are strings, and values  according to the schema.
-
-In unions, the index indicates the kind of value and the
-value is encoded according to the schema.
-
-Note that the Avro data type \verb+bytes+ corresponds to the
-LabComm declaration \verb+byte[_]+, i.e. a varaible length byte array.
-
-\subsubsection*{the wire protocol}
-
-\begin{tabular}{|l|c|c|}
-  \hline
-  What & LabComm & Avro \\ \hline
-  Data description & Binary signature & JSON schema \\
-  Signature sent only once pre connection& posible & possible \\
-  Signature sent with each sample & possible & possible \\
-  Data encoding & binary & binary \\
-  \hline
-\end{tabular}
-
-
-Both avro and labcomm use varints when encoding data, similar in that
-they both send a sequence of bytes containing 7 bit chunks (with the
-eight bit signalling more chunks to come), but they differ in range,
-endianness and signedness.
-
-\begin{verbatim}
-                LabComm                 Avro
-                unsigned 32 bit         signed zig-zag coding
-                most significant chunk  least significant chunk
-                first                   first
-
-                0   ->  00               0  ->  00
-                1   ->  01              -1  ->  01
-                2   ->  02               1  ->  02
-                    ...                 -2  ->  03
-                                         2  ->  04
-                                            ...
-                127 ->  7f              -64 ->  7f
-                128 ->  81 00            64 ->  80 01
-                129 ->  81 01           -65 ->  81 01
-                130 ->  81 02            65 ->  82 01
-                    ...                     ...   
-\end{verbatim}
-
-\paragraph{Avro Object Container Files} can be seen as a counterpart
-  to a LabComm channel: 
-Avro includes a simple object container file format. A file has a
-schema, and all objects stored in the file must be written according to
-that schema, using binary encoding. Objects are stored in blocks that
-may be compressed. Syncronization markers are used between blocks to
-permit efficient splitting of files, and enable detection of 
-corrupt blocks.
-
-
-The major difference is the sync markers that LabComm does not have, as
-LabComm assumes that, while the transport may drop packets, there will
-be no bit errors in a received packet. If data integrity is required,
-that is delegated to the reader and writer for the particular transport.
-
-\subsubsection{Representation of hierarchical data types}
-
-For a type that contains fields of other user types, like
-\begin{verbatim}
-typedef struct {
-  int x;
-  int y;
-} Point;
-
-sample struct {
-  Point start;
-  Point end;
-} line;
-\end{verbatim}
-
-LabComm encodes both the flattened signature and the 
-typedef which allows the hierarchical type structure to be
-reconstructed.
-%
-The avro encoding is quite similar. 
-The \verb+Line+ example, corresponds to the two schemas
-\begin{verbatim}
-{"namespace": "example.avro",
- "type": "record",
- "name": "Point",
- "fields": [
-     {"name": "x", "type": "int"},
-     {"name": "y", "type": "int"}
- ]
-}
-\end{verbatim}
-and
-\begin{verbatim}
-{"namespace": "example.avro",
- "type": "record",
- "name": "Line",
- "fields": [
-     {"name": "start", "type": "Point"},
-     {"name": "end",   "type": "Point"}
- ]
-}
-\end{verbatim}
-which is encoded in an Object Container File as
-\begin{verbatim}
-{"type":"record",
- "name":"Line",
- "namespace":"example.avro",
- "fields":[{"name":"start",
-            "type":{"type":"record",
-                    "name":"Point",
-                    "fields":[{"name":"x","type":"int"},
-                              {"name":"y","type":"int"}]}},
-           {"name":"end",
-            "type":"Point"}
- ]
-}
-\end{verbatim}
-\subsubsection{Fetures not in LabComm} 
-
-Avro has a set of features with no counterpart in LabComm. They include
-
-\paragraph{Codecs.}
-
-Avro has multiple codecs (for compression of the data):
-
-    \begin{verbatim}
-    Required Codecs:
-    - null : The "null" codec simply passes through data uncompressed.
-
-    - deflate : The "deflate" codec writes the data block using the deflate
-                algorithm as specified in RFC 1951, and typically implemented using the
-                zlib library. Note that this format (unlike the "zlib format" in RFC
-                1950) does not have a checksum.
-
-    Optional Codecs
-
-    - snappy:   The "snappy" codec uses Google's Snappy compression library. Each
-                compressed block is followed by the 4-byte, big-endian CRC32 checksum of
-                the uncompressed data in the block.
-
-    \end{verbatim}
-
-  \paragraph{Schema Resolution.} The main objective of LabComm is to
-    ensure correct operation at run-time. Therefore, a LabComm decoder
-    requires the signatures for each handled sample to match exactly.
-
-    Avro, on the other hand, supports the evolution of schemas and
-    provides support for reading data where the ordering of fields
-    differ (but names and types are the same), numerical types differ
-    but can be
-    \emph{promoted} (E.g., \verb+int+ can be promoted to \verb+long+,
-    \verb+float+, or \verb+double+.), and record fields have been added
-    or removed (but are nullable or have default values).
-
-    \paragraph{Schema fingerprints.} Avro defines a \emph{Parsing
-    Canonical Form} to define when two JSON schemas are ``the same''.
-    To reduce the overhead when, e.g., tagging data with the schema
-    there is support for creating a \emph{fingerprint} using 64/128/256
-    bit hashing, in combination with a centralized repository for
-    fingerprint/schema pairs.
-
-\bibliography{refs}{}
-\bibliographystyle{plain}
-
-\appendix
-\newpage
-
-\section{The LabComm language}
-\label{sec:LanguageGrammar}
-
-\subsection{Abstract syntax}
-\begin{verbatim}
-Program ::= Decl*;
-
-abstract Decl ::= Type <Name:String>;
-TypeDecl : Decl;
-SampleDecl : Decl;
-
-Field ::= Type <Name:String>;
-
-abstract Type;
-VoidType          : Type;
-SampleRefType     : Type;
-PrimType          : Type ::= <Name:String> <Token:int>;
-UserType          : Type ::= <Name:String>;
-StructType        : Type ::= Field*;
-ParseArrayType    : Type ::= Type Dim*;
-abstract ArrayType : Type ::= Type Exp*;
-VariableArrayType : ArrayType;
-FixedArrayType    : ArrayType;
-
-Dim ::= Exp*;
-
-abstract Exp;
-IntegerLiteral : Exp ::= <Value:String>;
-VariableSize : Exp;
-\end{verbatim}
-
-\newpage
-\section{The LabComm protocol}
-\label{sec:ProtocolGrammar}
-
-Each LabComm2014 packet has the layout
-\begin{verbatim}
-<id> <length> <data...>
-\end{verbatim}
-where \verb+length+ is the number of bytes of the \verb+data+ part
-(i.e., excluding the \verb+id+ and \verb+length+ fields), and 
-the \verb+id+ gives the layout of the \verb+data+ part as defined 
-in \ref{sec:ConcreteGrammar}
-\subsection{Data encoding}
-LabComm primitive types are encoded as fixed width values, sent in
-network order.  Type fields, user IDs, number of indices and lengths are
-sent in a variable length (\emph{varint}) form.  A varint integer value
-is sent as a sequence of bytes where the lower seven bits contain a
-chunk of the actual number and the high bit indicates if more chunks
-follow. The sequence of chunks are sent with the least significant chunk
-first.  
-
-The built-in data types are encoded as follows:
-\begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
-||Type       ||Encoding/Size                                      ||
-||-----------||---------------------------------------------------||
-||boolean    ||  8 bits                                           ||
-||byte       ||  8 bits                                           ||
-||short      || 16 bits                                           ||
-||integer    || 32 bits                                           ||
-||long       || 64 bits                                           ||
-||float      || 32 bits                                           ||
-||double     || 64 bits                                           ||
-||sample_ref || 32 bits                                           ||
-||string     || length (varint), followed by UTF8 encoded string  ||
-||array      || each variable index (varint),                     ||
-||           || followed by encoded elements                      ||
-||struct     || concatenation of encoding of each element         ||
-||           || in declaration order                              ||
-\end{lstlisting}
-\pagebreak
-\subsection{Protocol grammar}
-\label{sec:ConcreteGrammar}
-\begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
-<packet>          := <id> <length> ( <version>      | 
-                                     <type_decl>    | 
-                                     <sample_decl>  |
-                                     <sample_ref>   |
-                                     <type_binding> |
-                                     <sample_data> )
-<version>         := <string>
-<sample_decl>     := <sample_id> <string> <type>
-<sample_ref>      := <sample_id> <string> <type>
-<type_decl>       := <type_id> <string> <type>
-<type_binding>    := <sample_id> <type_id>
-<user_id>         := 0x40..0xffffffff  
-<sample_id> : <user_id>
-<type_id>   : <user_id>
-<string>          := <string_length> <char>*
-<string_length>   := 0x00..0xffffffff  
-<char>            := any UTF-8 char
-<type>            := <length> ( <basic_type>  | 
-                                <array_decl>  | 
-                                <struct_decl> | 
-                                <type_id> )
-<basic_type>      := ( <void_type> | <boolean_type> | <byte_type> | <short_type> |
-                     <integer_type> | <long_type> | <float_type> |
-                     <double_type> | <string_type> | <sample_ref_type>)
-
-<void_type>       := <struct_decl> 0 //void is encoded as empty struct
-<boolean_type>    := 0x20 
-<byte_type>       := 0x21 
-<short_type>      := 0x22 
-<integer_type>    := 0x23 
-<long_type>       := 0x24 
-<float_type>      := 0x25 
-<double_type>     := 0x26 
-<string_type>     := 0x27 
-<sample_ref_type> := 0x28 
-<array_decl>      := 0x10  <nbr_of_indices> <indices> <type>
-<nbr_of_indices>  := 0x00..0xffffffff  
-<indices>         := ( <variable_index> | <fixed_index> )*
-<variable_index>  := 0x00  
-<fixed_index>     := 0x01..0xffffffff  
-<struct_decl>     := 0x11  <nbr_of_fields> <field>*
-<nbr_of_fields>   := 0x00..0xffffffff  
-<field>           := <string> <type>
-<sample_data>     := packed sample data sent in network order, with
-                  primitive type elements encoded according to
-                  the sizes above
-\end{lstlisting}
-where the \verb+<id>+ in \verb+<packet>+ signals the type of payload,
-and may be either a \verb+<sample_id>+ or a system packet id.
-The labcomm sytem packet ids are:
-\begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
-version:      0x01 
-sample_decl:  0x02 
-sample_ref:   0x03 
-type_decl:    0x04 
-type_binding: 0x05          
-\end{lstlisting}
-Note that since the signature transmitted in a \verb+<sample_def>+ is
-flattened, the \verb+<type>+ transmitted in a \verb+<sample_def>+ may
-not contain any \verb+<type_id>+ fields.
-\end{document}
diff --git a/examples/Makefile b/examples/Makefile
index fc39c55448fc0246f0ddbba0c05e24c7bc2e0b1d..03e8204b887c6f7d6da9aa3df11678d0bbd9665b 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -15,9 +15,9 @@ test:
 ifeq ($(UNAME_S),Darwin)
 	$(MAKE) -C user_types all 
 else	
-	cd simple ; sh compile.sh && sh run.sh
-	$(MAKE) -C  wiki_example test
-	$(MAKE) -C user_types test 
+        # FIXME: cd simple ; sh compile.sh && sh run.sh
+        # FIXME: $(MAKE) -C  wiki_example test
+        # FIXME: $(MAKE) -C user_types test 
 endif	
 	$(MAKE) -C duck_typing test
 	$(MAKE) -C twoway test 
diff --git a/examples/duck_typing/Makefile b/examples/duck_typing/Makefile
index 2587040229b3665c25660c4e0d3995e0071bb864..9cb6cb346afb3e8ae9d278c6ca81e21e7f4ed53b 100644
--- a/examples/duck_typing/Makefile
+++ b/examples/duck_typing/Makefile
@@ -1,4 +1,4 @@
-LABCOMM_JAR=../../compiler/labcomm_compiler.jar
+LABCOMM_JAR=../../compiler/labcomm2006_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR) 
 
 all: gen/animal.py
diff --git a/examples/dynamic/dynamic.sh b/examples/dynamic/dynamic.sh
index 8700a19b401df66f4c7ec12f009335eee73c8ecc..93afbb9b72b723923573bc64969678d7db3e90b2 100644
--- a/examples/dynamic/dynamic.sh
+++ b/examples/dynamic/dynamic.sh
@@ -1,6 +1,6 @@
 #dummy script to test the on-the-fly compilation
 
-java -jar ../../compiler/labcomm_compiler.jar --java=gen --javapackage=gen simple.lc
+java -jar ../../compiler/labcomm2006_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_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 -cp .:../../compiler/labcomm2006_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_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
+java -cp .:../../compiler/labcomm2006_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 
diff --git a/examples/dynamic/static.sh b/examples/dynamic/static.sh
index 361e5fe4f4f0694c5c0fdda15c87934ace1850db..f9a496d6ba9b4b3016d25f62151c3bb8d45d8586 100644
--- a/examples/dynamic/static.sh
+++ b/examples/dynamic/static.sh
@@ -2,7 +2,7 @@
 
 # run labcomm compilation
 
-java -jar ../../compiler/labcomm_compiler.jar --java=gen --javapackage=gen simple.lc
+java -jar ../../compiler/labcomm2006_compiler.jar --java=gen --javapackage=gen simple.lc
 
 # compile example programs
 javac -cp .:gen:../../lib/java/labcomm.jar test/StaticEncoder.java
diff --git a/examples/dynamic/test.sh b/examples/dynamic/test.sh
index f98bc3717fad2955c68bba46958745d7deb529e8..54c835d2a846ff398f8066cc3f28caaa23203800 100644
--- a/examples/dynamic/test.sh
+++ b/examples/dynamic/test.sh
@@ -1,7 +1,7 @@
 #dummy script to test the on-the-fly compilation
 
-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 -cp .:../../compiler/labcomm2006_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_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
+java -cp .:../../compiler/labcomm2006_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
diff --git a/examples/dynamic/test_type.sh b/examples/dynamic/test_type.sh
index 99b60eadc23732a9a0d59ea0ed80965ad6d36cab..36a27d159e585f9b26ad0e0b3a4d198301303abd 100644
--- a/examples/dynamic/test_type.sh
+++ b/examples/dynamic/test_type.sh
@@ -1,7 +1,7 @@
 #dummy script to test the on-the-fly compilation
 
-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 -cp .:../../compiler/labcomm2006_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_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
+java -cp .:../../compiler/labcomm2006_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
diff --git a/examples/jgrafchart/Makefile b/examples/jgrafchart/Makefile
index 38da6a22cd3c2bff9a9534f3372d64fe3878ed74..16d573f458b19b801a414a35da693de92ded947a 100644
--- a/examples/jgrafchart/Makefile
+++ b/examples/jgrafchart/Makefile
@@ -1,5 +1,5 @@
 LCDIR=../..
-LABCOMM_JAR=../../compiler/labcomm_compiler.jar
+LABCOMM_JAR=../../compiler/labcomm2006_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR) 
 CLASSPATH=.:${LCDIR}/lib/java/labcomm.jar
 JAVA_PKG=labcommTCPtest
diff --git a/examples/simple/compile.sh b/examples/simple/compile.sh
index 91c3b76ae00d1b6e609324c358d0f71cc1a7fa01..9691c34b1ef56e4c499281093bfff750226e1109 100644
--- a/examples/simple/compile.sh
+++ b/examples/simple/compile.sh
@@ -8,7 +8,7 @@ set -e
 (cd ../..; make all)
 
 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 
+java -jar ../../compiler/labcomm2006_compiler.jar --java=gen --c=gen/simple.c --h=gen/simple.h  --python=gen/simple.py simple.lc 
 
 javac -cp ../../lib/java/labcomm2014.jar:. gen/*.java Encoder.java Decoder.java
 
@@ -23,7 +23,7 @@ gcc -Wall -Werror -I . -I ../../lib/c/2014 -L../../lib/c \
 # For version 2006
 
 mkdir -p gen06
-java -jar ../../compiler/labcomm_compiler.jar --ver=2006 --java=gen06 --c=gen06/simple.c --h=gen06/simple.h  --python=gen06/simple.py simple.lc 
+java -jar ../../compiler/labcomm2006_compiler.jar --ver=2006 --java=gen06 --c=gen06/simple.c --h=gen06/simple.h  --python=gen06/simple.py simple.lc 
 
 javac -cp ../../lib/java/labcomm2006.jar:. gen06/*.java Encoder06.java Decoder06.java
 
diff --git a/examples/tcp/Makefile b/examples/tcp/Makefile
index ae9a5c4ce042a9cf5ae864853de95f8d540b4d95..5c0faa4164fa938d49b2d325288251b9472a169f 100644
--- a/examples/tcp/Makefile
+++ b/examples/tcp/Makefile
@@ -1,5 +1,5 @@
 LCDIR=../..
-LABCOMM_JAR=../../compiler/labcomm_compiler.jar
+LABCOMM_JAR=../../compiler/labcomm2006_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR)
 LCLJAR=${LCDIR}/lib/java/labcomm.jar  # the LabComm library
 JAVA_PKG=labcommTCPtest
diff --git a/examples/twoway/Makefile b/examples/twoway/Makefile
index cad00edf8d3fe6c734e0ef32de3ffe003abdc37e..f378db4599db3e4621140b2d10a1821da3c054e1 100644
--- a/examples/twoway/Makefile
+++ b/examples/twoway/Makefile
@@ -1,10 +1,10 @@
 UNAME_S=$(shell uname -s)
 
 TARGETS=client server
-LABCOMM_JAR=../../compiler/labcomm_compiler.jar
+LABCOMM_JAR=../../compiler/labcomm2006_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR) 
 
-CFLAGS=-O3 -g -Wall -Werror -I../../lib/c/2014 -I. -Wno-unused-function
+CFLAGS=-O3 -g -Wall -Werror -I../../lib/c/2006 -I. -Wno-unused-function
 
 ifeq ($(UNAME_S),Darwin)
     CFLAGS+=-DLABCOMM_COMPAT=\"labcomm_compat_osx.h\" -DLABCOMM_OS_DARWIN=1  -Wno-tautological-compare
@@ -32,11 +32,11 @@ gen/%.c gen/%.h: %.lc | gen/.dir
 
 gen/client: client.c 
 	$(CC) -o $@ $(CFLAGS) $^ -lpthread \
-		-L../../lib/c -llabcomm2014
+		-L../../lib/c -llabcomm2006
 
 gen/server: server.c 
 	$(CC) -o $@ $(CFLAGS) $^ -lpthread \
-		-L../../lib/c -llabcomm2014 
+		-L../../lib/c -llabcomm2006 
 
 .PHONY: clean distclean
 clean distclean:
diff --git a/examples/twoway/client.c b/examples/twoway/client.c
index f0e54472a442bfd8fb8339783e85994e930fdbf6..2d8af44769dfc250bd04421d3ec2199980864f5d 100644
--- a/examples/twoway/client.c
+++ b/examples/twoway/client.c
@@ -36,12 +36,12 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <labcomm2014.h>
-#include <labcomm2014_fd_reader.h>
-#include <labcomm2014_fd_writer.h>
-#include <labcomm2014_default_error_handler.h>
-#include <labcomm2014_default_memory.h>
-#include <labcomm2014_pthread_scheduler.h>
+#include <labcomm2006.h>
+#include <labcomm2006_fd_reader.h>
+#include <labcomm2006_fd_writer.h>
+#include <labcomm2006_default_error_handler.h>
+#include <labcomm2006_default_memory.h>
+#include <labcomm2006_pthread_scheduler.h>
 #include "decimating.h"
 #include "introspecting.h"
 #include "gen/types.h"
@@ -63,13 +63,13 @@ static void handle_Product(int32_t *value, void *context)
 
 static void *run_decoder(void *context)
 {
-  struct labcomm2014_decoder *decoder = context;
+  struct labcomm2006_decoder *decoder = context;
   int result;
 
-  labcomm2014_decoder_register_types_Sum(decoder, handle_Sum, NULL);
-  labcomm2014_decoder_register_types_Diff(decoder, handle_Diff, NULL);
+  labcomm2006_decoder_register_types_Sum(decoder, handle_Sum, NULL);
+  labcomm2006_decoder_register_types_Diff(decoder, handle_Diff, NULL);
   do {
-    result = labcomm2014_decoder_decode_one(decoder);
+    result = labcomm2006_decoder_decode_one(decoder);
   } while (result >= 0);
   return NULL;
 }
@@ -87,10 +87,10 @@ int main(int argc, char *argv[])
   struct introspecting *introspecting;
   char *hostname;
   int port;
-  struct labcomm2014_scheduler *scheduler;
-  struct labcomm2014_decoder *decoder;
-  struct labcomm2014_encoder *encoder;
-  struct labcomm2014_time *next;
+  struct labcomm2006_scheduler *scheduler;
+  struct labcomm2006_decoder *decoder;
+  struct labcomm2006_encoder *encoder;
+  struct labcomm2006_time *next;
   int32_t i, j;
 
   hostname = argv[1];
@@ -128,13 +128,13 @@ int main(int argc, char *argv[])
   
   nodelay = 1;
   setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay));
-  scheduler = labcomm2014_pthread_scheduler_new(labcomm2014_default_memory);
-  decimating = decimating_new(labcomm2014_fd_reader_new(labcomm2014_default_memory, 
+  scheduler = labcomm2006_pthread_scheduler_new(labcomm2006_default_memory);
+  decimating = decimating_new(labcomm2006_fd_reader_new(labcomm2006_default_memory, 
 						    fd, 1),
-			      labcomm2014_fd_writer_new(labcomm2014_default_memory, 
+			      labcomm2006_fd_writer_new(labcomm2006_default_memory, 
 						    fd, 0),
-			      labcomm2014_default_error_handler,
-			      labcomm2014_default_memory,
+			      labcomm2006_default_error_handler,
+			      labcomm2006_default_memory,
 			      scheduler);
   if (decimating == NULL) {
     /* Warning: might leak reader and writer at this point */
@@ -142,45 +142,45 @@ int main(int argc, char *argv[])
   }
   introspecting = introspecting_new(decimating->reader,
 				    decimating->writer,
-				    labcomm2014_default_error_handler,
-				    labcomm2014_default_memory,
+				    labcomm2006_default_error_handler,
+				    labcomm2006_default_memory,
 				    scheduler);
   if (introspecting == NULL) {
     /* Warning: might leak reader and writer at this point */
     goto out;
   }
-  decoder = labcomm2014_decoder_new(introspecting->reader, 
-				labcomm2014_default_error_handler,
-				labcomm2014_default_memory,
+  decoder = labcomm2006_decoder_new(introspecting->reader, 
+				labcomm2006_default_error_handler,
+				labcomm2006_default_memory,
 				scheduler);
-  encoder = labcomm2014_encoder_new(introspecting->writer, 
-				labcomm2014_default_error_handler,
-				labcomm2014_default_memory,
+  encoder = labcomm2006_encoder_new(introspecting->writer, 
+				labcomm2006_default_error_handler,
+				labcomm2006_default_memory,
 				scheduler);
   pthread_t rdt;
   pthread_create(&rdt, NULL, run_decoder, decoder);  
-  labcomm2014_encoder_register_types_A(encoder);
-  labcomm2014_encoder_register_types_B(encoder);
-  labcomm2014_encoder_register_types_Terminate(encoder);
+  labcomm2006_encoder_register_types_A(encoder);
+  labcomm2006_encoder_register_types_B(encoder);
+  labcomm2006_encoder_register_types_Terminate(encoder);
 
-  err = labcomm2014_decoder_ioctl_types_Sum(decoder, SET_DECIMATION, 2);
-  err = labcomm2014_decoder_ioctl_types_Diff(decoder, SET_DECIMATION, 4);
+  err = labcomm2006_decoder_ioctl_types_Sum(decoder, SET_DECIMATION, 2);
+  err = labcomm2006_decoder_ioctl_types_Diff(decoder, SET_DECIMATION, 4);
 
-  next = labcomm2014_scheduler_now(scheduler);
+  next = labcomm2006_scheduler_now(scheduler);
   for (i = 0 ; i < 4 ; i++) {
     if (i == 2) {
-      labcomm2014_decoder_register_types_Product(decoder, handle_Product, NULL);
+      labcomm2006_decoder_register_types_Product(decoder, handle_Product, NULL);
     }
     for (j = 0 ; j < 4 ; j++) {
       printf("\nA=%d B=%d: ", i, j);
-      labcomm2014_encode_types_A(encoder, &i);
-      labcomm2014_encode_types_B(encoder, &j);
-      labcomm2014_time_add_usec(next, 100000);
-      labcomm2014_scheduler_sleep(scheduler, next);
+      labcomm2006_encode_types_A(encoder, &i);
+      labcomm2006_encode_types_B(encoder, &j);
+      labcomm2006_time_add_usec(next, 100000);
+      labcomm2006_scheduler_sleep(scheduler, next);
     }
   }
   printf("\n");
-  labcomm2014_encode_types_Terminate(encoder);
+  labcomm2006_encode_types_Terminate(encoder);
 out:
   return 0;
   
diff --git a/examples/twoway/decimating.c b/examples/twoway/decimating.c
index 705f4cec837bdd8aeeb4585881f8bd19ec09449a..fb730549142cd13c033da712f3890cb5b3672354 100644
--- a/examples/twoway/decimating.c
+++ b/examples/twoway/decimating.c
@@ -23,18 +23,18 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "labcomm2014_private.h"
+#include "labcomm2006_private.h"
 #include "decimating.h"
 #include "gen/decimating_messages.h"
 
 struct decimating_private {
   struct decimating decimating;
-  struct labcomm2014_error_handler *error;
-  struct labcomm2014_memory *memory;
-  struct labcomm2014_scheduler *scheduler;
+  struct labcomm2006_error_handler *error;
+  struct labcomm2006_memory *memory;
+  struct labcomm2006_scheduler *scheduler;
   int encoder_initialized;
-  struct labcomm2014_reader_action_context reader_action_context;
-  struct labcomm2014_writer_action_context writer_action_context;
+  struct labcomm2006_reader_action_context reader_action_context;
+  struct labcomm2006_writer_action_context writer_action_context;
   LABCOMM_SIGNATURE_ARRAY_DEF(writer_decimation, 
 			      struct decimation {
 				int n;
@@ -50,25 +50,25 @@ static void set_decimation(
   struct decimating_private *decimating = context;
   struct decimation *decimation;
 
-  labcomm2014_scheduler_data_lock(decimating->scheduler);
+  labcomm2006_scheduler_data_lock(decimating->scheduler);
   decimation = LABCOMM_SIGNATURE_ARRAY_REF(decimating->memory,
 					   decimating->writer_decimation, 
 					   struct decimation, 
 					   value->signature_index);
   decimation->n = value->decimation;
   decimation->current = 0;
-  labcomm2014_scheduler_data_unlock(decimating->scheduler);
+  labcomm2006_scheduler_data_unlock(decimating->scheduler);
 }
 
 static int wrap_reader_alloc(
-  struct labcomm2014_reader *r, 
-  struct labcomm2014_reader_action_context *action_context)
+  struct labcomm2006_reader *r, 
+  struct labcomm2006_reader_action_context *action_context)
 {
   struct decimating_private *decimating = action_context->context;
   
-  labcomm2014_decoder_register_decimating_messages_set_decimation(
+  labcomm2006_decoder_register_decimating_messages_set_decimation(
     r->decoder, set_decimation, decimating);
-  return labcomm2014_reader_alloc(r, action_context->next);
+  return labcomm2006_reader_alloc(r, action_context->next);
 }
 
 struct send_set_decimation {
@@ -80,11 +80,11 @@ struct send_set_decimation {
 static void send_set_decimation(void *arg)
 {
   struct send_set_decimation *msg = arg;
-  struct labcomm2014_memory *memory = msg->decimating->memory;
+  struct labcomm2006_memory *memory = msg->decimating->memory;
 
-  labcomm2014_encode_decimating_messages_set_decimation(
+  labcomm2006_encode_decimating_messages_set_decimation(
     msg->decimating->decimating.writer->encoder, &msg->set_decimation);
-  labcomm2014_memory_free(memory, 1, msg);
+  labcomm2006_memory_free(memory, 1, msg);
 }
 
 static void enqueue_decimation(struct decimating_private *decimating,
@@ -92,21 +92,21 @@ static void enqueue_decimation(struct decimating_private *decimating,
 			       int amount) 
 {
   struct send_set_decimation *msg;
-  msg = labcomm2014_memory_alloc(decimating->memory, 1, sizeof(*msg));
+  msg = labcomm2006_memory_alloc(decimating->memory, 1, sizeof(*msg));
   if (msg) {
     msg->decimating = decimating;
     msg->set_decimation.decimation = amount;
     msg->set_decimation.signature_index = remote_index;
     
-    labcomm2014_scheduler_enqueue(decimating->scheduler, 0, 
+    labcomm2006_scheduler_enqueue(decimating->scheduler, 0, 
 			      send_set_decimation, msg);
   }
 }
 
 static int wrap_reader_start(
-  struct labcomm2014_reader *r, 
-  struct labcomm2014_reader_action_context *action_context,
-  int local_index, int remote_index, const struct labcomm2014_signature *signature,
+  struct labcomm2006_reader *r, 
+  struct labcomm2006_reader_action_context *action_context,
+  int local_index, int remote_index, const struct labcomm2006_signature *signature,
   void *value)
 {
   struct decimating_private *decimating = action_context->context;
@@ -114,26 +114,26 @@ static int wrap_reader_start(
   if (value == NULL) {
     int *decimation, amount;
     
-    labcomm2014_scheduler_data_lock(decimating->scheduler);
+    labcomm2006_scheduler_data_lock(decimating->scheduler);
     decimation = LABCOMM_SIGNATURE_ARRAY_REF(decimating->memory,
 					     decimating->reader_decimation, 
 					     int,
 					     local_index);
     amount = *decimation;
-    labcomm2014_scheduler_data_unlock(decimating->scheduler);
+    labcomm2006_scheduler_data_unlock(decimating->scheduler);
     if (remote_index != 0 && amount != 0) {
       enqueue_decimation(decimating, remote_index, amount);
     }
   }
-  return labcomm2014_reader_start(r, action_context->next, 
+  return labcomm2006_reader_start(r, action_context->next, 
                               local_index, remote_index, signature, value);
 }
 
 static int wrap_reader_ioctl(
-  struct labcomm2014_reader *r,   
-  struct labcomm2014_reader_action_context *action_context,
+  struct labcomm2006_reader *r,   
+  struct labcomm2006_reader_action_context *action_context,
   int local_index, int remote_index,
-  const struct labcomm2014_signature *signature, 
+  const struct labcomm2006_signature *signature, 
   uint32_t action, va_list args)
 {
   struct decimating_private *decimating = action_context->context;
@@ -147,26 +147,26 @@ static int wrap_reader_ioctl(
     amount = va_arg(va, int);
     va_end(va);
    
-    labcomm2014_scheduler_data_lock(decimating->scheduler);
+    labcomm2006_scheduler_data_lock(decimating->scheduler);
     decimation = LABCOMM_SIGNATURE_ARRAY_REF(decimating->memory,
 					     decimating->reader_decimation, 
 					     int,
 					     local_index);
     *decimation = amount;
-    labcomm2014_scheduler_data_unlock(decimating->scheduler);
+    labcomm2006_scheduler_data_unlock(decimating->scheduler);
     if (remote_index) {
       enqueue_decimation(decimating, remote_index, amount);
     }
     
   } else {
-    return labcomm2014_reader_ioctl(r, action_context->next,
+    return labcomm2006_reader_ioctl(r, action_context->next,
 				local_index, remote_index, signature, 
 				action, args);
   }
   return 0;
 }
 
-struct labcomm2014_reader_action decimating_reader_action = {
+struct labcomm2006_reader_action decimating_reader_action = {
   .alloc = wrap_reader_alloc,
   .free = NULL,
   .start = wrap_reader_start,
@@ -179,25 +179,25 @@ static void register_signatures(void *context)
 {
   struct decimating_private *decimating = context;
 
-  labcomm2014_encoder_register_decimating_messages_set_decimation(
+  labcomm2006_encoder_register_decimating_messages_set_decimation(
     decimating->decimating.writer->encoder);
 }
 
 static int wrap_writer_alloc(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context)
+  struct labcomm2006_writer *w, 
+  struct labcomm2006_writer_action_context *action_context)
 {
   struct decimating_private *decimating = action_context->context;
 
-  labcomm2014_scheduler_enqueue(decimating->scheduler, 
+  labcomm2006_scheduler_enqueue(decimating->scheduler, 
 			    0, register_signatures, decimating);
-  return labcomm2014_writer_alloc(w, action_context->next);
+  return labcomm2006_writer_alloc(w, action_context->next);
 }
 
 static int wrap_writer_start(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context, 
-  int index, const struct labcomm2014_signature *signature,
+  struct labcomm2006_writer *w, 
+  struct labcomm2006_writer_action_context *action_context, 
+  int index, const struct labcomm2006_signature *signature,
   void *value)
 {
   struct decimating_private *decimating = action_context->context;
@@ -207,7 +207,7 @@ static int wrap_writer_start(
   if (index < LABCOMM_USER) {
     result = 0;
   } else {
-    labcomm2014_scheduler_data_lock(decimating->scheduler);
+    labcomm2006_scheduler_data_lock(decimating->scheduler);
     decimation = LABCOMM_SIGNATURE_ARRAY_REF(decimating->memory, 
                                              decimating->writer_decimation, 
                                              struct decimation, index);
@@ -218,16 +218,16 @@ static int wrap_writer_start(
       decimation->current = 0;
       result = 0;
     }
-    labcomm2014_scheduler_data_unlock(decimating->scheduler);
+    labcomm2006_scheduler_data_unlock(decimating->scheduler);
   }
   if (result == 0) {
-    result = labcomm2014_writer_start(w, action_context->next,
+    result = labcomm2006_writer_start(w, action_context->next,
 				 index, signature, value);
   }
   return result;
 }
 
-struct labcomm2014_writer_action decimating_writer_action = {
+struct labcomm2006_writer_action decimating_writer_action = {
   .alloc = wrap_writer_alloc,
   .free = NULL, 
   .start = wrap_writer_start,
@@ -237,11 +237,11 @@ struct labcomm2014_writer_action decimating_writer_action = {
 };
 
 struct decimating *decimating_new(
-  struct labcomm2014_reader *reader,
-  struct labcomm2014_writer *writer,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler)
+  struct labcomm2006_reader *reader,
+  struct labcomm2006_writer *writer,
+  struct labcomm2006_error_handler *error,
+  struct labcomm2006_memory *memory,
+  struct labcomm2006_scheduler *scheduler)
 {
   struct decimating_private *result;
 
diff --git a/examples/twoway/decimating.h b/examples/twoway/decimating.h
index 3d91c675e036c0548f0121f88db35aca2891f1b8..c4e5fb3a50002f7c4b2f6138366b1a9221d60a1d 100644
--- a/examples/twoway/decimating.h
+++ b/examples/twoway/decimating.h
@@ -1,20 +1,20 @@
 #ifndef __DECIMATING_H__
 #define __DECIMATING_H__
 
-#include <labcomm2014.h>
-#include <labcomm2014_ioctl.h>
+#include <labcomm2006.h>
+#include <labcomm2006_ioctl.h>
 
 struct decimating {
-  struct labcomm2014_reader *reader;
-  struct labcomm2014_writer *writer;
+  struct labcomm2006_reader *reader;
+  struct labcomm2006_writer *writer;
 };
 
 extern struct decimating *decimating_new(
-  struct labcomm2014_reader *reader,
-  struct labcomm2014_writer *writer,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler);
+  struct labcomm2006_reader *reader,
+  struct labcomm2006_writer *writer,
+  struct labcomm2006_error_handler *error,
+  struct labcomm2006_memory *memory,
+  struct labcomm2006_scheduler *scheduler);
 
 #define SET_DECIMATION LABCOMM_IOSW('d',0,int)
 
diff --git a/examples/twoway/introspecting.c b/examples/twoway/introspecting.c
index 87bffeb4f6b4a6c7dc6eb135e1a8245e95c700f4..ee1a874d4375ec4ca987e6bb99701dc643453954 100644
--- a/examples/twoway/introspecting.c
+++ b/examples/twoway/introspecting.c
@@ -23,18 +23,18 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "labcomm2014_private.h"
+#include "labcomm2006_private.h"
 #include "introspecting.h"
 #include "gen/introspecting_messages.h"
 
 struct introspecting_private {
   struct introspecting introspecting;
-  struct labcomm2014_error_handler *error;
-  struct labcomm2014_memory *memory;
-  struct labcomm2014_scheduler *scheduler;
+  struct labcomm2006_error_handler *error;
+  struct labcomm2006_memory *memory;
+  struct labcomm2006_scheduler *scheduler;
 
-  struct labcomm2014_reader_action_context reader_action_context;
-  struct labcomm2014_writer_action_context writer_action_context;
+  struct labcomm2006_reader_action_context reader_action_context;
+  struct labcomm2006_writer_action_context writer_action_context;
   LABCOMM_SIGNATURE_ARRAY_DEF(remote, 
 			      struct remote {
 				char *name;
@@ -44,13 +44,13 @@ struct introspecting_private {
   LABCOMM_SIGNATURE_ARRAY_DEF(local, 
 			      struct local {
 				enum introspecting_status status;
-				const struct labcomm2014_signature *signature;
+				const struct labcomm2006_signature *signature;
 			      });
 };
 
 static struct local *get_local(struct introspecting_private *introspecting,
 			       int index,
-			       const struct labcomm2014_signature *signature)
+			       const struct labcomm2006_signature *signature)
 {
   /* Called with data_lock held */
   struct local *local;
@@ -91,7 +91,7 @@ static void handles_signature(
   struct introspecting_private *introspecting = context;
   struct remote *remote;
 
-  labcomm2014_scheduler_data_lock(introspecting->scheduler);
+  labcomm2006_scheduler_data_lock(introspecting->scheduler);
   remote = LABCOMM_SIGNATURE_ARRAY_REF(introspecting->memory,
 				       introspecting->remote, 
 				       struct remote, 
@@ -119,25 +119,25 @@ static void handles_signature(
       }
     }
   }
-  labcomm2014_scheduler_data_unlock(introspecting->scheduler);
+  labcomm2006_scheduler_data_unlock(introspecting->scheduler);
 }
 
 static int wrap_reader_alloc(
-  struct labcomm2014_reader *r, 
-  struct labcomm2014_reader_action_context *action_context)
+  struct labcomm2006_reader *r, 
+  struct labcomm2006_reader_action_context *action_context)
 {
   struct introspecting_private *introspecting = action_context->context;
 
-  labcomm2014_decoder_register_introspecting_messages_handles_signature(
+  labcomm2006_decoder_register_introspecting_messages_handles_signature(
     introspecting->introspecting.reader->decoder, 
     handles_signature, introspecting);
-  return labcomm2014_reader_alloc(r, action_context->next);
+  return labcomm2006_reader_alloc(r, action_context->next);
 }
 
 struct handles_signature {
   struct introspecting_private *introspecting;
   int index;
-  const struct labcomm2014_signature *signature;
+  const struct labcomm2006_signature *signature;
 };
 
 static void send_handles_signature(void *arg)
@@ -149,14 +149,14 @@ static void send_handles_signature(void *arg)
   handles_signature.name = h->signature->name;
   handles_signature.signature.n_0 = h->signature->size;
   handles_signature.signature.a = h->signature->signature;
-  labcomm2014_encode_introspecting_messages_handles_signature(
+  labcomm2006_encode_introspecting_messages_handles_signature(
     h->introspecting->introspecting.writer->encoder, &handles_signature);
 }
 
 static int wrap_reader_start(
-  struct labcomm2014_reader *r, 
-  struct labcomm2014_reader_action_context *action_context,
-  int local_index, int remote_index, const struct labcomm2014_signature *signature,
+  struct labcomm2006_reader *r, 
+  struct labcomm2006_reader_action_context *action_context,
+  int local_index, int remote_index, const struct labcomm2006_signature *signature,
   void *value)
 {
   struct introspecting_private *introspecting = action_context->context;
@@ -164,23 +164,23 @@ static int wrap_reader_start(
   if (value == NULL) {
     struct handles_signature *handles_signature;
 
-    handles_signature = labcomm2014_memory_alloc(introspecting->memory, 1,
+    handles_signature = labcomm2006_memory_alloc(introspecting->memory, 1,
 					     sizeof(*handles_signature));
     handles_signature->introspecting = introspecting;
     handles_signature->index = local_index;
     handles_signature->signature = signature;
-    labcomm2014_scheduler_enqueue(introspecting->scheduler, 
+    labcomm2006_scheduler_enqueue(introspecting->scheduler, 
 			      0, send_handles_signature, handles_signature);
   }
-  return labcomm2014_reader_start(r, action_context->next, 
+  return labcomm2006_reader_start(r, action_context->next, 
 			      local_index, remote_index, signature, value);
 }
 
  void encode_handles_signature(
-  struct labcomm2014_encoder *encoder,
+  struct labcomm2006_encoder *encoder,
   void *context)
 {
-  const struct labcomm2014_signature *signature = context;
+  const struct labcomm2006_signature *signature = context;
   introspecting_messages_handles_signature handles_signature;
   int index = 0;
 
@@ -189,11 +189,11 @@ static int wrap_reader_start(
   handles_signature.signature.n_0 = signature->size;
   handles_signature.signature.a = signature->signature;
 
-  labcomm2014_encode_introspecting_messages_handles_signature(
+  labcomm2006_encode_introspecting_messages_handles_signature(
     NULL, &handles_signature);
 }
 
-struct labcomm2014_reader_action introspecting_reader_action = {
+struct labcomm2006_reader_action introspecting_reader_action = {
   .alloc = wrap_reader_alloc,
   .free = NULL,
   .start = wrap_reader_start,
@@ -206,25 +206,25 @@ static void register_encoder_signatures(void *context)
 {
   struct introspecting_private *introspecting = context;
 
-  labcomm2014_encoder_register_introspecting_messages_handles_signature(
+  labcomm2006_encoder_register_introspecting_messages_handles_signature(
     introspecting->introspecting.writer->encoder);
 }
 
 static int wrap_writer_alloc(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context)
+  struct labcomm2006_writer *w, 
+  struct labcomm2006_writer_action_context *action_context)
 {
   struct introspecting_private *introspecting = action_context->context;
 
-  labcomm2014_scheduler_enqueue(introspecting->scheduler, 
+  labcomm2006_scheduler_enqueue(introspecting->scheduler, 
 			    0, register_encoder_signatures, introspecting);
-  return labcomm2014_writer_alloc(w, action_context->next);
+  return labcomm2006_writer_alloc(w, action_context->next);
 }
 
 static int wrap_writer_start(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context, 
-  int index, const struct labcomm2014_signature *signature,
+  struct labcomm2006_writer *w, 
+  struct labcomm2006_writer_action_context *action_context, 
+  int index, const struct labcomm2006_signature *signature,
   void *value)
 {
   struct introspecting_private *introspecting = action_context->context;
@@ -232,18 +232,18 @@ static int wrap_writer_start(
   if (index >= LABCOMM_USER && value == NULL) {
     struct local *local;
 
-    labcomm2014_scheduler_data_lock(introspecting->scheduler);
+    labcomm2006_scheduler_data_lock(introspecting->scheduler);
     local = get_local(introspecting, index, signature);
     local->status = introspecting_registered;
-    labcomm2014_scheduler_data_unlock(introspecting->scheduler);
+    labcomm2006_scheduler_data_unlock(introspecting->scheduler);
   }
-  return labcomm2014_writer_start(w, action_context->next, index, signature, value);
+  return labcomm2006_writer_start(w, action_context->next, index, signature, value);
 }
 
 static int wrap_writer_ioctl(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context, 
-  int index, const struct labcomm2014_signature *signature, 
+  struct labcomm2006_writer *w, 
+  struct labcomm2006_writer_action_context *action_context, 
+  int index, const struct labcomm2006_signature *signature, 
   uint32_t ioctl_action, va_list args)
 {
   struct introspecting_private *introspecting = action_context->context;
@@ -253,20 +253,20 @@ static int wrap_writer_ioctl(
       struct local *local;
       int result;
 
-      labcomm2014_scheduler_data_lock(introspecting->scheduler);
+      labcomm2006_scheduler_data_lock(introspecting->scheduler);
       local = get_local(introspecting, index, signature);
       result = local->status;
-      labcomm2014_scheduler_data_unlock(introspecting->scheduler);
+      labcomm2006_scheduler_data_unlock(introspecting->scheduler);
       return result;
     }
     default: {
-      return labcomm2014_writer_ioctl(w, action_context->next, index, signature, 
+      return labcomm2006_writer_ioctl(w, action_context->next, index, signature, 
 				  ioctl_action, args);  
     } break;
   }
 }
 
-struct labcomm2014_writer_action introspecting_writer_action = {
+struct labcomm2006_writer_action introspecting_writer_action = {
   .alloc = wrap_writer_alloc,
   .free = NULL, 
   .start = wrap_writer_start,
@@ -276,11 +276,11 @@ struct labcomm2014_writer_action introspecting_writer_action = {
 };
 
 extern struct introspecting *introspecting_new(
-  struct labcomm2014_reader *reader,
-  struct labcomm2014_writer *writer,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler)
+  struct labcomm2006_reader *reader,
+  struct labcomm2006_writer *writer,
+  struct labcomm2006_error_handler *error,
+  struct labcomm2006_memory *memory,
+  struct labcomm2006_scheduler *scheduler)
 {
   struct introspecting_private *result;
 
diff --git a/examples/twoway/introspecting.h b/examples/twoway/introspecting.h
index bcd3be787865f1fa7a5d488cb48027845d108b93..83bdcc1f9720b52cfac374d2b489ffe1bcf005ed 100644
--- a/examples/twoway/introspecting.h
+++ b/examples/twoway/introspecting.h
@@ -23,22 +23,22 @@
 #ifndef __INTROSPECTING_H__
 #define __INTROSPECTING_H__
 
-#include <labcomm2014.h>
-#include <labcomm2014_ioctl.h>
-#include <labcomm2014_fd_reader.h>
-#include <labcomm2014_fd_writer.h>
+#include <labcomm2006.h>
+#include <labcomm2006_ioctl.h>
+#include <labcomm2006_fd_reader.h>
+#include <labcomm2006_fd_writer.h>
 
 struct introspecting {
-  struct labcomm2014_reader *reader;
-  struct labcomm2014_writer *writer;
+  struct labcomm2006_reader *reader;
+  struct labcomm2006_writer *writer;
 };
 
 extern struct introspecting *introspecting_new(
-  struct labcomm2014_reader *reader,
-  struct labcomm2014_writer *writer,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler);
+  struct labcomm2006_reader *reader,
+  struct labcomm2006_writer *writer,
+  struct labcomm2006_error_handler *error,
+  struct labcomm2006_memory *memory,
+  struct labcomm2006_scheduler *scheduler);
 
 #define HAS_SIGNATURE LABCOMM_IOS('i',2)
 enum introspecting_status { introspecting_unknown, 
diff --git a/examples/twoway/server.c b/examples/twoway/server.c
index 152f8a9f6a7d92e56e0fbb3d0a40678c7cdae361..a67d5dfd3b10c7b974fa1f2ec2243c064ff298f5 100644
--- a/examples/twoway/server.c
+++ b/examples/twoway/server.c
@@ -33,11 +33,11 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <labcomm2014_default_error_handler.h>
-#include <labcomm2014_default_memory.h>
-#include <labcomm2014_pthread_scheduler.h>
-#include <labcomm2014_fd_reader.h>
-#include <labcomm2014_fd_writer.h>
+#include <labcomm2006_default_error_handler.h>
+#include <labcomm2006_default_memory.h>
+#include <labcomm2006_pthread_scheduler.h>
+#include <labcomm2006_fd_reader.h>
+#include <labcomm2006_fd_writer.h>
 #include "decimating.h"
 #include "introspecting.h"
 #include "gen/types.h"
@@ -49,9 +49,9 @@ struct client {
   struct sockaddr_in adr;
   unsigned int adrlen;
   int32_t A, B, Sum, Diff, Product;
-  struct labcomm2014_decoder *decoder;
-  struct labcomm2014_encoder *encoder;
-  struct labcomm2014_scheduler *scheduler;
+  struct labcomm2006_decoder *decoder;
+  struct labcomm2006_encoder *encoder;
+  struct labcomm2006_scheduler *scheduler;
 };
 
 static void handle_A(int32_t *value, void *context)
@@ -67,22 +67,22 @@ static void handle_B(int32_t *value, void *context)
   int status;
 
   client->B = *value;
-  status = labcomm2014_encoder_ioctl_types_Product(client->encoder, HAS_SIGNATURE);
+  status = labcomm2006_encoder_ioctl_types_Product(client->encoder, HAS_SIGNATURE);
   switch (status) {
     case introspecting_unregistered:
-      labcomm2014_encoder_register_types_Product(client->encoder);
+      labcomm2006_encoder_register_types_Product(client->encoder);
       /* fall through */
     case introspecting_registered:
       client->Product = client->A * client->B;
-      labcomm2014_encode_types_Product(client->encoder, &client->Product);
+      labcomm2006_encode_types_Product(client->encoder, &client->Product);
       break;
     default:
       break;
   }
   client->Sum = client->A + client->B;
   client->Diff = client->A - client->B;
-  labcomm2014_encode_types_Sum(client->encoder, &client->Sum);
-  labcomm2014_encode_types_Diff(client->encoder, &client->Diff);
+  labcomm2006_encode_types_Sum(client->encoder, &client->Sum);
+  labcomm2006_encode_types_Diff(client->encoder, &client->Diff);
 }
 
 static void handle_Terminate(types_Terminate *value, void *context)
@@ -95,14 +95,14 @@ static void *run_decoder(void *arg)
   struct client *client = arg;
   int result;
 
-  labcomm2014_decoder_register_types_A(client->decoder, handle_A, client);
-  labcomm2014_decoder_register_types_B(client->decoder, handle_B, client);
-  labcomm2014_decoder_register_types_Terminate(client->decoder, handle_Terminate, 
+  labcomm2006_decoder_register_types_A(client->decoder, handle_A, client);
+  labcomm2006_decoder_register_types_B(client->decoder, handle_B, client);
+  labcomm2006_decoder_register_types_Terminate(client->decoder, handle_Terminate, 
 					   NULL);
   do {
-    result = labcomm2014_decoder_decode_one(client->decoder);
+    result = labcomm2006_decoder_decode_one(client->decoder);
   } while (result >= 0);
-  labcomm2014_scheduler_wakeup(client->scheduler);
+  labcomm2006_scheduler_wakeup(client->scheduler);
   return NULL;
 }
 
@@ -115,13 +115,13 @@ static void *run_client(void *arg)
   printf("Client start\n");
   client->A = 0;
   client->B = 0;
-  client->scheduler = labcomm2014_pthread_scheduler_new(labcomm2014_default_memory);
-  decimating = decimating_new(labcomm2014_fd_reader_new(labcomm2014_default_memory,
+  client->scheduler = labcomm2006_pthread_scheduler_new(labcomm2006_default_memory);
+  decimating = decimating_new(labcomm2006_fd_reader_new(labcomm2006_default_memory,
 						    client->fd, 1),
-			      labcomm2014_fd_writer_new(labcomm2014_default_memory,
+			      labcomm2006_fd_writer_new(labcomm2006_default_memory,
 						    client->fd, 0),
-			      labcomm2014_default_error_handler,
-			      labcomm2014_default_memory,
+			      labcomm2006_default_error_handler,
+			      labcomm2006_default_memory,
 			      client->scheduler);
   if (decimating == NULL) {
     /* Warning: might leak reader and writer at this point */
@@ -129,26 +129,26 @@ static void *run_client(void *arg)
   }
   introspecting = introspecting_new(decimating->reader,
 				    decimating->writer,
-				    labcomm2014_default_error_handler,
-				    labcomm2014_default_memory,
+				    labcomm2006_default_error_handler,
+				    labcomm2006_default_memory,
 				    client->scheduler);
   if (introspecting == NULL) {
     /* Warning: might leak reader and writer at this point */
     goto out;
   }
-  client->decoder = labcomm2014_decoder_new(introspecting->reader,
-				    labcomm2014_default_error_handler,
-				    labcomm2014_default_memory,
+  client->decoder = labcomm2006_decoder_new(introspecting->reader,
+				    labcomm2006_default_error_handler,
+				    labcomm2006_default_memory,
 				    client->scheduler);
-  client->encoder = labcomm2014_encoder_new(introspecting->writer,
-				    labcomm2014_default_error_handler,
-				    labcomm2014_default_memory,
+  client->encoder = labcomm2006_encoder_new(introspecting->writer,
+				    labcomm2006_default_error_handler,
+				    labcomm2006_default_memory,
 				    client->scheduler);
   pthread_t rdt;
   pthread_create(&rdt, NULL, run_decoder, client);  
-  labcomm2014_encoder_register_types_Sum(client->encoder);
-  labcomm2014_encoder_register_types_Diff(client->encoder);
-  labcomm2014_scheduler_sleep(client->scheduler, NULL);
+  labcomm2006_encoder_register_types_Sum(client->encoder);
+  labcomm2006_encoder_register_types_Diff(client->encoder);
+  labcomm2006_scheduler_sleep(client->scheduler, NULL);
   printf("Awoken\n");
   pthread_join(rdt, NULL);
 out:
diff --git a/examples/user_types/ExampleDecoder.cs b/examples/user_types/ExampleDecoder.cs
index 95b1fca4e2bf1d0adc4bad67823137b03980163c..7f45aa4d19533c30c59fe21b3f1c7791d4938691 100644
--- a/examples/user_types/ExampleDecoder.cs
+++ b/examples/user_types/ExampleDecoder.cs
@@ -1,87 +1,87 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
-using se.lth.control.labcomm;
-
-namespace user_types
-{
-    class Decoder : twoLines.Handler, 
-                    twoInts.Handler, 
-                    theFirstInt.Handler, 
-                    theSecondInt.Handler,
-                    doavoid.Handler,
-                    intAndRef.Handler
-    {
-        DecoderChannel dec;
-
-        public Decoder(Stream stream)
-        {
-            dec = new DecoderChannel(stream);
-            twoLines.register(dec, this);
-            twoInts.register(dec, this);
-            theFirstInt.register(dec, this);
-            theSecondInt.register(dec, this);
-            doavoid.register(dec, this);
-            intAndRef.register(dec, this);
-            doavoid.registerSampleRef(dec);
-            try
-            {
-                Console.WriteLine("Running decoder.");
-                dec.run();
-            }
-            catch (EndOfStreamException)
-            {
-                Console.WriteLine("EOF reached");
-            }
-        }
-
-        private string genPoint(point p)
-        {
-            return "(" + p.x.val + ", " + p.y.val + ")";
-        }
-        private String genLine(line l)
-        {
-            return "Line from " + genPoint(l.start) + " to " + genPoint(l.end);
-        }
-        public void handle(twoLines d)
-        {
-            Console.WriteLine("Got twoLines: ");
-            Console.WriteLine("Line l1: "+genLine(d.l1));
-            Console.WriteLine("Line l2: " + genLine(d.l2));
-        }
-
-        public void handle(twoInts d)
-        {
-            Console.WriteLine("Got twoInts: ");
-            Console.WriteLine("a: "+d.a);
-            Console.WriteLine("b: "+d.b);
-        }
-
-        void theFirstInt.Handler.handle(int d)
-        {
-            Console.WriteLine("Got theFirstInt: "+d);
-        }
-
-        void theSecondInt.Handler.handle(int d)
-        {
-            Console.WriteLine("Got theSecondInt: "+d);
-        }
-
-        void doavoid.Handler.handle()
-        {
-            Console.WriteLine("Got a void.");
-        }
-
-        void intAndRef.Handler.handle(intAndRef d)
-        {
-            Console.WriteLine("Got intAndRef: "+d.x+" : "+d.reference);
-        }
-
-        static void Main(string[] args)
-        {
-            new Decoder(new FileStream(args[0], FileMode.Open));
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using se.lth.control.labcomm;
+
+namespace user_types
+{
+    class Decoder : twoLines.Handler, 
+                    twoInts.Handler, 
+                    theFirstInt.Handler, 
+                    theSecondInt.Handler,
+                    doavoid.Handler,
+                    intAndRef.Handler
+    {
+        DecoderChannel dec;
+
+        public Decoder(Stream stream)
+        {
+            dec = new DecoderChannel(stream);
+            twoLines.register(dec, this);
+            twoInts.register(dec, this);
+            theFirstInt.register(dec, this);
+            theSecondInt.register(dec, this);
+            doavoid.register(dec, this);
+            intAndRef.register(dec, this);
+            doavoid.registerSampleRef(dec);
+            try
+            {
+                Console.WriteLine("Running decoder.");
+                dec.run();
+            }
+            catch (EndOfStreamException)
+            {
+                Console.WriteLine("EOF reached");
+            }
+        }
+
+        private string genPoint(point p)
+        {
+            return "(" + p.x.val + ", " + p.y.val + ")";
+        }
+        private String genLine(line l)
+        {
+            return "Line from " + genPoint(l.start) + " to " + genPoint(l.end);
+        }
+        public void handle(twoLines d)
+        {
+            Console.WriteLine("Got twoLines: ");
+            Console.WriteLine("Line l1: "+genLine(d.l1));
+            Console.WriteLine("Line l2: " + genLine(d.l2));
+        }
+
+        public void handle(twoInts d)
+        {
+            Console.WriteLine("Got twoInts: ");
+            Console.WriteLine("a: "+d.a);
+            Console.WriteLine("b: "+d.b);
+        }
+
+        void theFirstInt.Handler.handle(int d)
+        {
+            Console.WriteLine("Got theFirstInt: "+d);
+        }
+
+        void theSecondInt.Handler.handle(int d)
+        {
+            Console.WriteLine("Got theSecondInt: "+d);
+        }
+
+        void doavoid.Handler.handle()
+        {
+            Console.WriteLine("Got a void.");
+        }
+
+        void intAndRef.Handler.handle(intAndRef d)
+        {
+            Console.WriteLine("Got intAndRef: "+d.x+" : "+d.reference);
+        }
+
+        static void Main(string[] args)
+        {
+            new Decoder(new FileStream(args[0], FileMode.Open));
+        }
+    }
+}
diff --git a/lib/c/2006/Makefile b/lib/c/2006/Makefile
index 6ad51a63180dac3d6e07c3d6a6a71c4cd8101b5b..4ca13b6fe140f35cd0c41d584789f96f4bec9edf 100644
--- a/lib/c/2006/Makefile
+++ b/lib/c/2006/Makefile
@@ -96,7 +96,6 @@ $(TEST_DIR)/gen/%.o: $(TEST_DIR)/%.c | $(TEST_DIR)/gen
 .PRECIOUS: $(TEST_DIR)/gen/%.h
 $(TEST_DIR)/gen/%.c $(TEST_DIR)/gen/%.h: $(TEST_DIR)/%.lc | $(TEST_DIR)/gen
 	$(LABCOMM) \
-		--ver=$(VERSION) \
 		--c=$(TEST_DIR)/gen/$*.c \
 		--h=$(TEST_DIR)/gen/$*.h \
 		$<
diff --git a/lib/c/2014/Makefile b/lib/c/2014/Makefile
deleted file mode 100644
index 0e7aca58883a707d7c97d46dfe987ec7e5738305..0000000000000000000000000000000000000000
--- a/lib/c/2014/Makefile
+++ /dev/null
@@ -1,171 +0,0 @@
-## Macros
-VERSION=2014
-LIBVERSION=2014
-
-include ../os_compat.mk
-
-ALL_DEPS=../liblabcomm$(LIBVERSION).a ../liblabcomm$(LIBVERSION).so
-
-# TODO: Support for Codesourcery ARM toolchain.
-
-OBJS=labcomm$(VERSION).o \
-     labcomm$(VERSION)_memory.o \
-     labcomm$(VERSION)_error.o \
-     labcomm$(VERSION)_default_error_handler.o \
-     labcomm$(VERSION)_default_memory.o \
-     labcomm$(VERSION)_default_scheduler.o \
-     labcomm$(VERSION)_time.o \
-     labcomm$(VERSION)_scheduler.o \
-     labcomm$(VERSION)_encoder.o \
-     labcomm$(VERSION)_decoder.o \
-     labcomm$(VERSION)_dynamic_buffer_writer.o \
-     labcomm$(VERSION)_fd_reader.o \
-	 labcomm$(VERSION)_type_signature.o \
-     labcomm$(VERSION)_fd_writer.o \
-     labcomm$(VERSION)_pthread_scheduler.o 
-
-# Enable experimental objects by `make LABCOMM_EXPERIMENTAL=true`
-ifeq ($(LABCOMM_EXPERIMENTAL),true)
-    OBJS += experimental/udp_hack.o experimental/ethaddr.o \
-	    experimental/labcomm_thr_reader_writer.o \
-	    experimental/ThrottleDrv/ethernet_drv.o \
-	    experimental/ThrottleDrv/throttle_drv.o \
-	    experimental/labcomm_udp_reader_writer.o
-endif
-
-# Enable experimental objects by `make LABCOMM_SIG_PARSER=true`
-ifeq ($(LABCOMM_SIG_PARSER),true)
-    OBJS += experimental/labcomm_sig_parser.o 
-endif
-
-LABCOMM_JAR=../../../compiler/labcomm$(LIBVERSION)_compiler.jar
-LABCOMM=java -jar $(LABCOMM_JAR) 
-
-TESTS=test_labcomm_basic_type_encoding \
-      test_labcomm_generated_encoding \
-      test_signature_numbers \
-      test_labcomm \
-      test_labcomm_pthread_scheduler \
-      test_labcomm_copy
-#FIXME: test_labcomm_errors
-
-TEST_DIR=test
-
-
-## Targets
-
-.PHONY: all 
-all: $(ALL_DEPS)
-
-.PHONY: test 
-test: all $(TESTS:%=run-test-%)
-
-.PHONY: clean 
-clean:
-	$(RM) *.o
-	$(RM) experimental/*.o 
-	$(RM) experimental/ThrottleDrv/*.o
-	$(RM) test/*.o
-	$(RM) test/*.gch
-	$(RM) test/test_labcomm_errors
-	$(RM) test/testdata/gen/*.[cho]
-	$(RM) test/gen/*.[cho]
-	$(RM) -rf test/gen
-
-.PHONY: distclean
-distclean: clean
-	$(RM) ../liblabcomm$(LIBVERSION).so.1
-	$(RM) ../liblabcomm$(LIBVERSION).a
-
-# rules invoked by 'all'
-../liblabcomm$(LIBVERSION).so: ../liblabcomm$(LIBVERSION).so.1
-	if [ -h $@ ] ; then rm $@ ; fi
-	ln -s $(<:../%=%) $@
-
-../liblabcomm$(LIBVERSION).so.1: $(OBJS:%.o=%.pic.o)
-	$(call MAKESHARED,$@,$(@:../%=%),$^)
-
-../liblabcomm$(LIBVERSION).a: $(OBJS)
-	ar -r $@ $^
-
-# Enable sig parser objects by `make LABCOMM_SIG_PARSER=true`
-ifeq ($(LABCOMM_SIG_PARSER),true)
-experimental/test_sig_parser : experimental/labcomm_sig_parser.o experimental/test_sig_parser.c
-endif
-
-# compilation rules 
-%.pic.o:	%.c
-	$(CC) -fPIC $(CFLAGS) -c -o $@ $<
-
-%.o: %.c %.h
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-# rules invoked by 'test'
-.PHONY: run-test-%
-run-test-%: $(TEST_DIR)/gen/% | $(TEST_DIR)/gen
-	$<
-
-.PRECIOUS: $(TEST_DIR)/gen/%
-
-$(TEST_DIR)/gen/%: $(TEST_DIR)/gen/%.o | $(TEST_DIR)/gen
-	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) 
-
-$(TEST_DIR)/gen/%.o: $(TEST_DIR)/%.c | $(TEST_DIR)/gen
-	$(CC) $(CFLAGS_TEST) -o $@ -c $<
-
-.PRECIOUS: $(TEST_DIR)/gen/%.c
-.PRECIOUS: $(TEST_DIR)/gen/%.h
-$(TEST_DIR)/gen/%.c $(TEST_DIR)/gen/%.h: $(TEST_DIR)/%.lc | $(TEST_DIR)/gen
-	$(LABCOMM) \
-		--c=$(TEST_DIR)/gen/$*.c \
-		--h=$(TEST_DIR)/gen/$*.h \
-		$<
-
-$(LABCOMM_JAR):
-	@echo "======Building LabComm compiler======"
-	cd $(shell dirname $(LABCOMM_JAR)); ant jar
-	@echo "======End building LabComm compiler======"
-
-$(TEST_DIR)/gen:
-	mkdir -p $@
-
-# Extra compilation dependencies
-labcomm$(VERSION).o: \
-	labcomm$(VERSION).c \
-	labcomm$(VERSION).h \
-	labcomm$(VERSION)_private.h
-
-labcomm$(VERSION)_fd_reader.o: \
-	labcomm$(VERSION)_private.h
-
-labcomm$(VERSION)_fd_writer.o: \
-	labcomm$(VERSION)_private.h
-
-labcomm$(VERSION)_dynamic_buffer_writer.o: \
-	labcomm$(VERSION)_private.h
-
-$(TEST_DIR)/gen/test_labcomm_basic_type_encoding.o: \
-	labcomm$(VERSION)_private.h
-
-$(TEST_DIR)/gen/test_labcomm_generated_encoding.o: \
-	labcomm$(VERSION)_private.h \
-	$(TEST_DIR)/gen/generated_encoding.h
-
-$(TEST_DIR)/gen/test_labcomm_generated_encoding: \
-	$(TEST_DIR)/gen/generated_encoding.o
-
-$(TEST_DIR)/gen/test_signature_numbers.c: \
-	$(TEST_DIR)/gen/another_encoding.h \
-	$(TEST_DIR)/gen/generated_encoding.h				
-
-$(TEST_DIR)/gen/test_signature_numbers: \
-	$(TEST_DIR)/gen/another_encoding.o \
-	$(TEST_DIR)/gen/generated_encoding.o
-
-$(TEST_DIR)/gen/test_labcomm:  \
-	$(TEST_DIR)/gen/test_sample.o
-
-$(TEST_DIR)/gen/test_labcomm_copy: \
-	$(TEST_DIR)/gen/generated_encoding.o \
-	$(TEST_DIR)/gen/test_sample.o \
-	$(TEST_DIR)/gen/more_types.o
diff --git a/lib/c/2014/experimental/ThrottleDrv/display.h b/lib/c/2014/experimental/ThrottleDrv/display.h
deleted file mode 100644
index 49c9cd4c84c02df8710685d301237fbb6492d137..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/ThrottleDrv/display.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#define PC_MODE
-#ifdef PC_MODE
-#define DISPLAY_ERR(s) 	perror(s);
-
-// Some projects can not use stdio.h.
-#ifndef LABCOMM_NO_STDIO
-  #include <stdio.h>
-#endif
-
-#else
-#define DISPLAY_ERR(s)  ;
-#endif
diff --git a/lib/c/2014/experimental/ThrottleDrv/ethernet_drv.c b/lib/c/2014/experimental/ThrottleDrv/ethernet_drv.c
deleted file mode 100644
index 9b4126eeee3befc7403c036dbab08dbc413fdb44..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/ThrottleDrv/ethernet_drv.c
+++ /dev/null
@@ -1,233 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-//#include <linux/if_ether.h>
-//#include <linux/if_packet.h>
-//#include <linux/if_arp.h>
-#include <net/if.h>
-#include <netpacket/packet.h>
-//#include <netinet/in.h>
-#include "ethernet_drv.h"
-#include "display.h"
-
-// Some projects can not use stdio.h.
-#ifndef LABCOMM_NO_STDIO
-  #include <stdio.h>
-#endif
-
-/** LOCAL FUNCTIONS **/
-
-/* local type for the ethernet interface */
-struct eth_int_t
-{
-	struct ether_addr mac_adr;        /* MAC address                */
-	int socket_id;                    /* socket file descriptor     */
-	int index;                        /* index of the eth interface */
-	unsigned char validity;
-};
-
-/***
-Open an Ethernet Raw packet connection
-***/
-struct eth_int_t* eth_open(const char* eth_int_name)
-{
-   struct eth_int_t* tmp_eth = NULL; /* pointer to ethernet interface struct */
-   struct ifreq ifr;                 /* struct used by ioctl function        */
-
-   /* TO-DO: check if a ethernet socket has already been created for eth_int_name interface */
-
-   /* Ethernet interface name pointer valid ? */
-   if (NULL == eth_int_name)
-   {
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter NULL");
-   }
-   else
-   {
-      /* allocate memory for the Ethernet Interface */
-      tmp_eth = (struct eth_int_t*)malloc(sizeof(struct eth_int_t));
-      if (NULL == tmp_eth)
-      {
-   	    DISPLAY_ERR("Error allocating memory!");
-      }
-      else
-      {
-   	   /* creates a Packet Socket, raw delivery, accept all protocol */
-         tmp_eth->socket_id = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
-         if (-1 == tmp_eth->socket_id) /* error occurred during socket creation ? */
-         {
-            free(tmp_eth); /* deallocate the memory */
-            tmp_eth = NULL;
-            DISPLAY_ERR("Error in creating socket");
-         }
-         else
-         {
-            /* retrieve the Ethernet card MAC address */
-            strcpy(ifr.ifr_name, eth_int_name);
-            if (ioctl(tmp_eth->socket_id, SIOCGIFHWADDR, &ifr) == -1) /* error during the retrieve of  MAC address ? */
-            {
-               close(tmp_eth->socket_id); /* close the socket      */
-               free(tmp_eth);             /* deallocate the memory */
-               tmp_eth = NULL;
-               DISPLAY_ERR("ioctl error SIOCGIFHWADDR");
-            }
-            else
-            {
-               /* copy the MAC address into the eth interface struct */
-               memcpy(tmp_eth->mac_adr.ether_addr_octet, ifr.ifr_hwaddr.sa_data, ETH_ALEN);
-
-               /*retrieve the Ethernet interface index*/
-               if (ioctl(tmp_eth->socket_id, SIOCGIFINDEX, &ifr) == -1)/* error during the retrieve of index */
-               {
-                  close(tmp_eth->socket_id); /* close the socket      */
-                  free(tmp_eth);             /* deallocate the memory */
-                  tmp_eth = NULL;
-                  DISPLAY_ERR("ioctl error SIOCGIFINDEX");
-               }
-               else
-               {
-                  /* copy the interface index into the eth interface struct */
-                  tmp_eth->index = ifr.ifr_ifindex;
-                  printf("Successfully got our MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n",
-                          tmp_eth->mac_adr.ether_addr_octet[0],tmp_eth->mac_adr.ether_addr_octet[1],tmp_eth->mac_adr.ether_addr_octet[2],tmp_eth->mac_adr.ether_addr_octet[3],tmp_eth->mac_adr.ether_addr_octet[4],tmp_eth->mac_adr.ether_addr_octet[5]);
-                  printf("Successfully got interface index for %s: %i\n",eth_int_name, tmp_eth->index);
-               }
-            }
-         }
-      }
-   }
-   return(tmp_eth);
-}
-
-/***
-Close the Ethernet Raw packet connection
-***/
-int eth_close(struct eth_int_t* eth_int)
-{
-   int ret = 0;
-
-   /* Ethernet interface pointer valid ? */
-   if (NULL == eth_int)
-   {
-      ret = -1;
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter NULL");
-   }
-   else
-   {
-      if (-1 == close(eth_int->socket_id)) /* error during the closure of the socket ? */
-      {
-         ret = -1;
-         DISPLAY_ERR("Socket closure error");
-      }
-      else
-      {
-         free(eth_int);  /* deallocate the memory */
-         eth_int = NULL;
-      }
-   }
-   return(ret);
-}
-
-/***
-Returns the MAC address of the Ethernet Interface
-***/
-int eth_getMACadr(const struct eth_int_t* eth_int, struct ether_addr * mac_adr)
-{
-   int ret = 0;
-
-   if ((NULL == eth_int) || (NULL == mac_adr))  /* Input parameters valid ? */
-   {
-      ret = -1;
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter(s) NULL");
-   }
-   else
-   {
-      /* TO-DO: introduce a validity flag to be check before accessing to eth_int (better a crc) */
-      memcpy(mac_adr, &eth_int->mac_adr, sizeof(mac_adr));
-   }
-   return(ret);
-}
-
-
-/***
-send a complete Ethernet Raw Packet
-***/
-int eth_send(const struct eth_int_t* eth_int, const unsigned char* eth_frame, unsigned short length)
-{
-   struct ethhdr *eth_header = NULL;  /* Pointer to Ethernet frame header (Dest,Source,Type) */
-   struct sockaddr_ll socket_address;
-   int ret;
-
-   if ((NULL == eth_int) || (NULL == eth_frame))
-   {
-      ret = -1;
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter(s) Null!");
-   }
-   else
-   {
-      eth_header = (struct ethhdr*)eth_frame;
-
-      /*prepare sockaddr_ll (address structure for PACKET_SOCKET) */
-      socket_address.sll_family   = AF_PACKET;
-      socket_address.sll_addr[0]  = eth_header->h_dest[0];
-      socket_address.sll_addr[1]  = eth_header->h_dest[1];
-      socket_address.sll_addr[2]  = eth_header->h_dest[2];
-      socket_address.sll_addr[3]  = eth_header->h_dest[3];
-      socket_address.sll_addr[4]  = eth_header->h_dest[4];
-      socket_address.sll_addr[5]  = eth_header->h_dest[5];
-      socket_address.sll_addr[6]  = 0x00; /* not used */
-      socket_address.sll_addr[7]  = 0x00; /* not used */
-      socket_address.sll_halen    = ETH_ALEN;         /* Length of the MAC address         */
-      socket_address.sll_ifindex  = eth_int->index;   /* Ethernet Interface index          */
-      // The rest should be zero for sending, and are set by the system for receiving.
-      socket_address.sll_hatype   = 0;            
-      socket_address.sll_protocol = 0;
-      socket_address.sll_pkttype  = 0;
-
-      //socket_address.sll_protocol = htons(ETH_P_IP);  /* Physical layer protocol           */
-      //socket_address.sll_hatype   = ARPHRD_ETHER;     /* ARP hardware identifier: Ethernet */
-      //socket_address.sll_pkttype  = PACKET_OTHERHOST; /* Packet type: Another host         */
-
-      /*send the Ethernet frame */
-      ret = sendto(eth_int->socket_id, eth_frame, length, 0, (struct sockaddr*)&socket_address, sizeof(socket_address));
-      if (ret == -1) /* error during the trasmission of the Ethernet frame ? */
-      {
-         DISPLAY_ERR("sendto error!");
-      }
-   }
-   return(ret);
-}
-
-/***
-receive a complete Ethernet Raw Packet
-***/
-int eth_receive (const struct eth_int_t* eth_int, unsigned char* eth_frame, unsigned short length)
-{
-   int ret;
-
-   if ((NULL == eth_int) || (NULL == eth_frame))
-   {
-      ret = -1;
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter(s) Null!");
-   }
-   else
-   {
-      /*Wait for incoming packet...*/
-      ret = recvfrom(eth_int->socket_id, (void*)eth_frame, length, 0, NULL, NULL);
-      if (ret == -1) /* error during the reception of the Ethernet frame ? */
-      {
-         DISPLAY_ERR("recvfrom error!");
-      }
-   }
-   return(ret);
-}
-
-
-
diff --git a/lib/c/2014/experimental/ThrottleDrv/ethernet_drv.h b/lib/c/2014/experimental/ThrottleDrv/ethernet_drv.h
deleted file mode 100644
index de139de6fca7086fadf50ef8a21eeee778daa71a..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/ThrottleDrv/ethernet_drv.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _ETHERNET_DRV_H_
-#define _ETHERNET_DRV_H_
-
-#include <net/ethernet.h>
-
-struct eth_int_t;
-
-struct eth_int_t* eth_open(const char* eth_int_name);
-int eth_close(struct eth_int_t* eth_int);
-int eth_getMACadr(const struct eth_int_t* eth_int, struct ether_addr *mac_adr);
-int eth_send(const struct eth_int_t* eth_int, const unsigned char* eth_frame, unsigned short length);
-int eth_receive (const struct eth_int_t* eth_int, unsigned char* eth_frame, unsigned short length);
-
-#endif
diff --git a/lib/c/2014/experimental/ThrottleDrv/throttle_drv.c b/lib/c/2014/experimental/ThrottleDrv/throttle_drv.c
deleted file mode 100644
index 36e830ff27b3ac753f3917495c8cba44a52d045a..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/ThrottleDrv/throttle_drv.c
+++ /dev/null
@@ -1,409 +0,0 @@
-#include "throttle_drv.h"
-#include "ethernet_drv.h"
-#include <errno.h>
-#include "display.h"
-#include "stdlib.h"
-#include <string.h>
-#include <time.h>
-// #include <arpa/inet.h>
-
-#define THROTTLENET_PROTO 0x544e
-
-#define THR_DST_ADR_POS      0
-#define THR_SRC_ADR_POS      (THR_DST_ADR_POS  + sizeof(((thr_header_t*)0)->dst_adr))             //6
-#define THR_ETH_TYP_POS      (THR_SRC_ADR_POS  + sizeof(((thr_header_t*)0)->src_adr))             //12
-#define THR_CHN_ID_POS       (THR_ETH_TYP_POS  + sizeof(((thr_header_t*)0)->eth_type))            //14
-#define THR_FRAG_NUM_POS     (THR_CHN_ID_POS   + sizeof(((thr_header_t*)0)->chn_id))              //15
-#define THR_FRAG_TOT_NUM_POS (THR_FRAG_NUM_POS + sizeof(((thr_header_t*)0)->frag_num))            //17
-#define THR_FRAG_LEN_POS     (THR_FRAG_TOT_NUM_POS + sizeof(((thr_header_t*)0)->frag_num_tot))    //19
-#define THR_PAYLOAD_POS      (THR_FRAG_LEN_POS + sizeof(((thr_header_t*)0)->frag_len))            //21
-#define THR_MSG_HEADER_LEN   THR_PAYLOAD_POS
-
-#define THR_MSG_DST_ADR(thr_msg)       (struct ether_addr*)(&thr_msg[THR_DST_ADR_POS])
-#define THR_MSG_SRC_ADR(thr_msg)       (struct ether_addr*)(&thr_msg[THR_SRC_ADR_POS])
-#define THR_MSG_ETH_TYP(thr_msg)       *(unsigned short*)(&thr_msg[THR_ETH_TYP_POS])
-#define THR_MSG_CHN_ID(thr_msg)        *(unsigned char*)(&thr_msg[THR_CHN_ID_POS])
-#define THR_MSG_FRAG_NUM(thr_msg)      *(unsigned short*)(&thr_msg[THR_FRAG_NUM_POS])
-#define THR_MSG_FRAG_TOT_NUM(thr_msg)  *(unsigned short*)(&thr_msg[THR_FRAG_TOT_NUM_POS])
-#define THR_MSG_FRAG_LEN(thr_msg)      *(unsigned short*)(&thr_msg[THR_FRAG_LEN_POS])
-#define THR_MSG_PAYLOAD(thr_msg)       (unsigned char*)(&thr_msg[THR_PAYLOAD_POS])
-
-
-/* local type for the Throttle Channel structure */
-struct thr_chn_t
-{
-	struct ether_addr dst_adr;         /* destination MAC address                    */
-	unsigned char id;                  /* Channel id                                 */
-	unsigned short frag_size;          /* Fragment size                              */
-	unsigned short freq;               /* Message transmission frequency             */
-	thr_msg_handler_t funct;           /* Callback function invoked at the reception */
-	unsigned short msg_length;
-	unsigned char* p_msg;
-	struct ether_addr last_sender_adr;/* src MAC address of last message */
-};
-
-/* Type for the Throttle message */
-typedef struct
-{
-   struct ether_addr dst_adr;  /* destination MAC address  */
-   struct ether_addr src_adr;  /* source MAC address       */
-   unsigned short eth_type;              /* ethernet packet type     */
-   unsigned char  chn_id;                /* channel identification   */
-   unsigned short frag_num;              /* fragment number          */
-   unsigned short frag_num_tot;          /* total fragment number    */
-   unsigned short frag_len;              /* fragment length          */
-}thr_header_t;
-
-/* Local functions */
-static int thr_msg_check(const unsigned char* thr_msg, unsigned short chn_id, unsigned short length);
-
-static struct eth_int_t* eth_int = NULL;
-
-/**
-* @fn         int thr_init(const char* eth_int_name)
-*
-* @brief      Initializes the Throttle Net Driver, enabling the Ethernet Raw communication for the eth_int_name interface.
-*
-* @param [in] eth_int_name: ethernet interface name (e.g. "eth0","eth1")
-*
-* @retval     int: 0 on success; -1 on error and errno is set appropriately
-*
-*******************************************************************************/
-int thr_init(const char* eth_int_name)
-{
-   int ret = 0;
-
-   if (NULL == eth_int_name)
-   {
-      ret = -1;
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter NULL");
-   }
-   else
-   {
-      eth_int = eth_open(eth_int_name); /* open the Ethernet socket */
-      if (NULL == eth_int)
-      {
-         ret = -1;
-      }
-   }
-   return(ret);
-}
-
-/**
-* @fn         struct thr_chn_t* thr_open_chn(const char* dst_adr, unsigned char chn_id, unsigned char frag_size, unsigned short freq, const thr_msg_handler_t funct);
-*
-* @brief      Open a logic channel
-*
-* @param [in] dst_adr: destination MAC address;
-* @param [in] chn_id: identification of the channel;
-* @param [in] frag_size: fragment size;
-* @param [in] freq: frequency of trasmission for each fragment;
-* @param [in] msg_handler: callback invoked when a message is completely received;
-*
-* @retval     struct thr_chn_t*: pointer to the Channel structure. NULL on error and errno is set appropriately.
-*
-*******************************************************************************/
-struct thr_chn_t* thr_open_chn(const struct ether_addr* dst_adr, unsigned char chn_id, unsigned char frag_size, unsigned short freq, const thr_msg_handler_t funct)
-{
-   struct thr_chn_t* tmp_chn = NULL; /* pointer to Channel structure */
-
-   /* TO-DO: check if a similar channel has already been created */
-
-   /* Input parameters not valid ? */
-   if ((NULL == dst_adr) || (0 == frag_size))
-   {
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter(s) NULL");
-   }
-   else
-   {
-      /* allocate memory for the Channel structure */
-      tmp_chn = (struct thr_chn_t*)malloc(sizeof(struct thr_chn_t));
-      if (NULL == tmp_chn)
-      {
-         DISPLAY_ERR("Error allocating memory!");
-      }
-      else
-      {
-         /* Update the Channel structure */
-         memcpy(&tmp_chn->dst_adr, dst_adr, sizeof(tmp_chn->dst_adr));
-         tmp_chn->id = chn_id;
-         tmp_chn->frag_size = frag_size;
-         tmp_chn->freq = freq;
-         tmp_chn->funct = funct;
-      }
-#ifdef DEBUG
-      printf("thr_open_chn: callback = %x\n", tmp_chn->funct);
-#endif
-
-   }
-
-   return(tmp_chn);
-}
-
-void thr_close_chn(struct thr_chn_t* c){
-   free(c);
-}
-
-/**
-* @fn         int thr_send(const struct thr_chn_t* thr_chn, const char* data, unsigned int length)
-*
-* @brief      Sends a Throttle message. A channel must be opened first.
-*
-* @param [in] thr_chn: pointer to the Throttle channel descriptor;
-* @param [in] data: data buffer to be sent;
-* @param [in] length: length of the data buffer;
-*
-* @retval     int: number of byte sent, on success. -1 on error and errno is set appropriately.
-*
-*******************************************************************************/
-int thr_send(const struct thr_chn_t* thr_chn, const char* data, unsigned int length)
-{
-   unsigned char* thr_msg;
-   unsigned char i;
-   int ret = 0;
-
-   /* Check the input parameters */
-   if ((NULL == thr_chn) || (NULL == data) || (0 == length))
-   {
-      ret = -1;
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter(s) NULL");
-   }
-   else
-   {
-      if (0 == thr_chn->frag_size)
-      {
-         ret = -1;
-         errno = ERANGE;
-         DISPLAY_ERR("Division by zero");
-      }
-      else
-      {
-         /* allocate memory for the Throttle Message */
-         thr_msg = (unsigned char*)malloc(THR_MSG_HEADER_LEN + thr_chn->frag_size);
-         if (NULL == thr_msg)
-         {
-            ret = -1;
-            DISPLAY_ERR("Error allocating memory!");
-         }
-         else
-         {
-            /* Compose the Ethernet Frame to be sent */
-            memcpy(THR_MSG_DST_ADR(thr_msg), &thr_chn->dst_adr, sizeof(thr_chn->dst_adr)); /* Destiantion MAC Address  */
-            eth_getMACadr(eth_int, THR_MSG_SRC_ADR(thr_msg));                        /* Source MAC Address       */
-            THR_MSG_ETH_TYP(thr_msg) = htons(THROTTLENET_PROTO);                     /* Ethernet Packet Type     */
-            THR_MSG_CHN_ID(thr_msg) = thr_chn->id;                                   /* Channel identification   */
-            THR_MSG_FRAG_TOT_NUM(thr_msg) = ((length - 1) / thr_chn->frag_size) + 1; /* Total number of fragment */
-
-            struct timespec thr_time;
-            thr_time.tv_sec = thr_chn->freq / 1000;
-            thr_time.tv_nsec = (thr_chn->freq % 1000) * 1000000;
-
-            /* Message is splitted into fragments and they are sent */
-            for (i = 1; i <= THR_MSG_FRAG_TOT_NUM(thr_msg); i++)
-            {
-               THR_MSG_FRAG_NUM(thr_msg) = i; /* fragment number */
-               /* update the fragment length */
-               if (length >= thr_chn->frag_size)
-               {
-                  THR_MSG_FRAG_LEN(thr_msg) = thr_chn->frag_size;
-                  length -= thr_chn->frag_size;
-               }
-               else
-               {
-                  THR_MSG_FRAG_LEN(thr_msg) = length;
-               }
-               memcpy ((void*)THR_MSG_PAYLOAD(thr_msg), (void*)data, THR_MSG_FRAG_LEN(thr_msg));                /* update the payload */
-               ret = eth_send(eth_int, &thr_msg[0], (THR_MSG_HEADER_LEN + THR_MSG_FRAG_LEN(thr_msg))); /* send the message   */
-               if (-1 == ret)  /*Error during the Ethernet trasmission ? */
-               {
-                  DISPLAY_ERR("Error during Throttle msg trasmission!");
-                  break;
-               }
-               else
-               {
-                  data += THR_MSG_FRAG_LEN(thr_msg);
-                  nanosleep(&thr_time, NULL);
-               }
-            }
-            /*deallocate the memory */
-            free(thr_msg);
-            thr_msg = NULL;
-         }
-      }
-   }
-   return(ret);
-}
-
-int thr_receive(struct thr_chn_t* thr_chn, unsigned char* data, void* param)
-{
-   unsigned char* thr_msg = NULL;
-   unsigned char* p_data = NULL;
-   unsigned short frag_index = 1;
-   short byte_rec = 0;
-   unsigned char msg_received = 0;
-   int ret;
-
-   if ((NULL == thr_chn) || (NULL == data) || (NULL == thr_chn->funct) || (NULL == param))
-   {
-      ret = -1;
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter(s) NULL");
-   }
-   else
-   {
-      /* allocate memory for the Throttle Message */
-      thr_msg = (unsigned char*)malloc(THR_MSG_HEADER_LEN + thr_chn->frag_size);
-      if (NULL == thr_msg)
-      {
-         ret = -1;
-         DISPLAY_ERR("Error allocating memory!");
-      }
-      else
-      {
-         p_data = data;
-         do
-         {
-            byte_rec = eth_receive(eth_int, thr_msg, (THR_MSG_HEADER_LEN + thr_chn->frag_size));  /* receive the Ethernet Raw packet */
-            if (-1 == byte_rec)
-            {
-               /* discard the message */
-               DISPLAY_ERR("Error during Throttle msg reception: Fragment discarded.");
-            }
-            else
-            {
-               /* check if the Ethernet Raw message is correct (Ethernet protocol, Channel ID, length) */
-               ret = thr_msg_check(thr_msg, thr_chn->id, byte_rec);
-               if (ret < 0)
-               {
-                  //printf("Throttle msg mismatch: Fragment discarded.\n");
-               }
-               else
-               {
-#ifdef DEBUG
-                  printf("thr_receive: Message Index %d on %d. Actual Index %d\n", THR_MSG_FRAG_NUM(thr_msg), THR_MSG_FRAG_TOT_NUM(thr_msg), frag_index);
-#endif
-                  if (frag_index == THR_MSG_FRAG_NUM(thr_msg)) /* The fragment is the one expected ? */
-                  {
-                     /* Rebuild the original data linking the payloads of each fragment */
-                     memcpy((void*)p_data, (void*)THR_MSG_PAYLOAD(thr_msg), THR_MSG_FRAG_LEN(thr_msg));
-                     p_data += THR_MSG_FRAG_LEN(thr_msg);  /* update the pointer to the buffer   */
-                     frag_index++;                /* update the fragment index          */
-                     ret = p_data - data;         /* update the number of received byte */
-                     if (frag_index > THR_MSG_FRAG_TOT_NUM(thr_msg))
-                     {
-                        msg_received = 1;
-                     }
-                  }
-                  else
-                  {
-                     printf("thr_receive: Fragment mismatch: Fragment discarded.\n");
-                     frag_index = 1;
-                     p_data = data;
-                  }
-               }
-            }
-         }while (msg_received != 1);
-
-         thr_chn->p_msg = (unsigned char*)malloc(ret);
-         if (NULL == thr_chn->p_msg)
-         {
-            ret = -1;
-            DISPLAY_ERR("Error allocating memory!");
-         }
-         else
-         {
-#ifdef DEBUG
-            printf("thr_receive: Number of byte receive %d\n",ret);
-#endif
-            thr_chn->msg_length = ret;
-            memcpy(thr_chn->p_msg, data, ret); /* copy the msg into the thr structure */
-            memcpy(&thr_chn->last_sender_adr, THR_MSG_SRC_ADR(thr_msg), 6); /* ... and the address of the sender */
-#ifdef DEBUG
-            printf("thr_receive: calling %x\n", thr_chn->funct);
-#endif
-            (thr_chn->funct)(param);
-            free(thr_chn->p_msg);
-            thr_chn->p_msg = NULL;
-         }
-
-         /* deallocate memory for the Throttle Message */
-         free(thr_msg);
-         thr_msg = NULL;
-         p_data = NULL;
-      }
-   }
-   return(ret);
-}
-
-
-static int thr_msg_check(const unsigned char* thr_msg, unsigned short chn_id, unsigned short length)
-{
-   int ret = 0;
-
-   if (length > THR_MSG_HEADER_LEN)                    /* Ethernet Raw Packet contains a valid Payload ? */
-   {
-      if (THROTTLENET_PROTO == ntohs(THR_MSG_ETH_TYP(thr_msg))) /* Is Ethernet Type THROTTLENET Protocol ?        */
-      {
-         if (THR_MSG_CHN_ID(thr_msg) == chn_id)                 /* Is Channel identification correct ?            */
-         {
-            /* throttle message is correct */
-         }
-         else
-         {
-            ret = -1;
-         }
-      }
-      else
-      {
-         /* discard the message */
-         ret = -2;
-      }
-   }
-   else
-   {
-      /* discard the message */
-      ret = -3;
-   }
-   return(ret);
-}
-
-
-int thr_read(struct thr_chn_t* thr_chn, unsigned char* data, int length)
-{
-   int ret = 0;
-
-   if ((NULL == thr_chn) || (NULL == data))
-   {
-      ret = -1;
-      errno = EINVAL;
-      DISPLAY_ERR("Input parameter(s) NULL");
-   }
-   else
-   {
-      if (length > thr_chn->msg_length)
-      {
-         length = thr_chn->msg_length;
-#ifdef DEBUG
-         printf("thr_read: truncating length to %d\n", length);
-#endif
-      }
-#ifdef DEBUG
-      printf("thr_read: calling memcpy(%x, %x, %d\n", data, thr_chn->p_msg, length);
-#endif
-      memcpy(data, thr_chn->p_msg, length); /* copy the msg into the thr structure */
-      ret = length;
-      thr_chn->msg_length = 0;
-   }
-   return(ret);
-}
-
-struct ether_addr* get_sender_addr(struct thr_chn_t* ch) {
-	return &ch->last_sender_adr;
-}
-
-unsigned char get_channel(struct thr_chn_t* ch) {
-	return ch->id;
-}
diff --git a/lib/c/2014/experimental/ThrottleDrv/throttle_drv.h b/lib/c/2014/experimental/ThrottleDrv/throttle_drv.h
deleted file mode 100644
index 97323ae56b4720e7dd4c4d877e22183b2aad64bb..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/ThrottleDrv/throttle_drv.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _THROTTLE_DRV_H_
-#define _THROTTLE_DRV_H_
-
-//#define ETH_ADR_SIZE 6
-
-#include <net/ethernet.h>
-
-
-
-/* typedef of the callback used to manage the received Ethernet Frame (the User Data)*/
-typedef int (*thr_msg_handler_t)(void* data);
-struct thr_chn_t;
-
-
-int thr_init(const char* eth_int);
-struct thr_chn_t* thr_open_chn(const struct ether_addr* dst_adr, unsigned char chn_id, unsigned char frag_size, unsigned short freq, thr_msg_handler_t funct);
-void thr_close_chn(struct thr_chn_t* c);
-int thr_receive (struct thr_chn_t* thr_chn, unsigned char* data, void* param);
-int thr_send(const struct thr_chn_t* thr_chn, const char* data, unsigned int length);
-int thr_read(struct thr_chn_t* thr_chn, unsigned char* data, int length);
-
-struct ether_addr * get_sender_addr(struct thr_chn_t* ch);
-unsigned char get_channel(struct thr_chn_t* ch);
-#endif
diff --git a/lib/c/2014/experimental/ethaddr.c b/lib/c/2014/experimental/ethaddr.c
deleted file mode 100644
index 5aed408adc13df509d9e6956bb2a2a846ed3301c..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/ethaddr.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "ethaddr.h"
-
-// Some projects can not use stdio.h.
-#ifndef LABCOMM_NO_STDIO
-  #include <stdio.h>
-#endif
-
-#if ETH_ALEN != 6 
-	#warning "Assumption that ETH_ALEN == 6 appears false. Here be dragons."
-#endif
-
-/* parse a string on the format 00:01:02:0d:0e:0f into a char array
- * the mac_addr argument must be at least six bytes.
- * returns 0 on success, or -1 on error
- */
-int parse_MAC_address(const char *str, struct ether_addr *mac_addr)
-{
-	int res = sscanf(str, "%x:%x:%x:%x:%x:%x", &mac_addr->ether_addr_octet[0], 
-			&mac_addr->ether_addr_octet[1], 
-			&mac_addr->ether_addr_octet[2], 
-			&mac_addr->ether_addr_octet[3], 
-			&mac_addr->ether_addr_octet[4], 
-			&mac_addr->ether_addr_octet[5]);	
-	return (res == 6? 0 : -1);
-
-} 
-
-#if 0
-/* test program */
-int main(int argc, char *argv[])
-{
-	int i;
-	unsigned char a[6];
-	int res = parse_MAC_address(argv[1], a);
-	if(res) {
-		perror("Failed to parse MAC address");
-	}
-	printf("%x.%x.%x.%x.%x.%x\n",  a[0], a[1], a[2], a[3], a[4], a[5]);
-	return 0;
-}
-#endif
diff --git a/lib/c/2014/experimental/ethaddr.h b/lib/c/2014/experimental/ethaddr.h
deleted file mode 100644
index f7aaf29f65ba861a7a693a85523a70736d09505c..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/ethaddr.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef ETHADDR_H
-#define ETHADDR_H
-
-#include <net/ethernet.h>
-
-/* parse a string on the format 00:01:02:0d:0e:0f into a char array
- * the mac_addr argument must be at least six bytes.
- * returns 0 on success, or -1 on error
- */
-int parse_MAC_address(const char *str, struct ether_addr *mac_addr);
-#endif
diff --git a/lib/c/2014/experimental/labcomm_sig_parser.c b/lib/c/2014/experimental/labcomm_sig_parser.c
deleted file mode 100644
index 75e9771e53f0fa85df6577b6aee8ef6707ba7609..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/labcomm_sig_parser.c
+++ /dev/null
@@ -1,917 +0,0 @@
-/* labcomm_sig_parser.c:
- * an example parser for labcomm signatures, illustrating how to skip samples
- * based on their signature. Intended as an embryo for introducing this
- * functionality into the lib to allow a channel to survive types with no
- * registered handler.
- */
-
-
-/* TODO, and notes about strange quirks
- *
- * - the return values for the accept_ functions are not really used anymore
- *   as the parser "peeks" and calls the correct accept function instead.
- *   This should be refactored
- *
- * - The RETURN_STRINGS and where/if to allocate strings is to be decided, it
- *   is currently not used
- *
- * - The dynamic allocation of the parser is not quite dynamic, the sizes are
- *   set through the init function, and are then static.
- *   This should be adapted when allocation is parameterized/user-definable
- *   for the entire lib.
- */
-
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "labcomm_sig_parser.h"
-
-static void error(char *s) {
-	fprintf(stderr, "ERROR: %s", s);
-	fprintf(stderr, "\nexiting\n");
-	exit(1);
-}
-
-/* aux method for reading a big endian uint32 from a char* (i.e. ntohl but for explicit char*) */
-static int unpack32(unsigned char *c, int idx) {
-       int b0=(c[idx]) << 3 ;
-       int b1=(c[idx+1]) << 2 ;
-       int b2=(c[idx+2]) << 1 ;
-       int b3=c[idx+3];
-
-       return  b0 | b1 | b2 | b3;
-}
-
-static inline int get32(labcomm_sig_parser_t *b) {
-       int res = unpack32(b->c, b->idx);
-       b->idx+=4;
-       return res;
-}
-
-
-/* aux method for reading labcomm varint from a char*
-   size is an out parameter: if not NULL the number of bytes read will be written here
-*/
-static int unpack_varint(unsigned char *buf,
-				  int idx,
-				  size_t *size)
-{
-        int res = 0;
-        unsigned int i=0;
-        unsigned char cont = TRUE;
-
-        do {
-                unsigned char c = buf[idx+i];
-                res = (res << 7) | (c & 0x7f);
-                cont = c & 0x80;
-                i++;
-        } while(cont);
-
-	if(size != NULL)
-		*size = i;
-        return res;
-}
-
-void dumpValStack(labcomm_sig_parser_t *b) {
-	printf("=== value stack: ");
-#ifdef DEBUG_STACK_VERBOSE
-	int i;
-	for(i=0; i<STACK_SIZE; i++) { //HERE BE DRAGONS
-		printf("%2.2x ", b->val_stack[i]);
-	}
-#endif
-	printf("    top==%d\n", b->val_top);
-}
-void dumpPtrStack(labcomm_sig_parser_t *b) {
-	printf("=== pointer stack: ");
-#ifdef DEBUG_STACK_VERBOSE
-	int i;
-	for(i=0; i<STACK_SIZE; i++) { //HERE BE DRAGONS
-		printf("%2.2x ", b->ptr_stack[i]);
-	}
-#endif
-	printf("    top==%d\n", b->ptr_top);
-}
-
-void push_val(labcomm_sig_parser_t *b, unsigned int e) {
-	b->val_stack[b->val_top]=e;
-	b->val_top=b->val_top-1;
-	if(b->val_top<0) error("value stack overrun");
-#if defined DEBUG && !defined QUIET_STACK
-	dumpValStack(b);
-#endif
-}
-unsigned int pop_val(labcomm_sig_parser_t *b) {
-	b->val_top=b->val_top+1;
-	if(b->val_top>b->stacksize) error("value stack underrun");
-#if defined DEBUG && !defined QUIET_STACK
-	dumpValStack(b);
-#endif
-	return b->val_stack[b->val_top];
-}
-void push_ptr(labcomm_sig_parser_t *b, void* e) {
-	b->ptr_stack[b->ptr_top]=e;
-	b->ptr_top=b->ptr_top-1;
-	if(b->ptr_top<0) error("pointer stack overrun");
-#ifdef DEBUG
-	dumpPtrStack(b);
-#endif
-}
-void* pop_ptr(labcomm_sig_parser_t *b) {
-	b->ptr_top=b->ptr_top+1;
-	if(b->ptr_top>b->stacksize) error("pointer stack underrun");
-#ifdef DEBUG
-	dumpPtrStack(b);
-#endif
-	return b->ptr_stack[b->ptr_top];
-}
-
-int labcomm_sig_parser_init(labcomm_sig_parser_t *b, size_t buffer_size,
-                            size_t stacksize, size_t num_signatures,
-                            size_t max_name_len, size_t max_sig_len)
-{
-	b->c = malloc(buffer_size);
-	b->capacity = buffer_size;
-	b->size = 0;
-	b->idx = 0;
-
-	b->stacksize = stacksize;
-
-	b->val_stack = calloc(stacksize, sizeof(b->val_stack));
-	b->val_top = stacksize-1;
-
-	b->ptr_stack = calloc(stacksize, sizeof(b->ptr_stack));
-	b->ptr_top = stacksize-1;
-
-	b->max_signatures = num_signatures;
-	b->max_name_len = max_name_len;
-	b->max_sig_len = max_sig_len;
-
-#ifdef STATIC_ALLOCATION
-	printf("warning: labcomm_sig_parser_t_init: size params ignored, using defaults from .h file \n");
-#else
-	b->sig_ts=calloc(num_signatures, sizeof(struct labcomm_signature));
-	b->signatures_length=calloc(num_signatures, sizeof(int));
-	b->signatures_name_length=calloc(num_signatures, sizeof(int));
-	b->signatures_name=calloc(num_signatures, sizeof(void *)); //HERE BE DRAGONS: add range checks
-	b->signatures=calloc(num_signatures, sizeof(void *));
-	int i;
-	for(i = 0; i<num_signatures; i++) {
-		b->signatures[i] = calloc(b->max_sig_len, sizeof(char));
-		b->signatures_name[i] = calloc(b->max_name_len, sizeof(char));
-	}
-#endif
-	return b->c == NULL || b->val_stack == NULL || b->ptr_stack == NULL;
-}
-
-int labcomm_sig_parser_read_file(labcomm_sig_parser_t *b, FILE *f) {
-        int s = fread(b->c, sizeof(char), b->capacity, f);
-        b->size = s;
-        b->idx=0;
-        return s;
-}
-
-int more(labcomm_sig_parser_t *b)
-{
-	return b->idx < b->size;
-}
-
-unsigned char get(labcomm_sig_parser_t *b) {
-	return b->c[b->idx++];
-}
-
-unsigned char peek(labcomm_sig_parser_t *b) {
-	return b->c[b->idx];
-}
-
-void advance(labcomm_sig_parser_t *b) {
-	b->idx++;
-}
-
-void advancen(labcomm_sig_parser_t *b, size_t n) {
-	b->idx+=n;
-}
-
-int peek_varint(labcomm_sig_parser_t *b, size_t *size) {
-        return unpack_varint(b->c, b->idx, size);
-}
-
-int get_varint(labcomm_sig_parser_t *b) {
-        size_t size;
-        int res = peek_varint(b, &size);
-        advancen(b, size);
-        return res;
-}
-int get_varint_size(labcomm_sig_parser_t *b, size_t *size) {
-        unsigned int res = peek_varint(b, size);
-        advancen(b, *size);
-        return res;
-}
-
-void getStr(labcomm_sig_parser_t *b, unsigned char *dest, size_t size) {
-	int rem = b->size - b->idx;
-	if( size > rem )
-		size = rem;
-	strncpy((char *)dest, (char *)&b->c[b->idx], size);
-    dest[size] = 0;
-	b->idx += size;
-}
-
-struct labcomm_signature *get_sig_t(labcomm_sig_parser_t *p, unsigned int uid)
-{
-	return &(p->sig_ts[uid-LABCOMM_USER]);
-}
-
-unsigned int get_signature_len(labcomm_sig_parser_t *p, unsigned int uid){
-	//return signatures_length[uid-LABCOMM_USER];
-	return p->sig_ts[uid-LABCOMM_USER].size;
-}
-unsigned char* get_signature(labcomm_sig_parser_t *p, unsigned int uid){
-	//return signatures[uid-LABCOMM_USER];
-	return p->sig_ts[uid-LABCOMM_USER].signature;
-}
-
-//is this needed?
-//unsigned int get_signature_name_len(labcomm_sig_parser_t *p, unsigned int uid){
-//	return signatures_name_length[uid-LABCOMM_USER];
-//}
-
-char* get_signature_name(labcomm_sig_parser_t *p, unsigned int uid){
-	//return signatures_name[uid-LABCOMM_USER];
-	return p->sig_ts[uid-LABCOMM_USER].name;
-}
-
-void dump_signature(labcomm_sig_parser_t *p, unsigned int uid){
-	int i;
-	unsigned int len = get_signature_len(p, uid);
-	printf("signature for uid %x : %s (len=%d):\n", uid, get_signature_name(p, uid), len);
-	unsigned char* sig = get_signature(p, uid);
-	for(i=0; i<len; i++) {
-		printf("%2.2x ",sig[i]);
-		if( i < len-1 && (i+1)%8==0 ) printf("\n");
-	}
-	printf("\n");
-}
-
-static inline void labcomm_sig_parser_t_set_varsize(labcomm_sig_parser_t *b)
-{
-	b->current_decl_is_varsize = TRUE;
-}
-static size_t labcomm_sizeof_primitive(unsigned int type)
-{
-	switch(type) {
-		case TYPE_BOOLEAN :
-		case TYPE_BYTE :
-			return 1;
-		case TYPE_SHORT :
-			return 2;
-		case TYPE_INTEGER :
-		case TYPE_FLOAT :
-		case TYPE_SAMPLE_REF :
-			return 4;
-		case TYPE_LONG :
-		case TYPE_DOUBLE :
-			return 8;
-		default:
-			printf("labcomm_sizeof_primitive(%x)\n", type);
-		 	error("labcomm_sizeof_primitive should only be called for primitive types");
-            return 0;
-	}
-}
-
-//these are inlined in do_accept_packet
-//static int accept_type_decl(labcomm_sig_parser_t *d);
-//static int accept_sample_decl(labcomm_sig_parser_t *d);
-static int accept_user_id(labcomm_sig_parser_t *d);
-static int accept_string(labcomm_sig_parser_t *d);
-static int accept_type(labcomm_sig_parser_t *d);
-static int accept_array_decl(labcomm_sig_parser_t *d);
-#if 0  
-// UNUSED declarations
-static int accept_string_length(labcomm_sig_parser_t *d);
-static int accept_char(labcomm_sig_parser_t *d);
-static int accept_number_of_indices(labcomm_sig_parser_t *d);
-static int accept_indices(labcomm_sig_parser_t *d);
-static int accept_variable_index(labcomm_sig_parser_t *d);
-static int accept_fixed_index(labcomm_sig_parser_t *d);
-static int accept_number_of_fields(labcomm_sig_parser_t *d);
-#endif
-static int accept_struct_decl(labcomm_sig_parser_t *d);
-static int accept_field(labcomm_sig_parser_t *d);
-static int accept_sample_data(labcomm_sig_parser_t *d);
-
-static unsigned char labcomm_varint_sizeof(unsigned int i)
-{
-	if(i < 128) {
-		return 1;
-	} else {
-		unsigned char res = 1;
-		while (i >>= 7) ++res;
-
-		return res;
-	}
-}
-int encoded_size_static(struct labcomm_signature *sig, void *unused)
-{
-#ifdef LABCOMM_EXPERIMENTAL_CACHED_ENCODED_SIZE
-	if(sig->cached_encoded_size == -1) {
-		error("encoded_size_static called for var_size sample or uninitialized signature");
-	}
-	return sig->cached_encoded_size;
-#else
-	printf("Warning: encoded_size_static currently broken\n");
-	return -1;
-#endif
-}
-
-/* This function probably never will be implemented, as it would be
-   similar to skip_packed_sample_data. And if unregistered variable size
-   samples is to be handled, the proper way is to generate and register
-   a handler. Thus, the most probable use of the encoded_size function
-   on the receiver side, is to skip unhandled samples.
-*/
-
-int encoded_size_parse_sig(struct labcomm_signature *sig, void *sample)
-{
-	printf("Warning: encoded_size_parse_sig not implemented\n");
-	return -1;
-}
-
-static int accept_signature(labcomm_sig_parser_t *d, 
-                            labcomm_type type,
-                            unsigned int start,
-                            unsigned int uid, char *name)
-{
-    get_varint(d); // ignore sig len
-    VERBOSE_PRINTF("\ntype = ");
-    accept_type(d);
-    //printf(" : ");
-    //unsigned int dt = pop(d);
-#ifdef USE_TYPE_AND_SIZE
-    unsigned int type = pop_val(d);
-    unsigned int enc_size = pop_val(d);
-#else
-    pop_val(d); // unsigned int type
-    pop_val(d); // unsigned int enc_size
-#endif
-    if(type != PKG_SAMPLE_DECL) {
-        if(type == PKG_SAMPLE_REF) {
-            INFO_PRINTF("accept_signature: ignoring sample ref\n");
-            return TRUE;
-        } else if (type == PKG_TYPE_DECL) {
-            INFO_PRINTF("accept_signature: ignoring typedef\n");
-            return TRUE;
-        } else {
-            error("decl is neither sample, ref, or typedef???");
-            return FALSE;
-        }
-    }
-    unsigned int end = d->idx;
-    unsigned int len = end-start;
-
-    struct labcomm_signature *newsig = get_sig_t(d, uid);
-//		newsig->type = type;
-    if(len <= d->max_sig_len) {
-        d->signatures_length[uid-LABCOMM_USER] = len;
-        memcpy(d->signatures[uid-LABCOMM_USER], &d->c[start], len);
-        newsig->size = len;
-        newsig->signature = d->signatures[uid-LABCOMM_USER];
-        newsig->name = name;
-    } else {
-        error("sig longer than max length (this ought to be dynamic...)");
-    }
-    VERBOSE_PRINTF("signature for uid %x: %s (start=%x,end=%x,len=%d)\n", uid, get_signature_name(d, uid), start,end, len);
-    INFO_PRINTF("accept_signature: %s\n", newsig->name);
-#ifdef LABCOMM_EXPERIMENTAL_CACHED_ENCODED_SIZE
-    if(! d->current_decl_is_varsize) {
-        newsig->cached_encoded_size = enc_size;
-        newsig->encoded_size = encoded_size_static;
-        INFO_PRINTF(".... is static size = %d\n", enc_size);
-    } else {
-        newsig->cached_encoded_size = -1;
-        newsig->encoded_size = encoded_size_parse_sig;
-        INFO_PRINTF(".... is variable size\n");
-    }
-#endif
-    return TRUE;
-}
-static int accept_decl(labcomm_sig_parser_t *d, labcomm_type type)
-{
-	if(accept_user_id(d)) {
-		unsigned int uid = pop_val(d);
-		unsigned int nstart = d->idx;
-		VERBOSE_PRINTF(", name = ");
-		accept_string(d);
-		unsigned int start = d->idx;
-		unsigned int nlen = pop_val(d);
-#ifdef RETURN_STRINGS
-		char *str = (char *) pop_ptr(d);
-		free(str);
-#endif
-		unsigned char lenlen = labcomm_varint_sizeof(nlen);
-
-        if(type != PKG_SAMPLE_DECL) {
-            // don't record typedefs and samplerefs (for now)
-            // to avoid number clashes with sample defs
-            // in the parser struct 
-            return accept_signature(d, type, start, uid, (char *) &d->c[nstart+lenlen]);
-        }
-		if(nlen < d->max_name_len) { // leave 1 byte for terminating NULL
-            char *name;
-			d->signatures_name_length[uid-LABCOMM_USER] = nlen;
-			memcpy(d->signatures_name[uid-LABCOMM_USER], &d->c[nstart+lenlen], nlen);
-			d->signatures_name[uid-LABCOMM_USER][nlen]=0;
-			name = d->signatures_name[uid-LABCOMM_USER];
-            return accept_signature(d, type, start, uid, name);
-		} else {
-			error("sig name longer than max length (this ought to be dynamic...");
-            return FALSE;
-		}
-	} else {
-		error("sample_decl with uid < LABCOMM_USER");
-		return FALSE;
-	}
-}
-
-// HERE BE DRAGONS! what does the return value mean?
-int accept_packet(labcomm_sig_parser_t *d) {
-        size_t nbytes;
-        unsigned int type = peek_varint(d, &nbytes) ;
-    if(type == PKG_VERSION ) {
-		advancen(d, nbytes);//consume type field
-        get_varint(d); //ignore length field
-		VERBOSE_PRINTF("got version.\n");
-        accept_string(d);
-	    pop_val(d); // ignore length, for now
-#ifdef RETURN_STRINGS
-            char *str = (char *) pop_ptr(d);
-            free(str);
-#endif
-	} else if (type == PKG_SAMPLE_DECL) {
-		d->current_decl_is_varsize = FALSE; // <-- a conveniance flag in labcomm_sig_parser_t
-		advancen(d, nbytes);
-		VERBOSE_PRINTF("sample_decl ");
-        get_varint(d); //ignore length field
-		accept_decl(d, type);
-	} else if (type == PKG_SAMPLE_REF) {
-		d->current_decl_is_varsize = FALSE; // <-- a conveniance flag in labcomm_sig_parser_t
-		advancen(d, nbytes);
-		VERBOSE_PRINTF("sample_ref ");
-        get_varint(d); //ignore length field
-		accept_decl(d, type);
-    }else if(type == PKG_TYPE_DECL ) {
-		d->current_decl_is_varsize = FALSE; // <-- a conveniance flag in labcomm_sig_parser_t
-		advancen(d, nbytes);//consume type field
-		VERBOSE_PRINTF("type_decl ");
-        get_varint(d); //ignore length field
-		accept_decl(d, type);
-	} else if (type == PKG_TYPE_BINDING) {
-		VERBOSE_PRINTF("type_binding ");
-		advancen(d, nbytes);
-        get_varint(d); //ignore length field
-#ifdef VERBOSE        
-        int sid = 
-#endif            
-            get_varint(d); //ignore sample id field
-#ifdef VERBOSE        
-        int tid =
-#endif            
-            get_varint(d); //ignore type id field
-		VERBOSE_PRINTF("sid=0x%x, tid=0x%x\n ", sid, tid);
-	} else if(type >= LABCOMM_USER) {
-#ifdef EXIT_WHEN_RECEIVING_DATA
-		printf("*** got sample data, exiting\n");
-		exit(0);
-#else
-		accept_sample_data(d);
-#endif
-	} else {
-#ifdef EXIT_ON_UNKNOWN_TAG
-        error("got unknown type (<LABCOMM_USER)");
-		exit(1);
-#else
-        int len = get_varint(d); // length field
-        printf("got unknown tag: 0x%x, skipping %d bytes\n",type, len);
-        advancen(d, len);
-#endif
-	}
-    return TRUE;
-}
-
-static int accept_user_id(labcomm_sig_parser_t *d){
-    size_t nbytes;
-	int uid = peek_varint(d, &nbytes);
-	if(uid >= LABCOMM_USER) {
-		advancen(d, nbytes);
-		VERBOSE_PRINTF("uid = 0x%x ", uid);
-		push_val(d, uid);
-		return TRUE;
-	} else {
-        error("uid < LABCOMM_USER");
-		return FALSE;
-	}
-}
-
-static int accept_string(labcomm_sig_parser_t *d){
-	unsigned int len = get_varint(d);
-	unsigned char *str=malloc(len+1); // len is without terminating null
-	getStr(d, str, len);
-	VERBOSE_PRINTF("%s", str);
-#ifdef RETURN_STRINGS
-	push_ptr(d, str);
-#else
-	free(str);
-#endif
-	push_val(d, len);
-	return TRUE;
-}
-/* pushes size and type id */
-static int accept_type(labcomm_sig_parser_t *d){
-	size_t nbytes;
-        unsigned int type = peek_varint(d, &nbytes) ;
-	switch(type) {
-		case TYPE_BOOLEAN :
-			VERBOSE_PRINTF("boolean\n");
-			advancen(d, nbytes);
-			push_val(d, 1);
-			break;
-		case TYPE_BYTE :
-			VERBOSE_PRINTF("byte\n");
-			advancen(d, nbytes);
-			push_val(d,  1);
-			break;
-		case TYPE_SHORT :
-			VERBOSE_PRINTF("short\n");
-			advancen(d, nbytes);
-			push_val(d,  2);
-			break;
-		case TYPE_INTEGER :
-			VERBOSE_PRINTF("integer\n");
-			advancen(d, nbytes);
-			push_val(d,  4);
-			break;
-		case TYPE_LONG :
-			VERBOSE_PRINTF("long\n");
-			advancen(d, nbytes);
-			push_val(d,  8);
-			break;
-		case TYPE_FLOAT :
-			VERBOSE_PRINTF("float\n");
-			advancen(d, nbytes);
-			push_val(d,  4);
-			break;
-		case TYPE_DOUBLE :
-			VERBOSE_PRINTF("double\n");
-			advancen(d, nbytes);
-			push_val(d,  8);
-			break;
-		case TYPE_STRING :
-			VERBOSE_PRINTF("string\n");
-			advancen(d, nbytes);
-			labcomm_sig_parser_t_set_varsize(d);
-			push_val(d, 0);
-			break;
-		case TYPE_SAMPLE_REF :
-			VERBOSE_PRINTF("sample\n");
-			advancen(d, nbytes);
-			push_val(d,  4);
-			break;
-		case ARRAY_DECL :
-			accept_array_decl(d);
-			pop_val(d); // ignore element type
-			// push(d, pop(d) is a NOP --> leave size on stack
-			break;
-		case STRUCT_DECL :
-			accept_struct_decl(d);
-			// push(d, pop(d) is a NOP --> leave size on stack
-			break;
-		default :
-            //should we distinguish between SAMPLE_DEF and TYPE_DEF here?
-			//printf("accept_type default (type==%x) should not happen\n", type);
-			VERBOSE_PRINTF("user type 0x%x\n",type);
-			advancen(d, nbytes);
-			push_val(d, 0);
-			push_val(d, type);
-			return FALSE;
-	}
-	push_val(d, type);
-	return TRUE;
-}
-
-/* pushes size and element type */
-static int accept_array_decl(labcomm_sig_parser_t *d){
-        size_t nbytes;
-        int tid = peek_varint(d, &nbytes) ;
-	if(tid == ARRAY_DECL) {
-		advancen(d, nbytes);
-		unsigned int nidx = get_varint(d);
-		VERBOSE_PRINTF("%d dim array", nidx);
-		int i;
-		unsigned int numVar=0;
-		unsigned int size=1;
-		for(i=0; i<nidx; i++) {
-			unsigned int idx = get_varint(d);
-			if(idx == 0) {
-				numVar++;
-				VERBOSE_PRINTF("[_] ");
-				labcomm_sig_parser_t_set_varsize(d);
-			} else {
-				VERBOSE_PRINTF("[%d] ", idx);
-				size*=idx;
-			}
-		}
-		VERBOSE_PRINTF(" of ");
-		accept_type(d);
-		unsigned int et= pop_val(d);  // type
-		unsigned int es= pop_val(d);  // (encoded) size
-#ifdef DEBUG
-		printf("accept_array_decl: et = %x\n", et);
-#endif
-		if(numVar == 0) {
-#ifdef DEBUG
-			printf("size=%d, es=%d\n", size, es);
-#endif
-			push_val(d,  (size*es));
-		} else {
-//HERE BE DRAGONS! push a (non-) size for variable size arrays?
-			push_val(d, 0);
-		}
-		push_val(d, et);
-		return TRUE;
-	} else {
-		printf("accept_array_decl: type=%x, should not happen\n",tid);
-		push_val(d, 0);
-		push_val(d, tid);
-		return FALSE;
-	}
-}
-
-/* pushes size */
-static int accept_struct_decl(labcomm_sig_parser_t *d){
-	size_t nbytes;
-        int tid = peek_varint(d, &nbytes) ;
-	if(tid == STRUCT_DECL) {
-		advancen(d, nbytes);
-		unsigned int nf = get_varint(d);
-        if(nf == 0) {
-            VERBOSE_PRINTF("void\n");
-        } else {
-            VERBOSE_PRINTF("%d field struct:\n", nf);
-        }
-		int i;
-#ifdef USE_UNUSED_VARS
-		int numVar=0;
-		int size=0;
-#endif
-		unsigned int fieldsizes=0;
-		for(i=0; i<nf; i++) {
-			accept_field(d);
-			fieldsizes += pop_val(d);
-		}
-		push_val(d, fieldsizes);
-		return TRUE;
-	} else {
-		printf("accept_struct_decl: type=%x, should not happen\n",tid);
-		push_val(d, 0);
-		return FALSE;
-	}
-}
-
-/* pushes field size */
-static int accept_field(labcomm_sig_parser_t *d){
-	VERBOSE_PRINTF("\tfield name: ");
-	accept_string(d);
-	pop_val(d); // ignore length, for now
-#ifdef RETURN_STRINGS
-		char *str = (char *) pop_ptr(d);
-		free(str);
-#endif
-	VERBOSE_PRINTF("\n\ttype: ");
-	accept_type(d);
-	pop_val(d); // ignore type, for now
-	// push(pop() is really a NOP , leave size on the stack when debugging done
-	VERBOSE_PRINTF("\n");
-	return TRUE;
-}
-static int accept_sample_data(labcomm_sig_parser_t *d){
-	accept_user_id(d);
-	unsigned int uid = pop_val(d);
-	printf("sample data... uid=0x%x\n", uid);
-    int len = get_varint(d); //length field
-#ifdef DEBUG
-	dump_signature(d, uid);
-#endif
-#ifdef SKIP_BY_PARSING
-	struct labcomm_signature *sigt = get_sig_t(d, uid);
-	int encoded_size = sigt->encoded_size(NULL);
-	INFO_PRINTF("encoded_size from sig: %d\n", encoded_size);
-	struct labcomm_signature *sig = get_sig_t(d, uid);
-	skip_packed_sample_data(d, sig);
-#else
-	advancen(d, len);
-#endif
-	return TRUE;
-}
-
-static int skip_type(unsigned int,labcomm_sig_parser_t*,unsigned char*,unsigned int,int*) ;
-
-static int skip_array(labcomm_sig_parser_t *d, unsigned char *sig, int len, int *pos) {
-	unsigned int skip = 0;
-	unsigned int tot_nbr_elem_tmp = 1;
-	size_t nbytes;
-	unsigned int nIdx = unpack_varint(sig, *pos, &nbytes);
-	VERBOSE_PRINTF("skip_array: nIdx = %d (from sig)\n", nIdx);
-	*pos +=nbytes;
-	unsigned int idx[nIdx];
-	unsigned int nVar=0;
-
-	unsigned int i;
-
-	for(i=0; i<nIdx; i++) {
-		idx[i] = unpack_varint(sig, *pos, &nbytes);
-		*pos += nbytes;
-		VERBOSE_PRINTF("skip_array: idx[%d]=%d (from sig)\n", i, idx[i]);
-		if(idx[i] == 0) {
-			nVar++;
-		} else {
-			tot_nbr_elem_tmp *= idx[i];
-		}
-	}
-	int var[nVar];
-
-	unsigned char varSize=0; // total number of bytes required for var size fields
-	for(i=0; i<nVar; i++) {
-		var[i] = get_varint_size(d, &nbytes);
-		varSize += nbytes;
-		VERBOSE_PRINTF("skip_array: var[%d]=%d (from sample)\n", i, var[i]);
-		tot_nbr_elem_tmp *= var[i];
-	}
-
-	int type = unpack_varint(sig, *pos, &nbytes);
-	*pos+=nbytes;
-
-	unsigned int elemSize = labcomm_sizeof_primitive(type);
-
-	skip = elemSize * tot_nbr_elem_tmp;
-
-	VERBOSE_PRINTF("skip_array: skip: %d * %d = %d\n", tot_nbr_elem_tmp, elemSize ,skip);
-
-	advancen(d, skip);
-
-	//return skip + 4*nVar;
-	return skip + varSize;
-}
-
-int skip_struct(labcomm_sig_parser_t *d, unsigned char *sig, unsigned int len, int *pos) {
-	size_t nbytes;
-	int nFields = unpack_varint(sig,*pos, &nbytes);
-	*pos += nbytes;
-	unsigned int i;
-	unsigned int skipped=0;
-	VERBOSE_PRINTF("skip_struct (%d fields)\n", nFields);
-	for(i=0; i<nFields; i++) {
-		//skip name
-		unsigned int namelen = unpack_varint(sig, *pos, &nbytes);
-#ifdef DEBUG
-		VERBOSE_PRINTF("field #%d:\n----namelen==%d\n",i,namelen);
-		char name[namelen+1]; //HERE BE DRAGONS. alloca?
-		strncpy(name, (const char *)sig+*pos+nbytes, namelen);
-		name[namelen]=0;
-		VERBOSE_PRINTF("----name = %s\n",name);
-#endif
-		*pos += (nbytes+namelen); // 32bit len + actual string
-
-		unsigned int type = unpack_varint(sig, *pos, &nbytes);
-		*pos += nbytes;
-#ifdef DEBUG
-		VERBOSE_PRINTF("----type == %x\n", type);
-#endif
-		skipped += skip_type(type, d, sig, len, pos);
-	}
-	return skipped;
-}
-#ifndef QUIET
-/* print and skip */
-int skip_type(unsigned int type, labcomm_sig_parser_t *d,
-		unsigned char *sig, unsigned int len, int *pos)
-{
-	int skipped=0;
-	printf("skip_type %x:", type);
-	switch(type) {
-		case TYPE_BOOLEAN :
-			printf("boolean [%d]\n", get(d));
-			skipped++;
-			break;
-		case TYPE_BYTE :
-			printf("byte [%d]\n", get(d));
-			skipped++;
-			break;
-		case TYPE_SHORT :
-			//XXX not supported
-			advancen(d,2);
-			skipped+=2;
-			break;
-		case TYPE_INTEGER :
-			printf("integer [%d]\n", get32(d));
-			skipped +=4;
-			break;
-		case TYPE_FLOAT :
-			//XXX not supported
-			advancen(d,4);
-			skipped+=4;
-			break;
-		case TYPE_LONG :
-		case TYPE_DOUBLE :
-			//XXX not supported
-			advancen(d,8);
-			skipped+=8;
-			break;
-		case TYPE_STRING :
-			{
-			size_t nbytes;
-			int len = get_varint_size(d, &nbytes);
-			int i;
-			printf("string [");
-			for(i=0; i<len; i++)
-				printf("%c", get(d));
-			printf("]\n");
-			skipped+=len+nbytes;
-			break;}
-		case ARRAY_DECL :
-			printf("array\n");
-			skipped += skip_array(d, sig, len, pos);
-			break;
-		case STRUCT_DECL :
-			printf("struct\n");
-			skipped += skip_struct(d, sig, len, pos);
-			break;
-		default:
-			printf("ERROR: skip_type: type = %x\n", type);
-			exit(1);
-	}
-	return skipped;
-}
-#else
-int skip_type(unsigned int type, labcomm_sig_parser_t *d,
-		const char *sig, unsigned int len, int *pos)
-{
-	int skipped=0;
-	VERBOSE_PRINTF("skip_type %x\n", type);
-	switch(type) {
-		case TYPE_BOOLEAN :
-		case TYPE_BYTE :
-			advancen(d,1);
-			skipped++;
-			break;
-		case TYPE_SHORT :
-			advancen(d,2);
-			skipped+=2;
-			break;
-		case TYPE_INTEGER :
-		case TYPE_FLOAT :
-			advancen(d,4);
-			skipped+=4;
-			break;
-		case TYPE_LONG :
-		case TYPE_DOUBLE :
-			advancen(d,8);
-			skipped+=8;
-			break;
-		case TYPE_STRING :
-			{
-			size_t nbytes;
-			int len = get_varint_size(d, &nbytes);
-			advancen(d,len);
-			skipped+=len+nbytes;
-			break;}
-		case ARRAY_DECL :
-			skipped += skip_array(d, sig, len, pos);
-			break;
-		case STRUCT_DECL :
-			skipped += skip_struct(d, sig, len, pos);
-			break;
-		default:
-			printf("ERROR: skip_type: type = %x\n", type);
-			exit(1);
-	}
-	return skipped;
-}
-#endif
-
-/* parse signature and skip the corresponding bytes in the labcomm_sig_parser_t
- */
-int skip_packed_sample_data(labcomm_sig_parser_t *d, struct labcomm_signature *sig) {
-	int pos = 0; 		//current position in signature
-	unsigned int skipped = 0;	//skipped byte counter
-	while(pos < sig->size) {
-		size_t nbytes;
-		int type = unpack_varint(sig->signature,pos, &nbytes);
-		pos+=nbytes;
-		skipped += skip_type(type, d, sig->signature, sig->size, &pos);
-	}
-	printf("skipped %d bytes\n", skipped);
-	return TRUE;
-}
diff --git a/lib/c/2014/experimental/labcomm_sig_parser.h b/lib/c/2014/experimental/labcomm_sig_parser.h
deleted file mode 100644
index 46a1d1e41ba7e68379437f2e3b3bdd1f563b0b4c..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/labcomm_sig_parser.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* labcomm_sig_parser.h:
- * an example parser for labcomm signatures, illustrating how to skip samples
- * based on their signature. Intended as an embryo for introducing this 
- * functionality into the lib to allow a channel to survive types with no
- * registered handler.
- */
-
-#ifndef LABCOMM_SIG_PARSER_H
-#define LABCOMM_SIG_PARSER_H
-
-#include "../labcomm.h"
-#include "../labcomm_private.h"
-
-#define DEBUG 
-#define QUIET_STACK	   // don't print anything for push/pop
-#undef DEBUG_STACK_VERBOSE // dump stack, otherwise just print value of top
-
-#undef QUIET 		//just print type and size when skipping data
-#define VERBOSE 		// print in great detail
-
-
-#undef SKIP_BY_PARSING
-
-#undef STATIC_ALLOCATION  //dynamic allocation not completely implemented
-
-#ifdef STATIC_ALLOCATION
-
-#define MAX_SIGNATURES 16
-#define MAX_NAME_LEN 32 
-#define MAX_SIG_LEN 128
-#define TYPEDEF_BASE MAX_SIGNATURES
-
-#endif
-
-/* internal type: stack &c. for the parser */
-typedef struct {
-        unsigned char* c;
-        size_t size;
-        size_t capacity;
-        int idx;
-        int val_top;
-        int * val_stack;
-        int ptr_top;
-        void** ptr_stack;
-        size_t stacksize;
-        int current_decl_is_varsize;
-
-	size_t max_signatures;                 // set by init(...)
-	size_t max_name_len;
-	size_t max_sig_len; 
-    // arrays for signatures and typedefs
-    // signatures start at index 0
-    // typedefs start at index MAX_SIGNATURES
-#ifdef STATIC_ALLOCATION
-	struct labcomm_signature sig_ts[2*MAX_SIGNATURES];
-
-	unsigned int signatures_length[2*MAX_SIGNATURES];
-	unsigned int signatures_name_length[2*MAX_SIGNATURES];
-	unsigned char signatures_name[2*MAX_SIGNATURES][MAX_NAME_LEN]; 
-	unsigned char signatures[2*MAX_SIGNATURES][MAX_SIG_LEN];
-#else
-	struct labcomm_signature *sig_ts;           // [2*MAX_SIGNATURES]
-
-	unsigned int *signatures_length;       // [2*MAX_SIGNATURES]
-	unsigned char **signatures;            // [2*MAX_SIGNATURES][MAX_SIG_LEN];
-
-	unsigned int *signatures_name_length;  // [2*MAX_SIGNATURES]
-	char **signatures_name;       // [2*MAX_SIGNATURES][MAX_NAME_LEN];
-#endif
-
-} labcomm_sig_parser_t;
-
-
-int labcomm_sig_parser_init(labcomm_sig_parser_t *p, size_t size, 
-                            size_t stacksize, size_t max_num_signatures, 
-                            size_t max_name_len, size_t max_sig_len);
-int labcomm_sig_parser_read_file(labcomm_sig_parser_t *p, FILE *f);
-
-int accept_packet(labcomm_sig_parser_t *p);
-
-struct labcomm_signature *get_sig_t(labcomm_sig_parser_t *p,unsigned int uid);
-
-unsigned int get_signature_len(labcomm_sig_parser_t *p,unsigned int uid);
-char* get_signature_name(labcomm_sig_parser_t *p,unsigned int uid);
-unsigned char* get_signature(labcomm_sig_parser_t *p,unsigned int uid);
-void dump_signature(labcomm_sig_parser_t *p,unsigned int uid);
-
-
-int more(labcomm_sig_parser_t *b);
-
-
-/* parse signature and skip the corresponding bytes in the labcomm_sig_parser 
- */
-int skip_packed_sample_data(labcomm_sig_parser_t *p, struct labcomm_signature *sig);
-
-#ifdef QUIET
-#define INFO_PRINTF(format, args...)  
-#undef VERBOSE
-#else
-#define INFO_PRINTF(format, args...)  \
-      printf (format , ## args)
-#endif
-
-#ifdef VERBOSE
-#define VERBOSE_PRINTF(format, args...)  \
-      printf (format , ## args)
-#else
-#define VERBOSE_PRINTF(format, args...)  
-#endif
-
-#undef EXIT_WHEN_RECEIVING_DATA 
-
-#undef RETURN_STRINGS  //  not really tested
-
-typedef enum{
-        PKG_VERSION = LABCOMM_VERSION,
-        PKG_SAMPLE_DECL = LABCOMM_SAMPLE_DEF,
-        PKG_SAMPLE_REF = LABCOMM_SAMPLE_REF,
-        PKG_TYPE_DECL = LABCOMM_TYPE_DEF,
-        PKG_TYPE_BINDING = LABCOMM_TYPE_BINDING,
-
-        ARRAY_DECL = LABCOMM_ARRAY,
-        STRUCT_DECL = LABCOMM_STRUCT,
-
-        TYPE_BOOLEAN  = LABCOMM_BOOLEAN,
-        TYPE_BYTE  = LABCOMM_BYTE,
-        TYPE_SHORT  = LABCOMM_SHORT,
-        TYPE_INTEGER  = LABCOMM_INT,
-        TYPE_LONG  = LABCOMM_LONG,
-        TYPE_FLOAT  = LABCOMM_FLOAT,
-        TYPE_DOUBLE  = LABCOMM_DOUBLE,
-        TYPE_STRING  = LABCOMM_STRING,
-        TYPE_SAMPLE_REF  = LABCOMM_REF
-} labcomm_type ;
-#endif
diff --git a/lib/c/2014/experimental/labcomm_thr_reader_writer.c b/lib/c/2014/experimental/labcomm_thr_reader_writer.c
deleted file mode 100644
index 10cedeec441003fc0f2f8f22997a1f40adeaeeb1..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/labcomm_thr_reader_writer.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include <errno.h>
-#include <unistd.h>
-#include "labcomm.h"
-#include "ThrottleDrv/throttle_drv.h"
-
-#define BUFFER_SIZE 2048
-
-int labcomm_thr_reader(labcomm_reader_t *r, labcomm_reader_action_t action)
-{
-  int result = -EINVAL;
-  struct thr_chn_t *ctx = r->context;
-
-  switch (action)
-  {
-    case labcomm_reader_alloc:
-    {
-      r->data = malloc(BUFFER_SIZE);
-      if (r->data)
-      {
-        r->data_size = BUFFER_SIZE;
-        result = r->data_size;
-      }
-      else
-      {
-        r->data_size = 0;
-        result = -ENOMEM;
-      }
-      r->count = 0;
-      r->pos = 0;
-    }
-    break;
-
-    case labcomm_reader_start:
-    case labcomm_reader_continue:
-    {
-      if (r->pos < r->count)
-      {
-        result = r->count - r->pos;
-      }
-      else
-      {
-        int err;
-        r->pos = 0;
-        err = thr_read(ctx, r->data, r->data_size);
-        if (err <= 0)
-        {
-          r->count = 0;
-          result = -1;
-        } else
-        {
-          r->count = err;
-          result = r->count - r->pos;
-        }
-      }
-    }
-    break;
-
-    case labcomm_reader_end:
-    {
-      result = 0;
-    }
-    break;
-
-    case labcomm_reader_free:
-    {
-      free(r->data);
-      r->data = 0;
-      r->data_size = 0;
-      r->count = 0;
-      r->pos = 0;
-      result = 0;
-    }
-    break;
-  }
-  return result;
-}
-
-int labcomm_thr_writer(labcomm_writer_t *w, labcomm_writer_action_t action)
-{
-  int result = 0;
-  struct thr_chn_t *ctx = w->context;
-
-  switch (action)
-  {
-    case labcomm_writer_alloc:
-    {
-      w->data = malloc(BUFFER_SIZE);
-      if (! w->data)
-      {
-        result = -ENOMEM;
-        w->data_size = 0;
-        w->count = 0;
-        w->pos = 0;
-      }
-      else
-      {
-        w->data_size = BUFFER_SIZE;
-        w->count = BUFFER_SIZE;
-        w->pos = 0;
-      }
-    } break;
-    case labcomm_writer_free:
-    {
-      free(w->data);
-      w->data = 0;
-      w->data_size = 0;
-      w->count = 0;
-      w->pos = 0;
-    }
-    break;
-
-    case labcomm_writer_start:
-    {
-      w->pos = 0;
-    }
-    break;
-
-    case labcomm_writer_continue:
-    {
-      result = thr_send(ctx, w->data, w->pos);
-      w->pos = 0;
-    }
-    break;
-
-    case labcomm_writer_end:
-    {
-      result = thr_send(ctx, w->data, w->pos);
-      w->pos = 0;
-    }
-    break;
-
-    case labcomm_writer_available:
-    {
-      result = w->count - w->pos;
-    }
-    break;
-  }
-  return result;
-}
diff --git a/lib/c/2014/experimental/labcomm_thr_reader_writer.h b/lib/c/2014/experimental/labcomm_thr_reader_writer.h
deleted file mode 100644
index 0adf36ec1f3c2ed4015bccb7d6d98a0694da914a..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/labcomm_thr_reader_writer.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "labcomm.h"
-
-extern int labcomm_thr_reader(labcomm_reader_t *r, labcomm_reader_action_t action);
-
-extern int labcomm_thr_writer(labcomm_writer_t *r, labcomm_writer_action_t action);
diff --git a/lib/c/2014/experimental/labcomm_udp_reader_writer.c b/lib/c/2014/experimental/labcomm_udp_reader_writer.c
deleted file mode 100644
index f17921135bcc87af40fe86e05ffbe619714e9ad6..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/labcomm_udp_reader_writer.c
+++ /dev/null
@@ -1,105 +0,0 @@
-#include <errno.h>
-#include <unistd.h>
-#include "labcomm.h"
-#include "udp_hack.h"
-
-#define BUFFER_SIZE 2048
-
-int labcomm_udp_reader(
-  labcomm_reader_t *r, 
-  labcomm_reader_action_t action)
-{
-  int result = -EINVAL;
-  server_context_t *ctx = r->context;
-  
-  switch (action) {
-    case labcomm_reader_alloc: {
-      r->data = malloc(BUFFER_SIZE);
-      if (r->data) {
-        r->data_size = BUFFER_SIZE;
-        result = r->data_size;
-      } else {
-        r->data_size = 0;
-        result = -ENOMEM;
-      }
-      r->count = 0;
-      r->pos = 0;
-    } break;
-    case labcomm_reader_start: 
-    case labcomm_reader_continue: {
-      if (r->pos < r->count) {
-        result = r->count - r->pos;
-      } else {
-	int err;
-        r->pos = 0;
-        err=udp_recv(ctx, r->data, r->data_size);
-        if (err <= 0) {
-          r->count = 0;
-          result = -1;
-        } else {
-          r->count = err;
-          result = r->count - r->pos;
-        }
-      }
-    } break;
-    case labcomm_reader_end: {
-      result = 0;
-    } break;
-    case labcomm_reader_free: {
-      free(r->data);
-      r->data = 0;
-      r->data_size = 0;
-      r->count = 0;
-      r->pos = 0;
-      result = 0;
-    } break;
-  }
-  return result;
-}
-
-int labcomm_udp_writer(
-  labcomm_writer_t *w, 
-  labcomm_writer_action_t action)
-{
-  int result = 0;
-  //int *fd = w->context;
-  server_context_t *ctx = w->context;
-
-  switch (action) {
-    case labcomm_writer_alloc: {
-      w->data = malloc(BUFFER_SIZE);
-      if (! w->data) {
-        result = -ENOMEM;
-        w->data_size = 0;
-        w->count = 0;
-        w->pos = 0;
-      } else {
-        w->data_size = BUFFER_SIZE;
-        w->count = BUFFER_SIZE;
-        w->pos = 0;
-      }
-    } break;
-    case labcomm_writer_free: {
-      free(w->data);
-      w->data = 0;
-      w->data_size = 0;
-      w->count = 0;
-      w->pos = 0;
-    } break;
-    case labcomm_writer_start: {
-      w->pos = 0;
-    } break;
-    case labcomm_writer_continue: {
-      result = udp_send(ctx, w->data, w->pos);
-      w->pos = 0;
-    } break;
-    case labcomm_writer_end: {
-      result = udp_send(ctx, w->data, w->pos);
-      w->pos = 0;
-    } break;
-    case labcomm_writer_available: {
-      result = w->count - w->pos; 
-    } break;
-  }
-  return result;
-}
diff --git a/lib/c/2014/experimental/labcomm_udp_reader_writer.h b/lib/c/2014/experimental/labcomm_udp_reader_writer.h
deleted file mode 100644
index c4a6a6bb67680da263849c1738e38f357177271d..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/labcomm_udp_reader_writer.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "labcomm.h"
-
-extern int labcomm_udp_reader(
-  labcomm_reader_t *r, 
-  labcomm_reader_action_t action);
-
-extern int labcomm_udp_writer(
-  labcomm_writer_t *r, 
-  labcomm_writer_action_t action);
diff --git a/lib/c/2014/experimental/pack.c b/lib/c/2014/experimental/pack.c
deleted file mode 100644
index 06636e399bbb1b036aa4f26c5d6b41425f7cf314..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/pack.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <stdio.h>
-
-typedef unsigned int number;
-
-unsigned char do_pack(unsigned char *buf, number i) 
-{
-	printf("do_pack %lu == %lx\n", i, i);
-
-	number tmp = i;
-	unsigned char res = 0;
-
-	while ( tmp >= 0x80 ) {
-		buf[res] = (tmp & 0x7f) | 0x80;
-	        tmp >>= 7;
-		res++;
-	}
-	buf[res] = tmp;
-	return res+1;
-}
-
-number do_unpack(unsigned char *buf) 
-{
-	number res=0;
-	unsigned char i=0;
-	unsigned char cont=1;
-	do {
-		unsigned char c = buf[i];
-		res |= (c & 0x7f) << 7*i; 
-		cont = c & 0x80;
-		i++;
-	} while(cont);
-
-	return res;
-}
-
-void print_packed(unsigned char *buf, unsigned char len)
-{
-	int i;
-	
-	for(i=0; i<len;i++) {
-		printf("%2x   ", buf[i]);
-	}
-	printf("\n");
-}
-
-int main()
-{
-	unsigned char buf[10];
-	unsigned char len;
-
-	len = do_pack(buf, 10);
-	print_packed(buf, len);
-	printf("... unpacks to %u\n\n", do_unpack(buf));
-
-	len = do_pack(buf, 100);
-	print_packed(buf, len);
-	printf("... unpacks to %u\n\n", do_unpack(buf));
-
-	len = do_pack(buf, 1000);
-	print_packed(buf, len);
-	printf("... unpacks to %u\n\n", do_unpack(buf));
-
-	len = do_pack(buf, 100000);
-	print_packed(buf, len);
-	printf("... unpacks to %u\n\n", do_unpack(buf));
-
-	len = do_pack(buf, 2345678901);
-	print_packed(buf, len);
-	printf("... unpacks to %u\n\n", do_unpack(buf));
-
-	len = do_pack(buf, 0xffffffff);
-	print_packed(buf, len);
-	printf("... unpacks to %lx\n", do_unpack(buf));
-
-	return 0;
-}
diff --git a/lib/c/2014/experimental/test_sig_parser.c b/lib/c/2014/experimental/test_sig_parser.c
deleted file mode 100644
index d6bf5baead263cd39759c14f1b08b052b6e60371..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/test_sig_parser.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* labcomm_sig_parser.c:
- * a main program for the example labcomm signatures parser
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "labcomm_sig_parser.h"
-
-#define DEBUG_READ
-
-#define BUF_SIZE 1024
-#define STACK_SIZE 16
-#define MAX_NUM_SIGNATURES 10
-#define MAX_SIGNATURES 16
-#define MAX_NAME_LEN 32
-#define MAX_SIG_LEN 128
-
-void test_read(labcomm_sig_parser_t *p) {
-	int r = labcomm_sig_parser_read_file(p, stdin);
-#ifdef DEBUG_READ
-	printf("read %d bytes:\n\n", r);
-	int i;
-	for(i=0; i<r; i++) {
-		printf("%x ", p->c[i]);
-		if(i%8 == 7) printf("\n");
-	}
-	printf("\n");
-#endif
-}
-int main() {
-	labcomm_sig_parser_t p;
-
-	if(labcomm_sig_parser_init(&p, BUF_SIZE, STACK_SIZE, 
-                                   MAX_NUM_SIGNATURES, MAX_NAME_LEN, MAX_SIG_LEN) ) {
-		printf("failed to init buffer\n");
-		exit(1);
-	}
-	test_read(&p);
-	do{
-		printf("--------------------------------------------- new packet: \n");
-	} while(more(&p) && accept_packet(&p)); 
-	printf("EOF\n");
-}
-
diff --git a/lib/c/2014/experimental/throttlenet/throttlenet.lc b/lib/c/2014/experimental/throttlenet/throttlenet.lc
deleted file mode 100644
index e747d074120dabb29379b8e5d734a939df8d2923..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/throttlenet/throttlenet.lc
+++ /dev/null
@@ -1,75 +0,0 @@
-typedef long number_t; // placeholder for protocol buffers like encoding
-typedef byte eth_addr[6];
-
-// *** Service registration,  lookup, and channel allocation
-
-typedef struct { 
-	string creatorId;
-	string svcId;
-	int version;		//unique
-	string versionName;	//human readable
-} serviceID; // Should probably be a PalCom[_]like struct
-
-typedef struct {
-	string key;
-	byte value[_];
-} property_t; // used for type info, grounding, etc.
-
-typedef struct {
-	string name;
-	property_t properties[_];
-} param_t;
-
-typedef struct {
-	string name;
-	property_t properties[_];
-	param_t params[_];
-} command_t;
-
-typedef struct {
-	serviceID svcID;
-	string   name;
-        command_t commands[_];
-	byte data_description[_];
-} serviceDescription; // d:o PalCom
-
-typedef struct {
-	eth_addr device; // or more generic, as in PalCom?
-	serviceID svcID;
-	number_t  instanceID;
-	string instance_name;
-} service_instance;
-
-sample struct {
-	service_instance svc;
-	number_t chnID;   // the channel to use for connecting to the service
-} service_register;
-
-sample boolean ack;
-
-sample struct {
-	short dummy;
-} services_query;
-
-sample struct {
-	service_instance svcs[_];
-} services_list;
-
-sample struct {
-	service_instance svc;
-	number_t bytes_per_period;
-	number_t period_time; //microseconds
-	// importance?
-} service_allocate_channel; // client [_]> GlobeThrottle to request connection
-
-sample struct {
-	number_t chnId;
-	eth_addr remote_device;	
-	number_t remote_chnId; 
-} service_channel_open; // sent as response to service_allocate_channel (sent to both sides)
-
-sample struct {
-	short max_utilization; // in percent
-	// min period?
-} service_channel_NACK;
-
diff --git a/lib/c/2014/experimental/udp_hack.c b/lib/c/2014/experimental/udp_hack.c
deleted file mode 100644
index 1d26eb7d838b8c4781a6b623e560cb5e71beeca1..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/udp_hack.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <unistd.h>
-
-// Some projects can not use stdio.h.
-#ifndef LABCOMM_NO_STDIO
-  #include <stdio.h>
-#endif
-
-#define BUFLEN 512
-#define NPACK 10
-#define PORT 9930
-
-void diep(char *s)
-{
-  perror(s);
-  exit(1);
-}
-
-typedef struct {
-	struct sockaddr_in si_me, si_other;
-	int s, i, slen;
-	char buf[BUFLEN];
-} server_context_t;
-
-server_context_t* server_init(void)
-{
-  server_context_t* ctx;
-  ctx = malloc(sizeof(server_context_t));
-  if(!ctx)
-    diep("malloc");
-  ctx->slen=sizeof(struct sockaddr_in);
-  if ((ctx->s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
-    diep("socket");
-
-  memset((char *) &ctx->si_me, 0, sizeof(ctx->si_me));
-  ctx->si_me.sin_family = AF_INET;
-  ctx->si_me.sin_port = htons(PORT);
-  ctx->si_me.sin_addr.s_addr = htonl(INADDR_ANY);
-  if (bind(ctx->s, &ctx->si_me, sizeof(ctx->si_me))==-1)
-      diep("bind");
-  return ctx;
-}
-
-int udp_recv(server_context_t *ctx, char *buf, int len){
-    int l;
-    if ((l=recvfrom(ctx->s, buf, len, 0, &ctx->si_other, &ctx->slen))==-1)
-      diep("recvfrom()");
-    return l;
-//    printf("Received packet from %s:%d\nData: %s\n\n", 
-//           inet_ntoa(ctx->si_other.sin_addr), ntohs(ctx->si_other.sin_port), ctx->buf);
-}
-
-int server_run(server_context_t *ctx){
-  for (ctx->i=0; ctx->i<NPACK; ctx->i++) {
-    int l = udp_recv(ctx, ctx->buf, BUFLEN);
-    printf("Received %d bytes\n",l);
-    printf("Received data: %s\n", 
-           ctx->buf);
-  }
-}
-
-int server_exit(server_context_t *ctx) {
-  close(ctx->s);
-  free(ctx);
-  return 0;
-}
-
-#define SRV_IP "127.0.0.1"
-
-server_context_t* client_init(void)
-{
-
-  server_context_t *ctx = malloc(sizeof(server_context_t));
-  if(!ctx)
-    diep("malloc");
-  ctx->slen=sizeof(struct sockaddr_in);
-
-  if ((ctx->s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
-    diep("socket");
-
-  memset((char *) &ctx->si_other, 0, sizeof(ctx->si_other));
-  ctx->si_other.sin_family = AF_INET;
-  ctx->si_other.sin_port = htons(PORT);
-  if (inet_aton(SRV_IP, &ctx->si_other.sin_addr)==0) {
-    fprintf(stderr, "inet_aton() failed\n");
-    exit(1);
-  }
-  return ctx;
-}
-
-int udp_send(server_context_t* ctx, char *s, int len)
-{
-    int result;
-    if ( (result=sendto(ctx->s, s, len, 0, &(ctx->si_other), ctx->slen))==-1)
-      diep("sendto()");
-    return result;
-}
-
-int client_run(server_context_t* ctx)
-{
-  for (ctx->i=0; ctx->i<NPACK; ctx->i++) {
-    printf("Sending packet %d\n", ctx->i);
-//    sprintf(ctx->buf, "This is packet %d\n", ctx->i);
-//    udp_send(ctx);
-      udp_send(ctx, "Hello, world", 12);
-  }
-  return 0;
-}
-
-int client_exit(server_context_t* ctx)
-{
-
-  close(ctx->s);
-  free(ctx);
-  return 0;
-}
-
diff --git a/lib/c/2014/experimental/udp_hack.h b/lib/c/2014/experimental/udp_hack.h
deleted file mode 100644
index ac6c56e4923db83dddf4c992c037c4049308d441..0000000000000000000000000000000000000000
--- a/lib/c/2014/experimental/udp_hack.h
+++ /dev/null
@@ -1,12 +0,0 @@
-struct hidden; 
-typedef struct hidden server_context_t;
-
-int udp_send(server_context_t*, char*, int);
-int udp_recv(server_context_t*, char*, int);
-server_context_t* server_init(void);
-int server_run(server_context_t *ctx);
-int server_exit(server_context_t *ctx);
-server_context_t* client_init(void);
-//int client_run()server_context_t* ;
-//int client_free(vserver_context_t*);
-
diff --git a/lib/c/2014/labcomm2014.c b/lib/c/2014/labcomm2014.c
deleted file mode 100644
index c2285e8fd5f5590140ea14c026b787fbd2ae7a61..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
-  labcomm2014.c -- runtime for handling encoding and decoding of
-               labcomm2014 samples.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#else
-  #include <stdio.h>
-  #include <strings.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stddef.h>
-
-#include "labcomm2014.h"
-#include "labcomm2014_private.h"
-#include "labcomm2014_ioctl.h"
-#include "labcomm2014_dynamic_buffer_writer.h"
-
-/* Unwrapping reader/writer functions */
-#define UNWRAP_ac(rw, ac, ...) ac
-#define UNWRAP(func, ...)	     \
-  while (1) {								\
-    if (UNWRAP_ac(__VA_ARGS__)->action->func) {				\
-      return UNWRAP_ac(__VA_ARGS__)->action->func(__VA_ARGS__); }	\
-    if (UNWRAP_ac(__VA_ARGS__)->next == NULL) { return -ENOSYS; }	\
-    UNWRAP_ac( __VA_ARGS__) = UNWRAP_ac(__VA_ARGS__)->next;		\
-  }
-
-int labcomm2014_reader_alloc(struct labcomm2014_reader *r,
-                         struct labcomm2014_reader_action_context *action_context)
-{
-  UNWRAP(alloc, r, action_context);
-}
-
-int labcomm2014_reader_free(struct labcomm2014_reader *r,
-                        struct labcomm2014_reader_action_context *action_context)
-{
-  UNWRAP(free, r, action_context);
-}
-
-int labcomm2014_reader_start(struct labcomm2014_reader *r,
-                         struct labcomm2014_reader_action_context *action_context,
-			 int local_index, int remote_index,
-			 const struct labcomm2014_signature *signature,
-			 void *value)
-{
-  UNWRAP(start, r, action_context, local_index, remote_index, signature, value);
-}
-
-int labcomm2014_reader_end(struct labcomm2014_reader *r,
-                       struct labcomm2014_reader_action_context *action_context)
-{
-  UNWRAP(end, r, action_context);
-}
-
-int labcomm2014_reader_fill(struct labcomm2014_reader *r,
-                        struct labcomm2014_reader_action_context *action_context)
-{
-  UNWRAP(fill, r, action_context);
-}
-
-int labcomm2014_reader_ioctl(struct labcomm2014_reader *r,
-                         struct labcomm2014_reader_action_context *action_context,
-                         int local_index, int remote_index,
-                         const struct labcomm2014_signature *signature,
-                         uint32_t ioctl_action, va_list args)
-{
-  UNWRAP(ioctl, r, action_context,
-	 local_index, remote_index, signature, ioctl_action, args);
-}
-
-int labcomm2014_writer_alloc(struct labcomm2014_writer *w,
-                         struct labcomm2014_writer_action_context *action_context)
-{
-  UNWRAP(alloc, w, action_context);
-}
-
-int labcomm2014_writer_free(struct labcomm2014_writer *w,
-                        struct labcomm2014_writer_action_context *action_context)
-{
-  UNWRAP(free, w, action_context);
-}
-
-int labcomm2014_writer_start(struct labcomm2014_writer *w,
-                         struct labcomm2014_writer_action_context *action_context,
-                         int index, const struct labcomm2014_signature *signature,
-                         void *value)
-{
-  UNWRAP(start, w, action_context, index, signature, value);
-}
-
-int labcomm2014_writer_end(struct labcomm2014_writer *w,
-                       struct labcomm2014_writer_action_context *action_context)
-{
-  UNWRAP(end, w, action_context);
-}
-
-int labcomm2014_writer_flush(struct labcomm2014_writer *w,
-                         struct labcomm2014_writer_action_context *action_context)
-{
-  UNWRAP(flush, w, action_context);
-}
-
-int labcomm2014_writer_ioctl(struct labcomm2014_writer *w,
-                         struct labcomm2014_writer_action_context *action_context,
-                         int index,
-                         const struct labcomm2014_signature *signature,
-                         uint32_t ioctl_action, va_list args)
-{
-  UNWRAP(ioctl, w, action_context, index, signature, ioctl_action, args);
-}
-
-#undef UNWRAP
-#undef UNWRAP_ac
-
-
-
-
-static const char *labcomm2014_error_string[] = {
-#define LABCOMM2014_ERROR(name, description) description ,
-#include "labcomm2014_error.h"
-#undef LABCOMM2014_ERROR
-};
-static const int labcomm2014_error_string_count = (sizeof(labcomm2014_error_string) /
-					       sizeof(labcomm2014_error_string[0]));
-
-
-const char *labcomm2014_error_get_str(enum labcomm2014_error error_id)
-{
-  const char *error_str = NULL;
-  // Check if this is a known error ID.
-  if (error_id < labcomm2014_error_string_count) {
-    error_str = labcomm2014_error_string[error_id];
-  }
-  return error_str;
-}
-
-void labcomm20142014_on_error_fprintf(enum labcomm2014_error error_id, size_t nbr_va_args, ...)
-{
-#ifndef LABCOMM_NO_STDIO
-  const char *err_msg = labcomm2014_error_get_str(error_id); // The final string to print.
-  if (err_msg == NULL) {
-    err_msg = "Error with an unknown error ID occured.";
-  }
-  fprintf(stderr, "%s\n", err_msg);
-
- if (nbr_va_args > 0) {
-   va_list arg_pointer;
-   va_start(arg_pointer, nbr_va_args);
-
-   fprintf(stderr, "%s\n", "Extra info {");
-   char *print_format = va_arg(arg_pointer, char *);
-   vfprintf(stderr, print_format, arg_pointer);
-   fprintf(stderr, "}\n");
-
-   va_end(arg_pointer);
- }
-#else
- ; // If labcomm2014 can't be compiled with stdio the user will have to make an own error callback functionif he/she needs error reporting.
-#endif
-}
-
-
-
-#if 0
-static void dump(void *p, int size, int first, int last)
-{
-  int i, j;
-
-  printf("%d %d (%p): ", first, last, p);
-  for (i = first ; i < last ; i++) {
-    for (j = 0 ; j < size ; j++) {
-      printf("%2.2d", ((char*)p)[(i-first)*size + j]);
-    }
-    printf(" ");
-  }
-  printf("\n");
-}
-#endif
-
-void *labcomm2014_signature_array_ref(struct labcomm2014_memory *memory,
-				  int *first, int *last, void **data,
-				  int size, int index)
-{
-  if (*first == 0 && *last == 0) {
-    *first = index;
-    *last = index + 1;
-    *data = labcomm2014_memory_alloc(memory, 0, size);
-    if (*data) {
-      memset(*data, 0, size);
-    }
-  } else if (index < *first || *last <= index) {
-    void *old_data = *data;
-    int old_first = *first;
-    int old_last = *last;
-    int n;
-    *first = (index<old_first)?index:old_first;
-    *last = (old_last<=index)?index+1:old_last;
-    n = (*last - *first);
-    *data = labcomm2014_memory_alloc(memory, 0, n * size);
-    if (*data) {
-      memset(*data, 0, n * size);
-      memcpy(*data + (old_first - *first) * size,
-	     old_data,
-	     (old_last - old_first) * size);
-    }
-//    dump(old_data, size, old_first, old_last);
-    labcomm2014_memory_free(memory, 0, old_data);
-  }
-  if (*data) {
-//    dump(*data, size, *first, *last);
-    return *data + (index - *first) * size;
-  } else {
-    return NULL;
-  }
-}
-
-static int local_index = LABCOMM_USER;
-
-void labcomm2014_set_local_index(struct labcomm2014_signature *signature)
-{
-  if (signature->index != 0) {
-    labcomm2014_error_fatal_global(LABCOMM2014_ERROR_SIGNATURE_ALREADY_SET,
-			       "Signature already set: %s\n", signature->name);
-  }
-  signature->index = local_index;
-  local_index++;
-}
-
-int labcomm2014_get_local_index(const struct labcomm2014_signature *signature)
-{
-  if (signature->index == 0) {
-    labcomm2014_error_fatal_global(LABCOMM2014_ERROR_SIGNATURE_NOT_SET,
-			       "Signature not set: %s\n", signature->name);
-  }
-  return signature->index;
-}
-
-int labcomm2014_get_local_type_index(const struct labcomm2014_signature *signature)
-{
-    return labcomm2014_get_local_index(signature);
-}
-
-int labcomm2014_internal_sizeof(const struct labcomm2014_signature *signature,
-                            void *v)
-{
-  int length = signature->encoded_size(v);
-  return (labcomm2014_size_packed32(signature->index) +
-          labcomm2014_size_packed32(length) +
-          length);
-}
-
diff --git a/lib/c/2014/labcomm2014.h b/lib/c/2014/labcomm2014.h
deleted file mode 100644
index 5492b1e230b183c0a3d876570fad0fd342e616eb..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-  labcomm2014.h -- user interface for handling encoding and decoding of
-               labcomm2014 samples.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM_H__
-#define __LABCOMM_H__
-
-#include <stdarg.h>
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#else
-  #include <stdint.h>
-  #include <unistd.h>
-#endif
-
-#include "labcomm2014_error.h"
-#include "labcomm2014_scheduler.h"
-
-/* Forward declaration */
-struct labcomm2014_encoder;
-struct labcomm2014_decoder;
-
-#include "labcomm2014_type_signature.h"
-/*
- * Error handling.
- */
-
-/* The callback prototype for error handling.
- * First parameter is the error ID.
- * The second paramters is the number of va_args that comes after this 
- * one. If none it should be 0.
- * Optionaly other paramters can be supplied depending on what is needed 
- * for this error ID.
- */
-typedef void (*labcomm2014_error_handler_callback)(enum labcomm2014_error error_id, 
-					       size_t nbr_va_args, ...); 
-
-/* Default error handler, prints message to stderr. 
- * Extra info about the error can be supplied as char* as VA-args. Especially user defined errors should supply a describing string. if nbr_va_args > 1 the first variable argument must be a printf format string and the possibly following arguments are passed as va_args to vprintf. 
- */
-void labcomm20142014_on_error_fprintf(enum labcomm2014_error error_id, size_t nbr_va_args, ...);
-
-/* Register a callback for the error handler for this encoder. */
-void labcomm2014_register_error_handler_encoder(struct labcomm2014_encoder *encoder, labcomm2014_error_handler_callback callback);
-
-/* Register a callback for the error handler for this decoder. */
-void labcomm2014_register_error_handler_decoder(struct labcomm2014_decoder *decoder, labcomm2014_error_handler_callback callback);
-
-/* Get a string describing the supplied standrad labcomm2014 error. */
-const char *labcomm2014_error_get_str(enum labcomm2014_error error_id);
-
-typedef int (*labcomm2014_handle_new_datatype_callback)(
-  struct labcomm2014_decoder *decoder,
-  struct labcomm2014_signature *sig);
-
-/*
- * Dynamic memory handling
- *   lifetime == 0     memory that will live for as long as the 
- *                     encoder/decoder or that are allocated/deallocated 
- *                     during the communication setup phase
- *   otherwise         memory will live for approximately this number of
- *                     sent/received samples
- */
-struct labcomm2014_memory;
-
-void *labcomm2014_memory_alloc(struct labcomm2014_memory *m, int lifetime, size_t size);
-void *labcomm2014_memory_realloc(struct labcomm2014_memory *m, int lifetime, 
-			     void *ptr, size_t size);
-void labcomm2014_memory_free(struct labcomm2014_memory *m, int lifetime, void *ptr);
-
-/*
- * Decoder
- */
-struct labcomm2014_reader;
-
-struct labcomm2014_decoder *labcomm2014_decoder_new(
-  struct labcomm2014_reader *reader,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler);
-void labcomm2014_decoder_free(
-  struct labcomm2014_decoder *decoder);
-int labcomm2014_decoder_decode_one(
-  struct labcomm2014_decoder *decoder);
-void labcomm2014_decoder_run(
-  struct labcomm2014_decoder *decoder);
-int labcomm2014_decoder_sample_ref_register(
-  struct labcomm2014_decoder *decoder,
-  const struct labcomm2014_signature *signature);
-
-/* See labcomm2014_ioctl.h for predefined ioctl_action values */
-int labcomm2014_decoder_ioctl(struct labcomm2014_decoder *decoder, 
-			  uint32_t ioctl_action,
-			  ...);
-
-/*
- * Encoder
- */
-struct labcomm2014_writer;
-
-struct labcomm2014_encoder *labcomm2014_encoder_new(
-  struct labcomm2014_writer *writer,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler);
-void labcomm2014_encoder_free(
-  struct labcomm2014_encoder *encoder);
-int labcomm2014_encoder_sample_ref_register(
-  struct labcomm2014_encoder *encoder,
-  const struct labcomm2014_signature *signature);
-
-/* See labcomm2014_ioctl.h for predefined ioctl_action values */
-int labcomm2014_encoder_ioctl(struct labcomm2014_encoder *encoder, 
-			  uint32_t ioctl_action,
-			  ...);
-
-#define LABCOMM_VOID ((void*)1)
-
-#endif
diff --git a/lib/c/2014/labcomm2014_compat_arm_cortexm3.h b/lib/c/2014/labcomm2014_compat_arm_cortexm3.h
deleted file mode 100644
index 512ad3633fa0bd29e9bbd7c4db22ea8881da95b3..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_compat_arm_cortexm3.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef ARM_CORTEXM3_CODESOURCERY
-#error "ARM_CORTEXM3_CODESOURCERY" not defined
-#endif
-
-#include <machine/endian.h>
diff --git a/lib/c/2014/labcomm2014_compat_osx.h b/lib/c/2014/labcomm2014_compat_osx.h
deleted file mode 100644
index 1219f3f54bf8864db9ecb4a4f8fd0c915916034e..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_compat_osx.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __APPLE__
-#error "__APPLE__" not defined
-#endif
-
-#ifndef LABCOMM_COMPAT_OSX
-#define LABCOMM_COMPAT_OSX
-
-#include <machine/endian.h>
-#include <stdio.h>
-#include <time.h>
-
-#include <mach/clock.h>
-#include <mach/mach.h>
-
-#define CLOCK_REALTIME 0
-static inline void clock_gettime(int garbage, struct timespec *ts)
-{
-  (void) garbage;
-  clock_serv_t cclock;
-  mach_timespec_t mts;
-  host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
-  clock_get_time(cclock, &mts);
-  mach_port_deallocate(mach_task_self(), cclock);
-  ts->tv_sec = mts.tv_sec;
-  ts->tv_nsec = mts.tv_nsec;
-}
-
-#endif
diff --git a/lib/c/2014/labcomm2014_compat_vxworks.h b/lib/c/2014/labcomm2014_compat_vxworks.h
deleted file mode 100644
index ab32a5025c28d3a51c551f234291441ee9ebf7df..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_compat_vxworks.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _LABCOMM_COMPAT_VXWORKS_H_
-#define _LABCOMM_COMPAT_VXWORKS_H_
-
-#ifndef  __VXWORKS__
-#error "__VXWORKS__" not defined
-#endif
-
-#include <types/vxTypes.h>
-#include <selectLib.h>
-#include <types.h>
-#include <timers.h>
-#include <stdio.h>
-#include <private/stdioP.h>
-
-#ifdef __INT64_MAX__
-#undef INT64_MAX
-#define INT64_MAX __INT64_MAX__
-#endif
-
-#if (CPU == PPC603)
-  #undef _LITTLE_ENDIAN
-#endif
-
-#if (CPU == PENTIUM4)
-  #undef _BIG_ENDIAN
-#endif
-
-extern unsigned int cpuFrequency;
-
-#endif
diff --git a/lib/c/2014/labcomm2014_decoder.c b/lib/c/2014/labcomm2014_decoder.c
deleted file mode 100644
index 8d3f79b7e84ff100ff520ec952917f54cb439cfd..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_decoder.c
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
-  labcomm2014_decoder.c -- runtime for handling decoding of labcomm2014 samples.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  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 "LabComm2014"
-
-#include <errno.h>
-#include "labcomm2014.h"
-#include "labcomm2014_private.h"
-#include "labcomm2014_ioctl.h"
-#include "labcomm2014_dynamic_buffer_writer.h"
-
-#ifdef DEBUG
-#define DEBUG_FPRINTF(str, ...) fprintf(str, ##__VA_ARGS__)
-#else
-#define DEBUG_FPRINTF(str, ...)
-#endif
-
-#ifdef DECODER_DEBUG
-#define DECODER_DEBUG_FPRINTF(str, ...) fprintf(str, ##__VA_ARGS__) 
-#else
-#define DECODER_DEBUG_FPRINTF(str, ...)
-#endif
-
-struct sample_entry {
-  int remote_index;
-  const struct labcomm2014_signature *signature;
-  labcomm2014_decoder_function decode;
-  labcomm2014_handler_function handler;
-  void *context;
-};
-
-struct labcomm2014_decoder {
-  struct labcomm2014_reader *reader;
-  int reader_allocated;
-  int version_ok;
-  struct labcomm2014_error_handler *error;
-  struct labcomm2014_memory *memory;
-  struct labcomm2014_scheduler *scheduler;
-  labcomm2014_error_handler_callback on_error;
-  labcomm2014_handle_new_datatype_callback on_new_datatype;
-  LABCOMM_SIGNATURE_ARRAY_DEF(local, struct sample_entry);
-  LABCOMM_SIGNATURE_ARRAY_DEF(remote_to_local, int);
-  LABCOMM_SIGNATURE_ARRAY_DEF(local_ref, const struct labcomm2014_signature *);
-  LABCOMM_SIGNATURE_ARRAY_DEF(remote_to_local_ref, int);
-};
-
-struct labcomm2014_decoder *labcomm2014_decoder_new(
-  struct labcomm2014_reader *reader,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler)
-{
-  struct labcomm2014_decoder *result;
-
-  result = labcomm2014_memory_alloc(memory, 0, sizeof(*result));
-  if (result) {
-    result->reader = reader;
-    result->reader->decoder = result;
-    result->reader->data = 0;
-    result->reader->data_size = 0;
-    result->reader->count = 0;
-    result->reader->pos = 0;
-    result->reader->error = 0;
-    result->reader_allocated = 0;
-    result->version_ok = 0;
-    result->error = error;
-    result->memory = memory;
-    result->scheduler = scheduler;
-    result->on_error = labcomm20142014_on_error_fprintf;
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->local, struct sample_entry);
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->remote_to_local, int);
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->local_ref, 
-                                 const struct labcomm2014_signature*);
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->remote_to_local_ref, int);
-  }
-  return result;
-}
-
-void labcomm2014_decoder_free(struct labcomm2014_decoder* d)
-{
-  struct labcomm2014_memory *memory = d->memory;
-
-  labcomm2014_reader_free(d->reader, d->reader->action_context);
-  LABCOMM_SIGNATURE_ARRAY_FREE(memory, d->local, struct sample_entry);
-  LABCOMM_SIGNATURE_ARRAY_FREE(memory, d->remote_to_local, int);
-  LABCOMM_SIGNATURE_ARRAY_FREE(memory, d->local_ref, 
-                               const struct labcomm2014_signature*);
-  LABCOMM_SIGNATURE_ARRAY_FREE(memory, d->remote_to_local_ref, int);
-  labcomm2014_memory_free(memory, 0, d);
-}
-
-static int handle_sample_def(struct labcomm2014_decoder *d, int remote_index,
-                             const struct labcomm2014_signature *signature)
-{
-  int result;
-  int i;
-  const struct labcomm2014_signature *local_signature = NULL;
-  int local_index = 0;
-
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  LABCOMM_SIGNATURE_ARRAY_FOREACH(d->local, struct sample_entry, i) {
-    struct sample_entry *s;
-    int *remote_to_local;
-
-    result = -ENOENT;
-    s = LABCOMM_SIGNATURE_ARRAY_REF(d->memory, 
-                                    d->local, struct sample_entry, i);
-    if (s->signature &&
-        s->signature->size == signature->size &&
-        strcmp(s->signature->name, signature->name) == 0 &&
-        memcmp((void*)s->signature->signature, (void*)signature->signature,
-	       signature->size) == 0) {
-      s->remote_index = remote_index;
-      local_signature = s->signature;
-      local_index = i;
-      remote_to_local = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-                                                    d->remote_to_local, int,
-                                                    remote_index);
-      *remote_to_local = i;
-      result = remote_index;
-      break;
-    }
-  }
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-  if (local_signature) {
-    labcomm2014_reader_start(d->reader, d->reader->action_context,
-                         local_index, remote_index, local_signature,
-                         NULL);
-    labcomm2014_reader_end(d->reader, d->reader->action_context);
-  }
-  return result;
-}
-
-static int handle_sample_ref(struct labcomm2014_decoder *d, int remote_index,
-                             const struct labcomm2014_signature *signature)
-{
-  int result;
-  int i;
-
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  LABCOMM_SIGNATURE_ARRAY_FOREACH(d->local_ref, const struct labcomm2014_signature *, i) {
-    const struct labcomm2014_signature *s;
-    int *remote_to_local_ref;
-
-    result = -ENOENT;
-    s = LABCOMM_SIGNATURE_ARRAY_GET(d->local_ref, const struct labcomm2014_signature *, i, 0);
-    if (s &&
-        s->signature &&
-        s->size == signature->size &&
-        strcmp(s->name, signature->name) == 0 &&
-        memcmp((void*)s->signature, (void*)signature->signature, signature->size) == 0) {
-      remote_to_local_ref = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-                                                        d->remote_to_local_ref, int,
-                                                        remote_index);
-      *remote_to_local_ref = i;
-      result = remote_index;
-      break;
-    }
-  }
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-  return result;
-}
-
-static int decoder_skip(struct labcomm2014_decoder *d, int len, int tag)
-{
-  int i;
-  DECODER_DEBUG_FPRINTF(stdout, "got tag 0x%x, skipping %d bytes\n", tag, len);
-  for(i = 0; i <len; i++){
-    DECODER_DEBUG_FPRINTF(stderr, ".");
-    labcomm2014_read_byte(d->reader);
-    if (d->reader->error < 0) {
-      DECODER_DEBUG_FPRINTF(stderr, "\nerror while skipping: %d\n",  d->reader->error);
-      return d->reader->error;
-    }
-  }
-  DECODER_DEBUG_FPRINTF(stderr, "\n");
-  return tag;
-}
-
-static int decode_sample_def_or_ref(struct labcomm2014_decoder *d, int kind)
-{
-  int result;
-  struct labcomm2014_signature signature;
-  int i, remote_index;
-
-  remote_index = labcomm2014_read_packed32(d->reader);
-  if (d->reader->error < 0) {
-    result = d->reader->error;
-    goto out;
-  }
-  signature.name = labcomm2014_read_string(d->reader);
-  if (d->reader->error < 0) {
-    result = d->reader->error;
-    goto out;
-  }
-  signature.size = labcomm2014_read_packed32(d->reader);
-  if (d->reader->error < 0) {
-    result = d->reader->error;
-    goto free_signature_name;
-  }
-  signature.signature = labcomm2014_memory_alloc(d->memory, 1,  signature.size);
-  if (d->reader->error < 0) {
-    result = d->reader->error;
-    goto free_signature_name;
-  }
-  for (i = 0 ; i < signature.size ; i++) {
-    signature.signature[i] = labcomm2014_read_byte(d->reader);
-    if (d->reader->error < 0) {
-      result = d->reader->error;
-      goto free_signature_signature;
-    }
-  }
-  switch (kind) {
-    case LABCOMM_SAMPLE_DEF: {
-      result = handle_sample_def(d, remote_index, &signature);
-      break;
-    } 
-    case LABCOMM_SAMPLE_REF: {
-      result = handle_sample_ref(d, remote_index, &signature);
-      if (result == -ENOENT) {
-        /* Dummy value to silently continue */
-        result = LABCOMM_SAMPLE_REF;
-      }
-      break;
-    } 
-    default:
-      result = -EINVAL;
-  }
-free_signature_signature:
-  labcomm2014_memory_free(d->memory, 1,  signature.signature);
-free_signature_name:
-  labcomm2014_memory_free(d->memory, 0, signature.name);
-out:
-  return result;
-}
-
-struct call_handler_context {
-  struct labcomm2014_reader *reader;
-  int local_index;
-  int remote_index;
-  const struct labcomm2014_signature *signature;
-  labcomm2014_handler_function handler;
-  void *context;
-};
-
-static void call_handler(void *value, void *context)
-{
-  struct call_handler_context *wrap = context;
-
-  if (wrap->reader->error >= 0) {
-    labcomm2014_reader_start(wrap->reader, wrap->reader->action_context,
-			 wrap->local_index, wrap->remote_index, wrap->signature,
-			 value);
-    wrap->handler(value, wrap->context);
-    labcomm2014_reader_end(wrap->reader, wrap->reader->action_context);
-  }
-}
-
-static void reader_alloc(struct labcomm2014_decoder *d)
-{
-  if (!d->reader_allocated) {
-    d->reader_allocated = 1;
-    labcomm2014_reader_alloc(d->reader, d->reader->action_context);
-  }
-}
-
-/* d        - decoder to read from
-   registry - decoder to lookup signatures (registry != d only if
-                nesting decoders, e.g., when decoding pragma)
-   len      - length of the labcomm2014 packet )
-*/
-static int decode_pragma(struct labcomm2014_decoder *d,
-		         struct labcomm2014_decoder *registry,
-		         int len)
-{
-  char *pragma_type;
-  int result;
-  pragma_type = labcomm2014_read_string(d->reader);
-  if (d->reader->error < 0) {
-    result = d->reader->error;
-    goto out;
-  }
-  int bytes = labcomm2014_size_string(pragma_type);
-  int psize = len-bytes;
-  result = decoder_skip(d, psize, LABCOMM_PRAGMA);
-out:
-  return result;
-}
-
-static labcomm2014_decoder_function lookup_h(struct labcomm2014_decoder *d,
-		                         struct call_handler_context *wrap,
-		                         int remote_index,
-					 int **local_index)
-{
-  labcomm2014_decoder_function do_decode = NULL;
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  *local_index = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-      				      d->remote_to_local, int,
-      				      remote_index);
-  if (**local_index != 0) {
-    struct sample_entry *entry;
-
-    entry = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-      				  d->local, struct sample_entry,
-      				  **local_index);
-    wrap->local_index = **local_index;
-    wrap->signature = entry->signature;
-    wrap->handler = entry->handler;
-    wrap->context = entry->context;
-    do_decode = entry->decode;
-  }
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-  return do_decode;
-}
-/* d            - decoder to read from
-   registry     - decoder to lookup signatures (registry != d only if
-                    nesting decoders, e.g., when decoding pragma)
-   remote_index -  received type index )
-*/
-static int decode_and_handle(struct labcomm2014_decoder *d,
-		             struct labcomm2014_decoder *registry,
-		             int remote_index)
-{
-  int result;
-  int *local_index;
-  struct call_handler_context wrap = {
-    .reader = d->reader,
-    .remote_index = remote_index,
-    .signature = NULL,
-    .handler = NULL,
-    .context = NULL,
-  };
-  labcomm2014_decoder_function do_decode = lookup_h(registry, &wrap, remote_index, &local_index);
-  result = *local_index;
-  if (do_decode) {
-    do_decode(d->reader, call_handler, &wrap);
-    if (d->reader->error < 0) {
-      result = d->reader->error;
-    }
-  } else {
-    result = -ENOENT;
-  }
-  return result;
-}
-int labcomm2014_decoder_decode_one(struct labcomm2014_decoder *d)
-{
-  int result, remote_index, length;
-
-  reader_alloc(d);
-  remote_index = labcomm2014_read_packed32(d->reader);
-  if (d->reader->error < 0) {
-    result = d->reader->error;
-    goto out;
-  }
-  length = labcomm2014_read_packed32(d->reader);
-  if (d->reader->error < 0) {
-    result = d->reader->error;
-    goto out;
-  }
-  if (remote_index == LABCOMM_VERSION) {
-    char *version = labcomm2014_read_string(d->reader);
-    if (d->reader->error < 0) {
-      result = d->reader->error;
-      goto out;
-    }
-    if (strcmp(version, CURRENT_VERSION) == 0) {
-      result = LABCOMM_VERSION;
-      d->version_ok = 1;
-    } else {
-      result = -ECONNRESET;
-    }  
-    labcomm2014_memory_free(d->memory, 1,  version);
-  } else if (! d->version_ok) {
-    DEBUG_FPRINTF(stderr, "No VERSION %d %d\n", remote_index, length);
-    result = -ECONNRESET;
-  } else if (remote_index == LABCOMM_SAMPLE_DEF) {
-    result = decode_sample_def_or_ref(d, LABCOMM_SAMPLE_DEF); 
-  } else if (remote_index == LABCOMM_SAMPLE_REF) {
-    result = decode_sample_def_or_ref(d, LABCOMM_SAMPLE_REF); 
-  } else if (remote_index == LABCOMM_TYPE_DEF) {
-    result = decode_and_handle(d, d, remote_index);
-    if(result == -ENOENT) { 
-        //No handler for type_defs, skip
-        result = decoder_skip(d, length, remote_index);
-    }
-  } else if (remote_index == LABCOMM_TYPE_BINDING) {
-    result = decode_and_handle(d, d, remote_index);
-    if(result == -ENOENT) { 
-        //No handler for type_bindings, skip
-        result = decoder_skip(d, length, remote_index);
-    }
-  } else if (remote_index == LABCOMM_PRAGMA) {
-    result = decode_pragma(d, d, length);
-  } else if (remote_index < LABCOMM_USER) {
-    DECODER_DEBUG_FPRINTF(stderr, "SKIP %d %d\n", remote_index, length);
-    result = decoder_skip(d, length, remote_index);
-  } else {
-    result = decode_and_handle(d, d, remote_index);
-  }
-out:   
-  return result;
-}
-
-void labcomm2014_decoder_run(struct labcomm2014_decoder *d)
-{
-  while (labcomm2014_decoder_decode_one(d) > 0) {
-  }
-}
-
-int labcomm2014_decoder_ioctl(struct labcomm2014_decoder *d, 
-			  uint32_t action,
-			  ...)
-{
-  int result;  
-  va_list va;
-    
-  va_start(va, action);
-  result = labcomm2014_reader_ioctl(d->reader, 
-				d->reader->action_context,
-				0, 0, NULL, action, va);
-  va_end(va);
-  return result;
-}
-
-int labcomm2014_decoder_sample_ref_register(
-  struct labcomm2014_decoder *d,
-  const struct labcomm2014_signature *signature)
-{
-  int local_index, *remote_to_local_ref;
-  const struct labcomm2014_signature **s;
-
-  local_index = labcomm2014_get_local_index(signature);
-  if (local_index <= 0) { goto out; }
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  s = LABCOMM_SIGNATURE_ARRAY_REF(d->memory, 
-                                  d->local_ref, 
-                                  const struct labcomm2014_signature*, local_index);
-  if (s == NULL) { local_index = -ENOMEM; goto unlock; };
-  if (*s) { goto unlock; }
-  *s = signature;	
-  remote_to_local_ref = LABCOMM_SIGNATURE_ARRAY_REF(d->memory, 
-                                                    d->remote_to_local_ref, 
-                                                    int, local_index);
-  *remote_to_local_ref = 0;
-unlock:
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-out:
-  return local_index;
-}
-
-int labcomm2014_internal_decoder_ioctl(struct labcomm2014_decoder *d, 
-				   const struct labcomm2014_signature *signature,
-				   uint32_t action, va_list va)
-{
-  int result;
-  int local_index, remote_index;
-
-  local_index = labcomm2014_get_local_index(signature);
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  remote_index = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-					     d->local,
-					     struct sample_entry,
-					     local_index)->remote_index;
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-  result = labcomm2014_reader_ioctl(d->reader, d->reader->action_context,
-				local_index, remote_index, 
-				signature, action, va);
-  return result;
-}
-
-#ifndef LABCOMM_NO_TYPEDECL
-//// Code for allowing user code to handle type_defs 
-//// (should perhaps be moved to another file)
-
-static void decode_raw_type_def(
-  struct labcomm2014_reader *r,
-  void (*handle)(
-    struct labcomm2014_raw_type_def *v,
-    void *context
-  ),
-  void *context
-)
-{
-  struct labcomm2014_raw_type_def v;
-  v.index = labcomm2014_read_packed32(r);
-  if (r->error < 0) { goto out; }
-  v.name  = labcomm2014_read_string(r);
-  if (r->error < 0) { goto free_name; }
-  v.length = labcomm2014_read_packed32(r);
-  if (r->error < 0) { goto free_name; }
-  int i;
-  v.signature_data = labcomm2014_memory_alloc(r->memory, 1, v.length);
-  if(v.signature_data) {
-    for(i=0; i<v.length; i++) {
-      v.signature_data[i] = labcomm2014_read_byte(r);
-      if (r->error < 0) { goto free_sig; }
-    }  
-    handle(&v, context);
-    }
-free_sig:
-  labcomm2014_memory_free(r->memory, 1, v.signature_data);
-free_name:
-  labcomm2014_memory_free(r->memory, 1, v.name);
-out:
-  return;
-}
-int labcomm2014_decoder_register_labcomm2014_type_def(
-  struct labcomm2014_decoder *d,
-  void (*handler)(
-    struct labcomm2014_raw_type_def *v,
-    void *context
-  ),
-  void *context
-)
-{
-  int tag = LABCOMM_TYPE_DEF;
-  struct sample_entry *entry;
-  int *remote_to_local;
- 
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  entry = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-				      d->local, struct sample_entry,
-				      tag);
-  if (entry == NULL) { tag = -ENOMEM; goto unlock; }
-  entry->remote_index = tag;
-  entry->signature = NULL;
-  entry->decode = (labcomm2014_decoder_function) decode_raw_type_def;
-  entry->handler =(labcomm2014_handler_function) handler;
-  entry->context = context;
-
-  remote_to_local = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-                                                    d->remote_to_local, int,
-                                                    tag);
-  *remote_to_local = tag;
-unlock:
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-
-  return tag;
-}
-
-
-static void decode_type_binding(
-  struct labcomm2014_reader *r,
-  void (*handle)(
-    struct labcomm2014_type_binding *v,
-    void *context
-  ),
-  void *context
-)
-{
-  struct labcomm2014_type_binding v;
-  v.sample_index = labcomm2014_read_packed32(r);
-  if (r->error < 0) { goto out; }
-  v.type_index = labcomm2014_read_packed32(r);
-  if (r->error < 0) { goto out; }
-  handle(&v, context);
-out:
-  return;
-}
-
-int labcomm2014_decoder_register_labcomm2014_type_binding(
-  struct labcomm2014_decoder *d,
-  void (*handler)(
-    struct labcomm2014_type_binding *v,
-    void *context
-  ),
-  void *context
-)
-{
-  int tag = LABCOMM_TYPE_BINDING;
-  struct sample_entry *entry;
-  int *remote_to_local;
- 
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  entry = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-				      d->local, struct sample_entry,
-				      tag);
-  if (entry == NULL) { tag = -ENOMEM; goto unlock; }
-  entry->remote_index = tag;
-  entry->signature = NULL;
-  entry->decode = (labcomm2014_decoder_function) decode_type_binding;
-  entry->handler =(labcomm2014_handler_function) handler;
-  entry->context = context;
-
-  remote_to_local = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-                                                    d->remote_to_local, int,
-                                                    tag);
-  *remote_to_local = tag;
-unlock:
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-
-  return tag;
-}
-
-//// End type_def handling
-#endif
-
-int labcomm2014_internal_decoder_register(
-  struct labcomm2014_decoder *d,
-  const struct labcomm2014_signature *signature,
-  labcomm2014_decoder_function decode, 
-  labcomm2014_handler_function handler,
-  void *context)
-{
-  int local_index;
-  struct sample_entry *entry;
- 
-  reader_alloc(d);
-  local_index = labcomm2014_get_local_index(signature);
-  if (local_index <= 0) { goto out; }
-  labcomm2014_reader_start(d->reader, d->reader->action_context,
-		       local_index, 0, signature,
-		       NULL);
-  labcomm2014_reader_end(d->reader, d->reader->action_context);
-
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  entry = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-				      d->local, struct sample_entry,
-				      local_index);
-  if (entry == NULL) { local_index = -ENOMEM; goto unlock; }
-  entry->remote_index = 0;
-  entry->signature = signature;
-  entry->decode = decode;
-  entry->handler = handler;
-  entry->context = context;
-unlock:
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-out:
-  return local_index;
-}
-
-const struct labcomm2014_signature *labcomm2014_internal_decoder_index_to_signature(
-  struct labcomm2014_decoder *d, int index)
-{
-  const struct labcomm2014_signature *result = 0;
-  int local_index;
-
-  labcomm2014_scheduler_data_lock(d->scheduler);
-  local_index = LABCOMM_SIGNATURE_ARRAY_GET(d->remote_to_local_ref, 
-                                            int, index, 0);
-  if (local_index) {
-    result = LABCOMM_SIGNATURE_ARRAY_GET(d->local_ref, 
-                                         const struct labcomm2014_signature*, 
-                                         local_index, 0);
-  }
-  labcomm2014_scheduler_data_unlock(d->scheduler);
-  return result;
-}
diff --git a/lib/c/2014/labcomm2014_default_error_handler.c b/lib/c/2014/labcomm2014_default_error_handler.c
deleted file mode 100644
index ae9fe30323823573ae4bb51b27c13e47f7c12114..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_default_error_handler.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-  test_default_error_handler.c -- LabComm default error handler
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "labcomm2014.h"
-
-struct labcomm2014_error_handler *labcomm2014_default_error_handler = NULL;
diff --git a/lib/c/2014/labcomm2014_default_error_handler.h b/lib/c/2014/labcomm2014_default_error_handler.h
deleted file mode 100644
index 420cb4032605b12c1437504399b378020339175d..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_default_error_handler.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-  test_default_error_handler.h -- LabComm default error handler
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef __LABCOMM2014_DEFAULT_ERROR_HANDLER_H__
-#define __LABCOMM2014_DEFAULT_ERROR_HANDLER_H__
-
-#include "labcomm2014.h"
-
-extern struct labcomm2014_error_handler *labcomm2014_default_error_handler;
-
-#endif
diff --git a/lib/c/2014/labcomm2014_default_memory.c b/lib/c/2014/labcomm2014_default_memory.c
deleted file mode 100644
index 17dee8adf48871c0e9fbab15b560c8a23477e9ee..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_default_memory.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-  test_default_memory.c -- LabComm default memory allocator
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include "labcomm2014.h"
-#include "labcomm2014_private.h"
-
-void *default_alloc(struct labcomm2014_memory *m, int lifetime, size_t size)
-{
-  return malloc(size);
-}
-
-void *default_realloc(struct labcomm2014_memory *m, int lifetime, 
-		      void *ptr, size_t size)
-{
-  return realloc(ptr, size);
-}
-
-void default_free(struct labcomm2014_memory *m, int lifetime, void *ptr)
-{
-  free(ptr);
-}
-
-struct labcomm2014_memory memory = {
-  .alloc = default_alloc,
-  .realloc = default_realloc,
-  .free = default_free,
-  .context = NULL
-};
-
-struct labcomm2014_memory *labcomm2014_default_memory = &memory;
diff --git a/lib/c/2014/labcomm2014_default_memory.h b/lib/c/2014/labcomm2014_default_memory.h
deleted file mode 100644
index 57947fb6e286a3b1a43913d0a35da564157539be..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_default_memory.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-  test_default_memory.h -- LabComm default memory allocator
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef __LABCOMM2014_DEFAULT_MEMORY_H__
-#define __LABCOMM2014_DEFAULT_MEMORY_H__
-
-#include <stdlib.h>
-#include "labcomm2014.h"
-
-extern struct labcomm2014_memory *labcomm2014_default_memory;
-
-#endif
diff --git a/lib/c/2014/labcomm2014_default_scheduler.c b/lib/c/2014/labcomm2014_default_scheduler.c
deleted file mode 100644
index f1fd3d6b4155c6d9e0bf29c6375c26c4bc7241a6..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_default_scheduler.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-  test_default_scheduler.c -- LabComm default scheduler
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "labcomm2014_default_scheduler.h"
-#include "labcomm2014_scheduler.h"
-#include "labcomm2014_scheduler_private.h"
-
-static int scheduler_free(struct labcomm2014_scheduler *s)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return 0;
-}
- 
-static int scheduler_writer_lock(struct labcomm2014_scheduler *s)
-{
-  return 0;
-}
- 
-static int scheduler_writer_unlock(struct labcomm2014_scheduler *s)
-{
-  return 0;
-}
-
-static int scheduler_data_lock(struct labcomm2014_scheduler *s)
-{
-  return 0;
-}
- 
-static int scheduler_data_unlock(struct labcomm2014_scheduler *s)
-{
-  return 0;
-}
-
-static struct labcomm2014_time *scheduler_now(struct labcomm2014_scheduler *s)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return NULL;
-}
- 
-static int scheduler_sleep(struct labcomm2014_scheduler *s,
-			   struct labcomm2014_time *t)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return 0;
-}
-
-static int scheduler_wakeup(struct labcomm2014_scheduler *s)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return 0;
-}
-
-static int scheduler_enqueue(struct labcomm2014_scheduler *s,
-			     uint32_t delay,
-			     void (*deferred)(void *context),
-			     void *context)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return 0;
-}
-
-static const struct labcomm2014_scheduler_action scheduler_action = {
-  .free = scheduler_free,
-  .writer_lock = scheduler_writer_lock,
-  .writer_unlock = scheduler_writer_unlock,
-  .data_lock = scheduler_data_lock,
-  .data_unlock = scheduler_data_unlock,
-  .now = scheduler_now,
-  .sleep = scheduler_sleep,
-  .wakeup = scheduler_wakeup,
-  .enqueue = scheduler_enqueue  
-};
-
-static struct labcomm2014_scheduler scheduler = {
-  .action = &scheduler_action,
-  .context = NULL
-};
-
-struct labcomm2014_scheduler *labcomm2014_default_scheduler = &scheduler;
diff --git a/lib/c/2014/labcomm2014_default_scheduler.h b/lib/c/2014/labcomm2014_default_scheduler.h
deleted file mode 100644
index db416f37d66c284d783223f18b0ac5ed0734dbf5..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_default_scheduler.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-  test_default_scheduler.h -- LabComm default scheduler
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef __LABCOMM2014_DEFAULT_SCHEDULER_H__
-#define __LABCOMM2014_DEFAULT_SCHEDULER_H__
-
-#include "labcomm2014.h"
-
-extern struct labcomm2014_scheduler *labcomm2014_default_scheduler;
-
-#endif
diff --git a/lib/c/2014/labcomm2014_dynamic_buffer_writer.c b/lib/c/2014/labcomm2014_dynamic_buffer_writer.c
deleted file mode 100644
index c2098625eaa72e50dba1344e410df085a5c4228e..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_dynamic_buffer_writer.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-  labcomm2014_dynamic_buffer_writer.c -- LabComm dynamic memory writer.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include "labcomm2014.h"
-#include "labcomm2014_private.h"
-#include "labcomm2014_ioctl.h"
-#include "labcomm2014_dynamic_buffer_writer.h"
-
-static int dyn_alloc(struct labcomm2014_writer *w, 
-		     struct labcomm2014_writer_action_context *action_context)
-{
-  w->data_size = 1000;
-  w->count = w->data_size;
-  w->data = labcomm2014_memory_alloc(w->memory, 1, w->data_size);
-  if (w->data == NULL) {
-    w->error = -ENOMEM;
-  }
-  w->pos = 0;
-
-  return w->error;
-}
-
-static int dyn_free(struct labcomm2014_writer *w, 
-		    struct labcomm2014_writer_action_context *action_context)
-{
-  labcomm2014_memory_free(w->memory, 1, w->data);
-  w->data = 0;
-  w->data_size = 0;
-  w->count = 0;
-  w->pos = 0;
-  labcomm2014_memory_free(w->memory, 0, action_context->context);
-  return 0;
-}
-
-static int dyn_start(struct labcomm2014_writer *w, 
-		     struct labcomm2014_writer_action_context *action_context,
-		     int index,
-		     const struct labcomm2014_signature *signature,
-		     void *value)
-{
-  void *tmp;
-
-  w->data_size = 1000;
-  w->count = w->data_size;
-  tmp = labcomm2014_memory_realloc(w->memory, 1, w->data, w->data_size);
-  if (tmp != NULL) {
-    w->data = tmp;
-    w->error = 0;
-  } else {
-    w->error = -ENOMEM;
-  }
-  w->pos = 0;
-
-  return w->error;
-}
-
-static int dyn_end(struct labcomm2014_writer *w, 
-		   struct labcomm2014_writer_action_context *action_context)
-{
-  return 0;
-}
-
-static int dyn_flush(struct labcomm2014_writer *w, 
-		     struct labcomm2014_writer_action_context *action_context)
-{
-  void *tmp;
-
-  w->data_size += 1000;
-  w->count = w->data_size;
-  tmp = labcomm2014_memory_realloc(w->memory, 1, w->data, w->data_size);
-  if (tmp != NULL) {
-    w->data = tmp;
-    w->error = 0;
-  } else {
-    /* Old pointer in w->data still valid */
-    w->error = -ENOMEM;
-  }
-
-  return w->error; 
-}
-
-static int dyn_ioctl(struct labcomm2014_writer *w, 
-		     struct labcomm2014_writer_action_context *action_context, 
-		     int signature_index,
-		     const struct labcomm2014_signature *signature,
-		     uint32_t action, va_list arg)
-{
-  int result = -ENOTSUP;
-  switch (action) {
-    case LABCOMM_IOCTL_WRITER_GET_BYTES_WRITTEN: {
-      int *value = va_arg(arg, int*);
-      *value = w->pos;
-      result = 0;
-    } break;
-    case LABCOMM_IOCTL_WRITER_GET_BYTE_POINTER: {
-      void **value = va_arg(arg, void**);
-      *value = w->data;
-      result = 0;
-    } break;
-  }
-  return result;
-}
-
-static const struct labcomm2014_writer_action action = {
-  .alloc = dyn_alloc,
-  .free = dyn_free,
-  .start = dyn_start,
-  .end = dyn_end,
-  .flush = dyn_flush,
-  .ioctl = dyn_ioctl
-};
-const struct labcomm2014_writer_action *labcomm2014_dynamic_buffer_writer_action = 
-  &action;
-
-struct labcomm2014_writer *labcomm2014_dynamic_buffer_writer_new(
-  struct labcomm2014_memory *memory)
-{
-  struct result {
-    struct labcomm2014_writer writer;
-    struct labcomm2014_writer_action_context action_context;
-  } *result;
-
-  result = labcomm2014_memory_alloc(memory, 0, sizeof(*result));
-  if (result != NULL) {
-    result->action_context.next = NULL;
-    result->action_context.context = result;
-    result->action_context.action = &action;
-    result->writer.action_context = &result->action_context;
-    result->writer.memory = memory;
-    return &result->writer;
-  }
-  return NULL;
-}
-
diff --git a/lib/c/2014/labcomm2014_dynamic_buffer_writer.h b/lib/c/2014/labcomm2014_dynamic_buffer_writer.h
deleted file mode 100644
index ce19d735cbfcc9a527770851cc3fc9d4127ed56b..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_dynamic_buffer_writer.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  labcomm2014_dynamic_buffer_writer.h -- LabComm dynamic memory writer.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_DYNAMIC_BUFFER_READER_WRITER_H__
-#define __LABCOMM2014_DYNAMIC_BUFFER_READER_WRITER_H__
-
-#include "labcomm2014.h"
-
-extern const struct labcomm2014_writer_action *labcomm2014_dynamic_buffer_writer_action;
-
-struct labcomm2014_writer *labcomm2014_dynamic_buffer_writer_new(
-  struct labcomm2014_memory *memory);
-
-#endif
diff --git a/lib/c/2014/labcomm2014_encoder.c b/lib/c/2014/labcomm2014_encoder.c
deleted file mode 100644
index cbd38c88cf18ecc9ba427d1be61e718d7ea48ac7..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_encoder.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
-  labcomm2014_encoder.c -- handling encoding of labcomm2014 samples.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  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 "LabComm2014"
-
-#include <errno.h>
-#include "labcomm2014.h"
-#include "labcomm2014_private.h"
-#include "labcomm2014_ioctl.h"
-#include "labcomm2014_dynamic_buffer_writer.h"
-
-//define the following to disable encoding of typedefs
-#undef LABCOMM_WITHOUT_TYPE_DEFS
-
-struct labcomm2014_encoder {
-  struct labcomm2014_writer *writer;
-  struct labcomm2014_error_handler *error;
-  struct labcomm2014_memory *memory;
-  struct labcomm2014_scheduler *scheduler;
-  LABCOMM_SIGNATURE_ARRAY_DEF(registered, int);
-  LABCOMM_SIGNATURE_ARRAY_DEF(sample_ref, int);
-  LABCOMM_SIGNATURE_ARRAY_DEF(typedefs, int);
-};
-
-static struct labcomm2014_encoder *internal_encoder_new(
-  struct labcomm2014_writer *writer,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler,
-  labcomm2014_bool outputVer)
-{
-  struct labcomm2014_encoder *result;
-
-  result = labcomm2014_memory_alloc(memory, 0, sizeof(*result));
-  if (result) {
-    int length;
-
-    result->writer = writer;
-    result->writer->encoder = result;
-    result->writer->data = NULL;
-    result->writer->data_size = 0;
-    result->writer->count = 0;
-    result->writer->pos = 0;
-    result->writer->error = 0;
-    result->error = error;
-    result->memory = memory;
-    result->scheduler = scheduler;
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->registered, int);
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->sample_ref, int);
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->typedefs, int);
-    labcomm2014_writer_alloc(result->writer,
-			 result->writer->action_context);
-    if(outputVer) {
-        labcomm2014_writer_start(result->writer,
-                            result->writer->action_context,
-                            LABCOMM_VERSION, NULL, CURRENT_VERSION);
-        labcomm2014_write_packed32(result->writer, LABCOMM_VERSION);
-        length = labcomm2014_size_string(CURRENT_VERSION);
-        labcomm2014_write_packed32(result->writer, length);
-        labcomm2014_write_string(result->writer, CURRENT_VERSION);
-        labcomm2014_writer_end(result->writer, result->writer->action_context);
-    }
-  }
-  return result;
-}
-
-struct labcomm2014_encoder *labcomm2014_encoder_new(
-  struct labcomm2014_writer *writer,
-  struct labcomm2014_error_handler *error,
-  struct labcomm2014_memory *memory,
-  struct labcomm2014_scheduler *scheduler)
-{
-    return internal_encoder_new(writer,error,memory,scheduler,LABCOMM2014_TRUE);
-}
-void labcomm2014_encoder_free(struct labcomm2014_encoder* e)
-{
-  struct labcomm2014_memory *memory = e->memory;
-
-  labcomm2014_writer_free(e->writer, e->writer->action_context);
-  LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->registered, int);
-  LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->sample_ref, int);
-  LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->typedefs, int);
-  labcomm2014_memory_free(memory, 0, e);
-}
-
-int labcomm2014_internal_encoder_register(
-  struct labcomm2014_encoder *e,
-  const struct labcomm2014_signature *signature,
-  labcomm2014_encoder_function encode)
-{
-  int result = -EINVAL;
-  int index, *done, err, i, length;
-
-  index = labcomm2014_get_local_index(signature);
-  labcomm2014_scheduler_writer_lock(e->scheduler);
-  if (index <= 0) { goto out; }
-  done = LABCOMM_SIGNATURE_ARRAY_REF(e->memory, e->registered, int, index);
-  if (*done) {
-      goto out; }
-  *done = 1;
-  err = labcomm2014_writer_start(e->writer, e->writer->action_context,
-			     index, signature, NULL);
-  if (err == -EALREADY) { result = 0; goto out; }
-  if (err != 0) { result = err; goto out; }
-  labcomm2014_write_packed32(e->writer, LABCOMM_SAMPLE_DEF);
-  length = (labcomm2014_size_packed32(index) +
-            labcomm2014_size_string(signature->name) +
-            labcomm2014_size_packed32(signature->size) +
-            signature->size);
-  labcomm2014_write_packed32(e->writer, length);
-  labcomm2014_write_packed32(e->writer, index);
-  labcomm2014_write_string(e->writer, signature->name);
-  labcomm2014_write_packed32(e->writer, signature->size);
-  for (i = 0 ; i < signature->size ; i++) {
-    if (e->writer->pos >= e->writer->count) {
-      labcomm2014_writer_flush(e->writer, e->writer->action_context);
-    }
-    e->writer->data[e->writer->pos] = signature->signature[i];
-    e->writer->pos++;
-  }
-  labcomm2014_writer_end(e->writer, e->writer->action_context);
-  result = e->writer->error;
-out:
-  labcomm2014_scheduler_writer_unlock(e->scheduler);
-  return result;
-}
-
-int labcomm2014_internal_encode(
-  struct labcomm2014_encoder *e,
-  const struct labcomm2014_signature *signature,
-  labcomm2014_encoder_function encode,
-  void *value)
-{
-  int result, index, length;
-
-  index = labcomm2014_get_local_index(signature);
-  length = (signature->encoded_size(value));
-  labcomm2014_scheduler_writer_lock(e->scheduler);
-  if (! LABCOMM_SIGNATURE_ARRAY_GET(e->registered, int, index, 0)) {
-    result = -EINVAL;
-    goto no_end;
-  }
-  result = labcomm2014_writer_start(e->writer, e->writer->action_context,
-				index, signature, value);
-  if (result == -EALREADY) { result = 0; goto no_end; }
-  if (result != 0) { goto out; }
-  result = labcomm2014_write_packed32(e->writer, index);
-  result = labcomm2014_write_packed32(e->writer, length);
-  if (result != 0) { goto out; }
-  result = encode(e->writer, value);
-out:
-  labcomm2014_writer_end(e->writer, e->writer->action_context);
-no_end:
-  labcomm2014_scheduler_writer_unlock(e->scheduler);
-  return result;
-}
-
-int labcomm2014_encoder_sample_ref_register(
-  struct labcomm2014_encoder *e,
-  const struct labcomm2014_signature *signature)
-{
-  int result = -EINVAL;
-  int index, *done, err, i, length;
-
-  index = labcomm2014_get_local_index(signature);
-  labcomm2014_scheduler_writer_lock(e->scheduler);
-  if (index <= 0) { goto out; }
-
-  done = LABCOMM_SIGNATURE_ARRAY_REF(e->memory, e->sample_ref, int, index);
-  if (*done) { goto out; }
-  *done = 1;
-  err = labcomm2014_writer_start(e->writer, e->writer->action_context,
-			     index, signature, NULL);
-  if (err == -EALREADY) { result = 0; goto out; }
-  if (err != 0) { result = err; goto out; }
-  labcomm2014_write_packed32(e->writer, LABCOMM_SAMPLE_REF);
-  length = (labcomm2014_size_packed32(index) +
-            labcomm2014_size_string(signature->name) +
-            labcomm2014_size_packed32(signature->size) +
-            signature->size);
-  labcomm2014_write_packed32(e->writer, length);
-  labcomm2014_write_packed32(e->writer, index);
-  labcomm2014_write_string(e->writer, signature->name);
-  labcomm2014_write_packed32(e->writer, signature->size);
-  for (i = 0 ; i < signature->size ; i++) {
-    if (e->writer->pos >= e->writer->count) {
-      labcomm2014_writer_flush(e->writer, e->writer->action_context);
-    }
-    e->writer->data[e->writer->pos] = signature->signature[i];
-    e->writer->pos++;
-  }
-  labcomm2014_writer_end(e->writer, e->writer->action_context);
-  result = e->writer->error;
-out:
-  labcomm2014_scheduler_writer_unlock(e->scheduler);
-  return result;
-}
-
-int labcomm2014_encoder_ioctl(struct labcomm2014_encoder *encoder,
-			  uint32_t action,
-			  ...)
-{
-  int result;
-  va_list va;
-
-  if (LABCOMM_IOC_SIG(action) != LABCOMM_IOC_NOSIG) {
-    result = -EINVAL;
-    goto out;
-  }
-
-  va_start(va, action);
-  result = labcomm2014_writer_ioctl(encoder->writer,
-			       encoder->writer->action_context,
-			       0, NULL, action, va);
-  va_end(va);
-
-out:
-  return result;
-}
-
-int labcomm2014_internal_encoder_ioctl(struct labcomm2014_encoder *encoder,
-				   const struct labcomm2014_signature *signature,
-				   uint32_t action, va_list va)
-{
-  int result = -ENOTSUP;
-  int index;
-
-  index = labcomm2014_get_local_index(signature);
-  result = labcomm2014_writer_ioctl(encoder->writer,
-				encoder->writer->action_context,
-				index, signature, action, va);
-  return result;
-}
-
-int labcomm2014_internal_encoder_signature_to_index(
-  struct labcomm2014_encoder *e, const struct labcomm2014_signature *signature)
-{
-  /* writer_lock should be held at this point */
-  int index = 0;
-  if (signature != NULL) {
-    index = labcomm2014_get_local_index(signature);
-    if (! LABCOMM_SIGNATURE_ARRAY_GET(e->sample_ref, int, index, 0)) {
-      index = 0;
-    }
-  }
-  return index;
-}
-
-
-/**********************************************************
- * Start of code related to sending (hierarchical)
- * typedefs. Define LABCOMM_WITHOUT_TYPEDEFS to disable
- **********************************************************/
-#ifndef LABCOMM_WITHOUT_TYPE_DEFS
-
-static void write_sig_tree_byte(char b, const struct labcomm2014_signature *signature,
-                           void *context)
-{
-  struct labcomm2014_encoder *e = context;
-  if(signature) {
-    labcomm2014_write_packed32(e->writer, labcomm2014_get_local_index(signature));
-  }else {
-    if (e->writer->pos >= e->writer->count) {
-     labcomm2014_writer_flush(e->writer, e->writer->action_context);
-    }
-    e->writer->data[e->writer->pos] = b;
-    e->writer->pos++;
-  }
-}
-
-static void do_write_signature(struct labcomm2014_encoder * e, 
-                               const struct labcomm2014_signature *signature, 
-                               unsigned char flatten)
-{
-  map_signature(write_sig_tree_byte, e, signature, flatten);
-}
-
-static void sig_size(char b, const struct labcomm2014_signature *signature,
-                     void *context)
-{
-  int *result = context;
-  int diff;
-  if(signature) {
-    int idx = labcomm2014_get_local_index(signature);
-    diff = labcomm2014_size_packed32(idx);
-  }else {
-    diff = 1;
-  }
-    (*result)+=diff;
-}
-
-static int calc_sig_encoded_size(struct labcomm2014_encoder *e,
-                                 const struct labcomm2014_signature *sig)
-{
-  int result=0;
-  map_signature(sig_size, &result, sig, LABCOMM2014_FALSE);
-  return result;
-}
-
-static int internal_reg_type(
-  struct labcomm2014_encoder *e,
-  const struct labcomm2014_signature *signature,
-  labcomm2014_bool flatten)
-{
-  int result = -EINVAL;
-  int index, *done, err;
-
-  index = labcomm2014_get_local_index(signature);
-  labcomm2014_scheduler_writer_lock(e->scheduler);
-  if (index <= 0) { goto out; }
-  done = LABCOMM_SIGNATURE_ARRAY_REF(e->memory, e->typedefs, int, index);
-  if (*done) { goto out; }
-  *done = 1;
-  err = labcomm2014_writer_start(e->writer, e->writer->action_context,
-                 index, signature, NULL);
-  if (err == -EALREADY) { result = 0; goto out; }
-  if (err != 0) { result = err; goto out; }
-
-  int sig_size = calc_sig_encoded_size(e, signature);
-  int len =  labcomm2014_size_packed32(index) +
-             labcomm2014_size_string(signature->name) +
-             labcomm2014_size_packed32(sig_size) +
-              sig_size;
-
-  labcomm2014_write_packed32(e->writer, LABCOMM_TYPE_DEF);
-  labcomm2014_write_packed32(e->writer, len);
-  labcomm2014_write_packed32(e->writer, index);
-  labcomm2014_write_string(e->writer, signature->name);
-  labcomm2014_write_packed32(e->writer, sig_size);
-  do_write_signature(e, signature, LABCOMM2014_FALSE);
-
-  labcomm2014_writer_end(e->writer, e->writer->action_context);
-  result = e->writer->error;
-out:
-  labcomm2014_scheduler_writer_unlock(e->scheduler);
-  return result;
-}
-#endif
-
-int labcomm2014_internal_encoder_type_register(
-  struct labcomm2014_encoder *e,
-  const struct labcomm2014_signature *signature)
-{
-#ifndef LABCOMM_WITHOUT_TYPE_DEFS
-  return internal_reg_type(e, signature, LABCOMM2014_FALSE);
-#else
-  return 0;
-#endif
-}
-int labcomm2014_internal_encoder_type_bind(
-  struct labcomm2014_encoder *e,
-  const struct labcomm2014_signature *signature,
-  char has_deps)
-{
-#ifndef LABCOMM_WITHOUT_TYPE_DEFS
-  int result = -EINVAL;
-  int err;
-  int sindex = labcomm2014_get_local_index(signature);
-  int tindex = has_deps ? labcomm2014_get_local_type_index(signature) : LABCOMM_BIND_SELF;
-  labcomm2014_scheduler_writer_lock(e->scheduler);
-  if(sindex <= 0 || (has_deps && tindex <= 0)) {goto out;}
-  err = labcomm2014_writer_start(e->writer, e->writer->action_context,
-			     LABCOMM_TYPE_BINDING, signature, NULL);
-  if (err == -EALREADY) { result = 0; goto out; }
-  if (err != 0) { result = err; goto out; }
-  int length = (labcomm2014_size_packed32(sindex) +
-                labcomm2014_size_packed32(tindex));
-  labcomm2014_write_packed32(e->writer, LABCOMM_TYPE_BINDING);
-  labcomm2014_write_packed32(e->writer, length);
-  labcomm2014_write_packed32(e->writer, sindex);
-  labcomm2014_write_packed32(e->writer, tindex);
-  labcomm2014_writer_end(e->writer, e->writer->action_context);
-  result = e->writer->error;
-
-out:
-  labcomm2014_scheduler_writer_unlock(e->scheduler);
-  return result;
-#else
-  return 0;
-#endif
-}
diff --git a/lib/c/2014/labcomm2014_error.c b/lib/c/2014/labcomm2014_error.c
deleted file mode 100644
index 9ea193b73daa5f0af9f7f7b10057286192fa4692..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_error.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-  labcomm2014_error.c -- labcomm2014 error handling
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include "labcomm2014_error.h"
-
-void labcomm2014_error_fatal_global(enum labcomm2014_error error,
-				char *format,
-				...)
-{
-  va_list args;
-
-  fprintf(stderr, "Fatal error %d\n", error);
-  va_start(args, format);
-  vprintf(format, args);
-  va_end(args);
-
-  exit(1);
-}
diff --git a/lib/c/2014/labcomm2014_error.h b/lib/c/2014/labcomm2014_error.h
deleted file mode 100644
index 9162e63acb7795e0b054833ac98d60765dc95e94..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_error.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-  labcomm2014_error.h -- labcomm2014 error declarations
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_ERROR_H___
-#define __LABCOMM2014_ERROR_H___
-
-enum labcomm2014_error {
-#define LABCOMM2014_ERROR(name, description) name ,
-#include "labcomm2014_error.h"
-#undef LABCOMM2014_ERROR
-};
-
-struct labcomm2014_error_handler;
-
-void labcomm2014_error_warning(struct labcomm2014_error_handler *e,
-			   enum labcomm2014_error,
-			   char *format,
-			   ...);
-			 
-void labcomm2014_error_fatal_global(enum labcomm2014_error error,
-				char *format,
-				...);
-			 
-#endif
-
-#ifdef LABCOMM2014_ERROR
-
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_SIGNATURE_ALREADY_SET,
-                  "Signature has already been set")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_SIGNATURE_NOT_SET,
-                  "Signature has not been set")
-
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_ENC_NO_REG_SIGNATURE,
-                  "Encoder has no registration for this signature")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_ENC_BUF_FULL,
-                  "The labcomm2014 buffer is full")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_DEC_UNKNOWN_DATATYPE,
-                  "Decoder: Unknown datatype")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_DEC_INDEX_MISMATCH,
-                  "Decoder: index mismatch")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_DEC_TYPE_NOT_FOUND,
-                  "Decoder: type not found")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_UNIMPLEMENTED_FUNC,
-                  "This function is not yet implemented")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_MEMORY,
-                  "Could not allocate memory")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_USER_DEF,
-                  "User defined error")
-LABCOMM2014_ERROR(LABCOMM2014_ERROR_BAD_WRITER,
-                  "Decoder: writer_ioctl() failed")
-
-#endif
diff --git a/lib/c/2014/labcomm2014_fd_reader.c b/lib/c/2014/labcomm2014_fd_reader.c
deleted file mode 100644
index ad2d22285e2b9b31b25e727fa40e9b33da6502c7..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_fd_reader.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-  labcomm2014_fd_reader.c -- LabComm reader for Unix file descriptors.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include "labcomm2014_private.h"
-#include "labcomm2014_fd_reader.h"
-
-#define BUFFER_SIZE 2048
-
-struct labcomm2014_fd_reader {
-  struct labcomm2014_reader reader;
-  struct labcomm2014_reader_action_context action_context;
-  int fd;
-  int close_fd_on_free;
-};
-
-static int fd_alloc(struct labcomm2014_reader *r,
-		    struct labcomm2014_reader_action_context *action_context)
-{
-  int result = 0;
-  
-  r->count = 0;
-  r->pos = 0;
-  r->data = labcomm2014_memory_alloc(r->memory, 0, BUFFER_SIZE);
-  if (! r->data) {
-    r->data_size = 0;
-    result = -ENOMEM;
-  } else {
-
-    r->data_size = BUFFER_SIZE;
-    result = r->data_size;
-  }
-  return result;
-}
-
-static int fd_free(struct labcomm2014_reader *r, 
-		   struct labcomm2014_reader_action_context *action_context)
-{
-  struct labcomm2014_fd_reader *fd_reader = action_context->context;
-  struct labcomm2014_memory *memory = r->memory;
-
-  labcomm2014_memory_free(memory, 0, r->data);
-  r->data = 0;
-  r->data_size = 0;
-  r->count = 0;
-  r->pos = 0;
-
-  if (fd_reader->close_fd_on_free) {
-    close(fd_reader->fd);
-  }
-  labcomm2014_memory_free(memory, 0, fd_reader);
-
-  return 0;
-}
-
-static int fd_fill(struct labcomm2014_reader *r, 
-		   struct labcomm2014_reader_action_context *action_context)
-{
-  int result = 0;
-  struct labcomm2014_fd_reader *fd_reader = action_context->context;
-
-  if (r->pos < r->count) {
-    result = r->count - r->pos;
-  } else {
-    int err;
-    
-    r->pos = 0;
-    err = read(fd_reader->fd, (char *)r->data, r->data_size);
-    if (err <= 0) {
-      r->count = 0;
-      r->error = -EPIPE;
-      result = -EPIPE;
-    } else {
-      r->count = err;
-      result = r->count - r->pos;
-    }
-  }
-  return result;
-}
-
-static const struct labcomm2014_reader_action action = {
-  .alloc = fd_alloc,
-  .free = fd_free,
-  .start = NULL,
-  .fill = fd_fill,
-  .end = NULL,
-  .ioctl = NULL
-};
-
-struct labcomm2014_reader *labcomm2014_fd_reader_new(struct labcomm2014_memory *memory,
-					     int fd, int close_fd_on_free)
-{
-  struct labcomm2014_fd_reader *result;
-
-  result = labcomm2014_memory_alloc(memory, 0, sizeof(*result));
-  if (result == NULL) {
-    return NULL;
-  } else {
-    result->action_context.next = NULL;
-    result->action_context.action = &action;
-    result->action_context.context = result;
-    result->reader.action_context = &result->action_context;
-    result->reader.memory = memory;
-    result->fd = fd;
-    result->close_fd_on_free = close_fd_on_free;
-    return &result->reader;
-  }
-}
diff --git a/lib/c/2014/labcomm2014_fd_reader.h b/lib/c/2014/labcomm2014_fd_reader.h
deleted file mode 100644
index 0391c6ccfc0c207f74511a87db7ae98e4dd3002f..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_fd_reader.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-  labcomm2014_fd_reader.c -- a reader for unix style file-descriptors
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_FD_READER_H__
-#define __LABCOMM2014_FD_READER_H__
-
-#include "labcomm2014.h"
-
-struct labcomm2014_reader *labcomm2014_fd_reader_new(struct labcomm2014_memory *memory,
-					     int fd, int close_fd_on_free);
-
-#endif
-
diff --git a/lib/c/2014/labcomm2014_fd_writer.c b/lib/c/2014/labcomm2014_fd_writer.c
deleted file mode 100644
index 42c9dbcc14eb765dbae6547000994a2c7c3c8153..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_fd_writer.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
-  labcomm2014_fd_writer.c -- LabComm writer for Unix file descriptors.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include "labcomm2014_private.h"
-#include "labcomm2014_fd_writer.h"
-
-#define BUFFER_SIZE 2048
-
-struct labcomm2014_fd_writer {
-  struct labcomm2014_writer writer;
-  struct labcomm2014_writer_action_context action_context;
-  int fd;
-  int close_fd_on_free;
-};
-
-static int fd_flush(struct labcomm2014_writer *w, 
-		    struct labcomm2014_writer_action_context *action_context);
-
-static int fd_alloc(struct labcomm2014_writer *w, 
-		    struct labcomm2014_writer_action_context *action_context)
-{
-  w->data = labcomm2014_memory_alloc(w->memory, 0, BUFFER_SIZE);
-  if (! w->data) {
-    w->error = -ENOMEM;
-    w->data_size = 0;
-    w->count = 0;
-    w->pos = 0;
-  } else {
-    w->data_size = BUFFER_SIZE;
-    w->count = BUFFER_SIZE;
-    w->pos = 0;
-  }
-
-  return w->error;
-}
-
-static int fd_free(struct labcomm2014_writer *w, 
-		   struct labcomm2014_writer_action_context *action_context)
-{
-  struct labcomm2014_fd_writer *fd_writer = action_context->context;
-  struct labcomm2014_memory *memory = w->memory;
-
-  labcomm2014_memory_free(memory, 0, w->data);
-  w->data = 0;
-  w->data_size = 0;
-  w->count = 0;
-  w->pos = 0;
-
-  if (fd_writer->close_fd_on_free) {
-    close(fd_writer->fd);
-  }
-  labcomm2014_memory_free(memory, 0, fd_writer);
-  return 0;
-}
-
-static int fd_start(struct labcomm2014_writer *w, 
-		    struct labcomm2014_writer_action_context *action_context,
-		    int index,
-		    const struct labcomm2014_signature *signature,
-		    void *value)
-{
-  w->pos = 0;
-  
-  return w->error;
-}
-
-static int fd_flush(struct labcomm2014_writer *w, 
-		    struct labcomm2014_writer_action_context *action_context)
-{
-  struct labcomm2014_fd_writer *fd_context = action_context->context;
-  int start, err;
-  
-  start = 0;
-  err = 0;
-  while (start < w->pos) {
-    err = write(fd_context->fd, (char *)&w->data[start], w->pos - start);
-    if (err <= 0) {
-      break;
-    }
-    start = start + err;
-  }
-  if (err < 0) {
-    w->error = -errno;
-  } else if (err == 0) {
-    w->error = -EINVAL;
-  }
-  w->pos = 0;
-   
-  return w->error;
-}
-
-static const struct labcomm2014_writer_action action = {
-  .alloc = fd_alloc,
-  .free = fd_free,
-  .start = fd_start,
-  .end = fd_flush,
-  .flush = fd_flush,
-  .ioctl = NULL
-};
-
-struct labcomm2014_writer *labcomm2014_fd_writer_new(struct labcomm2014_memory *memory,
-					     int fd, int close_fd_on_free)
-{
-  struct labcomm2014_fd_writer *result;
-
-  result = labcomm2014_memory_alloc(memory, 0, sizeof(*result));
-  if (result == NULL) {
-    return NULL;
-  } else {
-    result->action_context.next = NULL;
-    result->action_context.action = &action;
-    result->action_context.context = result;
-    result->writer.action_context = &result->action_context;
-    result->writer.memory = memory;
-    result->fd = fd;
-    result->close_fd_on_free = close_fd_on_free;
-    return &result->writer;
-  }
-}
diff --git a/lib/c/2014/labcomm2014_fd_writer.h b/lib/c/2014/labcomm2014_fd_writer.h
deleted file mode 100644
index 92145a55981b3bf0250b531bbb7f4e940062ab4e..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_fd_writer.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-  labcomm2014_fd_writer.c -- a writer for unix style file-descriptors
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_FD_WRITER_H__
-#define __LABCOMM2014_FD_WRITER_H__
-
-#include "labcomm2014.h"
-
-struct labcomm2014_writer *labcomm2014_fd_writer_new(struct labcomm2014_memory *memory,
-					     int fd, int close_on_free);
-
-#endif
-
diff --git a/lib/c/2014/labcomm2014_ioctl.h b/lib/c/2014/labcomm2014_ioctl.h
deleted file mode 100644
index bb321edb396cbf268cbf222a121ef7fa42235f33..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_ioctl.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-  labcomm2014_ioctl.h -- labcomm2014 ioctl declarations
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_IOCTL_H___
-#define __LABCOMM2014_IOCTL_H___
-
-#include "labcomm2014.h"
-
-/*
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | |   |                         |               |               |  
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *  | |   |                         |               |
- *  | |   |                         |               +- number    (8)
- *  | |   |                         +----------------- type      (8)
- *  | |   +------------------------------------------- size      (13)
- *  | +----------------------------------------------- direction (2)
- *  +------------------------------------------------- signature (1)
- *  
- * type 0-31     are reserved for labcomm2014 library use
- */
-
-
-#define LABCOMM_IOC_NRBITS      8
-#define LABCOMM_IOC_TYPEBITS    8
-#define LABCOMM_IOC_SIZEBITS   13
-#define LABCOMM_IOC_DIRBITS     2
-#define LABCOMM_IOC_SIGBITS     1
-#define LABCOMM_IOC_NRMASK     ((1 << LABCOMM_IOC_NRBITS)-1)
-#define LABCOMM_IOC_TYPEMASK   ((1 << LABCOMM_IOC_TYPEBITS)-1)
-#define LABCOMM_IOC_SIZEMASK   ((1 << LABCOMM_IOC_SIZEBITS)-1)
-#define LABCOMM_IOC_DIRMASK    ((1 << LABCOMM_IOC_DIRBITS)-1)
-#define LABCOMM_IOC_SIGMASK    ((1 << LABCOMM_IOC_SIGBITS)-1)
-#define LABCOMM_IOC_NRSHIFT    0
-#define LABCOMM_IOC_TYPESHIFT  (LABCOMM_IOC_NRSHIFT+LABCOMM_IOC_NRBITS)
-#define LABCOMM_IOC_SIZESHIFT  (LABCOMM_IOC_TYPESHIFT+LABCOMM_IOC_TYPEBITS)
-#define LABCOMM_IOC_DIRSHIFT   (LABCOMM_IOC_SIZESHIFT+LABCOMM_IOC_SIZEBITS)
-#define LABCOMM_IOC_SIGSHIFT   (LABCOMM_IOC_DIRSHIFT+LABCOMM_IOC_DIRBITS)
-
-#define LABCOMM_IOC_NOSIG       0U
-#define LABCOMM_IOC_USESIG      1U
-
-#define LABCOMM_IOC_NONE        0U
-#define LABCOMM_IOC_WRITE       1U
-#define LABCOMM_IOC_READ        2U
-
-#define LABCOMM_IOC(signature,dir,type,nr,size)	  \
-  (((signature) << LABCOMM_IOC_SIGSHIFT) |	  \
-   ((dir)       << LABCOMM_IOC_DIRSHIFT) |	  \
-   ((size)      << LABCOMM_IOC_SIZESHIFT) |	  \
-   ((type)      << LABCOMM_IOC_TYPESHIFT) |	  \
-   ((nr)        << LABCOMM_IOC_NRSHIFT))	  
-
-#define LABCOMM_IOC_SIG(nr) \
-  (((nr) >> LABCOMM_IOC_SIGSHIFT) & LABCOMM_IOC_SIGMASK)
-#define LABCOMM_IOC_DIR(nr) \
-  (((nr) >> LABCOMM_IOC_DIRSHIFT) & LABCOMM_IOC_DIRMASK)
-#define LABCOMM_IOC_SIZE(nr) \
-  (((nr) >> LABCOMM_IOC_SIZESHIFT) & LABCOMM_IOC_SIZEMASK)
-#define LABCOMM_IOC_TYPE(nr) \
-  (((nr) >> LABCOMM_IOC_TYPESHIFT) & LABCOMM_IOC_TYPEMASK)
-#define LABCOMM_IOC_NR(nr) \
-  (((nr) >> LABCOMM_IOC_NRSHIFT) & LABCOMM_IOC_NRMASK)
-
-#define LABCOMM_IO(type,nr)						\
-  LABCOMM_IOC(LABCOMM_IOC_NOSIG,LABCOMM_IOC_NONE,type,nr,0)
-#define LABCOMM_IOR(type,nr,size)					\
-  LABCOMM_IOC(LABCOMM_IOC_NOSIG,LABCOMM_IOC_READ,type,nr,sizeof(size))
-#define LABCOMM_IOW(type,nr,size)					\
-  LABCOMM_IOC(LABCOMM_IOC_NOSIG,LABCOMM_IOC_WRITE,type,nr,sizeof(size))
-#define LABCOMM_IOS(type,nr)                                    \
-  LABCOMM_IOC(LABCOMM_IOC_USESIG,LABCOMM_IOC_READ,type,nr,0)
-#define LABCOMM_IOSR(type,nr,size)					\
-  LABCOMM_IOC(LABCOMM_IOC_USESIG,LABCOMM_IOC_READ,type,nr,sizeof(size))
-#define LABCOMM_IOSW(type,nr,size)					\
-  LABCOMM_IOC(LABCOMM_IOC_USESIG,LABCOMM_IOC_WRITE,type,nr,sizeof(size))
-
-#define LABCOMM_IOCTL_WRITER_GET_BYTES_WRITTEN \
-  LABCOMM_IOR(0,1,int)
-#define LABCOMM_IOCTL_WRITER_GET_BYTE_POINTER \
-  LABCOMM_IOR(0,2,void*)
-
-#endif
diff --git a/lib/c/2014/labcomm2014_memory.c b/lib/c/2014/labcomm2014_memory.c
deleted file mode 100644
index 757640ad73124d1215d8409e78c0f27705aa92bd..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_memory.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-  labcomm2014_memory.c -- dynamic memory handlig dispatcher
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "labcomm2014_private.h"
-
-void *labcomm2014_memory_alloc(struct labcomm2014_memory *m, int lifetime, 
-			   size_t size) 
-{
-  return m->alloc(m, lifetime, size);
-}
-
-void *labcomm2014_memory_realloc(struct labcomm2014_memory *m, int lifetime, 
-			     void *ptr, size_t size) 
-{
-  return m->realloc(m, lifetime, ptr, size);
-}
-
-void labcomm2014_memory_free(struct labcomm2014_memory *m, int lifetime, 
-			 void *ptr)
-{
-  m->free(m, lifetime, ptr);
-}
diff --git a/lib/c/2014/labcomm2014_private.h b/lib/c/2014/labcomm2014_private.h
deleted file mode 100644
index 03060722be6d6ae17d5addb0d18abb6d7d95d531..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_private.h
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
-  labcomm2014_private.h -- semi private declarations for handling encoding and 
-                       decoding of labcomm2014 samples.
-
-  Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_PRIVATE_H__
-#define __LABCOMM2014_PRIVATE_H__
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#else
-  #include <endian.h>
-  #include <stdio.h>
-  #include <stdint.h>
-  #include <unistd.h>
-#endif
-
-//#include <stdlib.h>
-#include <string.h>
-#include "labcomm2014.h"
-
-/*
- * Allowed packet tags
- */
-#define LABCOMM_VERSION      0x01
-#define LABCOMM_SAMPLE_DEF   0x02
-#define LABCOMM_SAMPLE_REF   0x03
-#define LABCOMM_TYPE_DEF     0x04
-#define LABCOMM_TYPE_BINDING 0x05
-#define LABCOMM_PRAGMA       0x3f
-#define LABCOMM_USER         0x40 /* ..0xffffffff */
-
-/*
- * Predefined aggregate type indices
- */
-#define LABCOMM_ARRAY        0x10
-#define LABCOMM_STRUCT       0x11
-
-/*
- * Predefined primitive type indices
- */
-#define LABCOMM_BOOLEAN      0x20 
-#define LABCOMM_BYTE         0x21
-#define LABCOMM_SHORT        0x22
-#define LABCOMM_INT          0x23
-#define LABCOMM_LONG         0x24
-#define LABCOMM_FLOAT        0x25
-#define LABCOMM_DOUBLE       0x26
-#define LABCOMM_STRING       0x27
-#define LABCOMM_REF          0x28
-
-/* 
- * other special values
- */
-
-#define LABCOMM_BIND_SELF    0
-
-/*
- * Macro to automagically call constructors in modules compiled 
- * with the labcomm2014 compiler. If __attribute__((constructor)) is
- * not supported, these calls has to be done first in main program.
- */
-#ifndef LABCOMM_CONSTRUCTOR
-#define LABCOMM_CONSTRUCTOR __attribute__((constructor))
-#endif
-
-/*
- * Semi private dynamic memory declarations
- */
-
-struct labcomm2014_memory {
-  void *(*alloc)(struct labcomm2014_memory *m, int lifetime, size_t size);
-  void *(*realloc)(struct labcomm2014_memory *m, int lifetime, 
-		   void *ptr, size_t size);
-  void (*free)(struct labcomm2014_memory *m, int lifetime, void *ptr);
-  void *context;
-};
-
-/*
- * Semi private decoder declarations
- */
-typedef void (*labcomm2014_handler_function)(void *value, void *context);
-
-typedef void (*labcomm2014_decoder_function)(
-  struct labcomm2014_reader *r,
-  labcomm2014_handler_function handler,
-  void *context);
-
-struct labcomm2014_reader_action_context;
-
-struct labcomm2014_reader_action {
-  /* 'alloc' is called at the first invocation of 'labcomm2014_decoder_decode_one' 
-     on the decoder containing the reader.
-
-     Returned value:
-       >  0    Number of bytes allocated for buffering
-       <= 0    Error
-  */
-  int (*alloc)(struct labcomm2014_reader *r, 
-	       struct labcomm2014_reader_action_context *action_context);
-  /* 'free' returns the resources claimed by 'alloc' and might have other
-     reader specific side-effects as well.
-
-     Returned value:
-       == 0    Success
-       != 0    Error
-  */
-  int (*free)(struct labcomm2014_reader *r, 
-	      struct labcomm2014_reader_action_context *action_context);
-  /* 'start' is called at the following instances:
-     1. When a sample is registered 
-          (local_index != 0, remote_index == 0, value == NULL)
-     2. When a sample definition is received 
-          (local_index != 0, remote_index != 0, value == NULL)
-     3. When a sample is received
-          (local_index != 0, remote_index != 0, value != NULL)
-   */
-  int (*start)(struct labcomm2014_reader *r, 
-	       struct labcomm2014_reader_action_context *action_context,
-	       int local_index, int remote_index,
-	       const struct labcomm2014_signature *signature,
-	       void *value);
-  int (*end)(struct labcomm2014_reader *r, 
-	     struct labcomm2014_reader_action_context *action_context);
-  int (*fill)(struct labcomm2014_reader *r, 
-	      struct labcomm2014_reader_action_context *action_context);
-  int (*ioctl)(struct labcomm2014_reader *r, 
-	       struct labcomm2014_reader_action_context *action_context,
-	       int local_index, int remote_index,
-	       const struct labcomm2014_signature *signature, 
-	       uint32_t ioctl_action, va_list args);
-};
-
-struct labcomm2014_reader_action_context {
-  struct labcomm2014_reader_action_context *next;
-  const struct labcomm2014_reader_action *action;
-  void *context;  
-};
-
-struct labcomm2014_reader {
-  struct labcomm2014_reader_action_context *action_context;
-  struct labcomm2014_memory *memory;
-  /* The following fields are initialized by labcomm2014_decoder_new */
-  struct labcomm2014_decoder *decoder;
-  unsigned char *data;
-  int data_size;
-  int count;
-  int pos;
-  int error;
-};
-
-int labcomm2014_reader_alloc(struct labcomm2014_reader *r, 
-			 struct labcomm2014_reader_action_context *action_context);
-int labcomm2014_reader_free(struct labcomm2014_reader *r, 
-			struct labcomm2014_reader_action_context *action_context);
-int labcomm2014_reader_start(struct labcomm2014_reader *r, 
-			 struct labcomm2014_reader_action_context *action_context,
-			 int local_index, int remote_index,
-			 const struct labcomm2014_signature *signature,
-			 void *value);
-int labcomm2014_reader_end(struct labcomm2014_reader *r, 
-		       struct labcomm2014_reader_action_context *action_context);
-int labcomm2014_reader_fill(struct labcomm2014_reader *r, 
-			struct labcomm2014_reader_action_context *action_context);
-int labcomm2014_reader_ioctl(struct labcomm2014_reader *r, 
-			 struct labcomm2014_reader_action_context *action_context,
-			 int local_index, int remote_index,
-			 const struct labcomm2014_signature *signature, 
-			 uint32_t ioctl_action, va_list args);
-
-/*
- * Non typesafe registration function to be called from
- * generated labcomm2014_decoder_register_* functions.
- */
-int labcomm2014_internal_decoder_register(
-  struct labcomm2014_decoder *d, 
-  const struct labcomm2014_signature *s, 
-  labcomm2014_decoder_function decoder,
-  labcomm2014_handler_function handler,
-  void *context);
-
-int labcomm2014_internal_decoder_ioctl(struct labcomm2014_decoder *decoder, 
-				   const struct labcomm2014_signature *signature,
-				   uint32_t ioctl_action, va_list args);
-
-const struct labcomm2014_signature *labcomm2014_internal_decoder_index_to_signature(
-  struct labcomm2014_decoder *decoder, int index);
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define LABCOMM_DECODE(name, type)					\
-  static inline type labcomm2014_read_##name(struct labcomm2014_reader *r) {	\
-    type result; int i;							\
-    for (i = sizeof(type) - 1 ; i >= 0 ; i--) {				\
-      if (r->pos >= r->count) {						\
-	labcomm2014_reader_fill(r, r->action_context);			\
-	if (r->error < 0) {						\
-	  return 0;							\
-	}								\
-      }									\
-      ((unsigned char*)(&result))[i] = r->data[r->pos];			\
-      r->pos++;								\
-    }									\
-    return result;							\
-  }
-
-#else
-
-#define LABCOMM_DECODE(name, type)					\
-  static inline type labcomm2014_read_##name(struct labcomm2014_reader *r) {	\
-    type result; int i;							\
-    for (i = 0 ; i < sizeof(type) ; i++) {				\
-      if (r->pos >= r->count) {						\
-	labcomm2014_reader_fille(r, r->action_context);			\
-	if (r->error < 0) {						\
-	  return 0;							\
-	}								\
-      }									\
-      ((unsigned char*)(&result))[i] = r->data[r->pos];			\
-      r->pos++;								\
-    }									\
-    return result;							\
-  }
-
-#endif
-
-LABCOMM_DECODE(boolean, unsigned char)
-LABCOMM_DECODE(byte, unsigned char)
-LABCOMM_DECODE(short, short)
-LABCOMM_DECODE(int, int)
-LABCOMM_DECODE(long, long long)
-LABCOMM_DECODE(float, float)
-LABCOMM_DECODE(double, double)
-
-static inline unsigned int labcomm2014_read_packed32(struct labcomm2014_reader *r)
-{
-  unsigned int result = 0;
-  
-  while (1) {
-    unsigned char tmp;
-
-    if (r->pos >= r->count) {	
-      labcomm2014_reader_fill(r, r->action_context);
-      if (r->error != 0) {
-	goto out;
-      }
-    }
-    tmp = r->data[r->pos];
-    r->pos++;
-    result = (result << 7) | (tmp & 0x7f);
-    if ((tmp & 0x80) == 0) { 
-      break; 
-    }
-  }
-out:
-  return result;
-}
- 
-static inline char *labcomm2014_read_string(struct labcomm2014_reader *r)
-{
-  char *result = NULL;
-  int length, pos; 
-  
-  length = labcomm2014_read_packed32(r);
-  result = labcomm2014_memory_alloc(r->memory, 1, length + 1);
-  if (!result) {
-    labcomm20142014_on_error_fprintf(LABCOMM2014_ERROR_MEMORY, 4, "%d byte at %s:%d",
-		     length+1, __FUNCTION__, __LINE__);
-    return NULL;
-  }
-  for (pos = 0 ; pos < length ; pos++) {
-    if (r->pos >= r->count) {	
-      labcomm2014_reader_fill(r, r->action_context);
-      if (r->error < 0) {
-	goto out;
-      }
-    }
-    result[pos] = r->data[r->pos];
-    r->pos++;
-  }
-out:
-  result[pos] = 0;
-  return result;
-}
-
-/*
- * Semi private encoder declarations
- */
-typedef int (*labcomm2014_encoder_function)(struct labcomm2014_writer *,
-					void *value);
-struct labcomm2014_writer_action_context;
-
-struct labcomm2014_writer_action {
-  int (*alloc)(struct labcomm2014_writer *w, 
-	       struct labcomm2014_writer_action_context *action_context);
-  int (*free)(struct labcomm2014_writer *w, 
-	      struct labcomm2014_writer_action_context *action_context);
-  /* 'start' is called right before a sample is to be sent. In the 
-     case of a sample or typedef, 'value' == NULL.
-
-     Returned value:
-       == 0          Success -> continue sending the sample
-       == -EALREADY  Success -> silently skip sending the sample,
-                                'end' will not be called
-       < 0           Error
-   */
-  int (*start)(struct labcomm2014_writer *w, 
-	       struct labcomm2014_writer_action_context *action_context,
-	       int index, const struct labcomm2014_signature *signature,
-	       void *value);
-  int (*end)(struct labcomm2014_writer *w, 
-	     struct labcomm2014_writer_action_context *action_context);
-  int (*flush)(struct labcomm2014_writer *w, 
-	       struct labcomm2014_writer_action_context *action_context); 
-  int (*ioctl)(struct labcomm2014_writer *w, 
-	       struct labcomm2014_writer_action_context *action_context, 
-	       int index, const struct labcomm2014_signature *signature, 
-	       uint32_t ioctl_action, va_list args);
-};
-
-struct labcomm2014_writer_action_context {
-  struct labcomm2014_writer_action_context *next;
-  const struct labcomm2014_writer_action *action;
-  void *context;  
-};
-
-struct labcomm2014_writer {
-  struct labcomm2014_writer_action_context *action_context;
-  struct labcomm2014_memory *memory;
-  /* The following fields are initialized by labcomm2014_encoder_new */
-  struct labcomm2014_encoder *encoder;
-  unsigned char *data;
-  int data_size;
-  int count;
-  int pos;
-  int error;
-};
-
-int labcomm2014_writer_alloc(struct labcomm2014_writer *w, 
-			 struct labcomm2014_writer_action_context *action_context);
-int labcomm2014_writer_free(struct labcomm2014_writer *w, 
-			struct labcomm2014_writer_action_context *action_context);
-int labcomm2014_writer_start(struct labcomm2014_writer *w, 
-			 struct labcomm2014_writer_action_context *action_context,
-			 int index, const struct labcomm2014_signature *signature,
-			 void *value);
-int labcomm2014_writer_end(struct labcomm2014_writer *w, 
-		       struct labcomm2014_writer_action_context *action_context);
-int labcomm2014_writer_flush(struct labcomm2014_writer *w, 
-			 struct labcomm2014_writer_action_context *action_context); 
-int labcomm2014_writer_ioctl(struct labcomm2014_writer *w, 
-			 struct labcomm2014_writer_action_context *action_context, 
-			 int index, const struct labcomm2014_signature *signature, 
-			 uint32_t ioctl_action, va_list args);
-
-int labcomm2014_internal_encoder_type_register(
-  struct labcomm2014_encoder *e,
-  const struct labcomm2014_signature *signature);
-
-int labcomm2014_internal_encoder_type_bind(
-  struct labcomm2014_encoder *e,
-  const struct labcomm2014_signature *signature,
-  char has_deps);
-
-int labcomm2014_internal_encoder_register(
-  struct labcomm2014_encoder *encoder, 
-  const struct labcomm2014_signature *signature, 
-  labcomm2014_encoder_function encode);
-
-int labcomm2014_internal_encode(
-  struct labcomm2014_encoder *encoder, 
-  const struct labcomm2014_signature *signature, 
-  labcomm2014_encoder_function encode,
-  void *value);
-
-int labcomm2014_internal_encoder_ioctl(struct labcomm2014_encoder *encoder, 
-				   const struct labcomm2014_signature *signature,
-				   uint32_t ioctl_action, va_list args);
-
-int labcomm2014_internal_encoder_signature_to_index(
-  struct labcomm2014_encoder *encoder, const struct labcomm2014_signature *signature);
-
-int labcomm2014_internal_sizeof(const struct labcomm2014_signature *signature,
-                            void *v);
-
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define LABCOMM_ENCODE(name, type)					\
-  static inline int labcomm2014_write_##name(struct labcomm2014_writer *w, type data) { \
-    int i;								\
-    for (i = sizeof(type) - 1 ; i >= 0 ; i--) {				\
-      if (w->pos >= w->count) { /*buffer is full*/			\
-        int err;							\
-	err = labcomm2014_writer_flush(w, w->action_context);		\
-	if (err != 0) { return err; }					\
-      }									\
-      w->data[w->pos] = ((unsigned char*)(&data))[i];			\
-      w->pos++;								\
-    }									\
-    return 0;								\
-  }
-
-#else
-
-#define LABCOMM_ENCODE(name, type)					\
-  static inline int labcomm2014_write_##name(struct labcomm2014_writer *w, type data) { \
-    int i;								\
-    for (i = 0 ; i < sizeof(type) ; i++) {				\
-      if (w->pos >= w->count) {						\
-        int err;							\
-	err = labcomm2014_writer_flush(w, w->action_context);		\
-	if (err != 0) { return err; }					\
-      }									\
-      w->data[w->pos] = ((unsigned char*)(&data))[i];			\
-      w->pos++;								\
-    }									\
-    return 0;								\
-  }
-
-#endif
-
-LABCOMM_ENCODE(boolean, unsigned char)
-LABCOMM_ENCODE(byte, unsigned char)
-LABCOMM_ENCODE(short, short)
-LABCOMM_ENCODE(int, int)
-LABCOMM_ENCODE(long, long long)
-LABCOMM_ENCODE(float, float)
-LABCOMM_ENCODE(double, double)
-
-static inline int labcomm2014_write_packed32(struct labcomm2014_writer *w, 
-					 unsigned int data)
-{
-  unsigned char tmp[5];
-  int i;
-  
-  for (i = 0 ; i == 0 || data ; i++, data = (data >> 7)) {
-    tmp[i] = data & 0x7f;
-  }
-  for (i = i - 1 ; i >= 0 ; i--) {
-    if (w->pos >= w->count) {					
-      int err;
-      err = labcomm2014_writer_flush(w, w->action_context);	
-      if (err != 0) { return err; }
-    }
-    w->data[w->pos++] = tmp[i] | (i?0x80:0x00);
-  }
-  return 0;
-}
-
-static inline int labcomm2014_write_string(struct labcomm2014_writer *w, char *s)
-{
-  int length, i, err; 
-
-  length = strlen(s);
-  err = labcomm2014_write_packed32(w, length);
-  if (err != 0) { return err; }
-  for (i = 0 ; i < length ; i++) {
-    if (w->pos >= w->count) {	
-      int err;
-      err = labcomm2014_writer_flush(w, w->action_context);	
-      if (err != 0) { return err; }
-    }
-    w->data[w->pos] = s[i];
-    w->pos++;
-  }
-  return 0;
-}
-
-/* Size of packed32 variable */
-static inline int labcomm2014_size_packed32(unsigned int data)
-{
-  int result = 0;
-  int i;
-
-  for (i = 0 ; i == 0 || data ; i++, data = (data >> 7)) {
-    result++;
-  }
-  return result;
-
-}
-
-static inline int labcomm2014_size_string(char *s)
-{
-  int length = strlen(s);
-  
-  return labcomm2014_size_packed32(length) + length;
-}
-
-/*
- * Macros for handling arrays indexed by signature index
- */
-
-#define LABCOMM_SIGNATURE_ARRAY_DEF(name, kind)	\
-  struct {					\
-    int first;					\
-    int last;					\
-    kind *data;					\
-  } name
-
-#define LABCOMM_SIGNATURE_ARRAY_DEF_INIT(name, kind)		\
-  LABCOMM_SIGNATURE_ARRAY_DEF(name, kind) = { 0, 0, NULL }
-
-#define LABCOMM_SIGNATURE_ARRAY_INIT(name, kind)		\
-  name.first = 0; name.last = 0; name.data = NULL;		\
-  name.data = (kind *)name.data; /* typechecking no-op */
-
-#define LABCOMM_SIGNATURE_ARRAY_FREE(memory, name, kind)	\
-  if (name.data) { labcomm2014_memory_free(memory, 0, name.data); }	\
-  name.data = (kind *)NULL; /* typechecking */
-
-void *labcomm2014_signature_array_ref(struct labcomm2014_memory * memory,
-				  int *first, int *last, void **data,
-				  int size, int index);
-/*
- * NB: the pointer returned by LABCOMM_SIGNATURE_ARRAY_REF might be
- *     rendered invalid by a subsequent call to LABCOMM_SIGNATURE_ARRAY_REF
- *     on the same SIGNATURE_ARRAY, so make sure not to use the result if 
- *     any other code might have made a call to LABCOMM_SIGNATURE_ARRAY_REF
- *     on the same SIGNATURE_ARRAY.
- */
-#define LABCOMM_SIGNATURE_ARRAY_REF(memory, name, kind, index)		\
-  (name.data = (kind *)name.data, /* typechecking no-op */		\
-   (kind *)(labcomm2014_signature_array_ref(memory,				\
-					&name.first, &name.last,	\
-					(void **)&name.data,		\
-					sizeof(kind), index)))
-
-#define LABCOMM_SIGNATURE_ARRAY_GET(name, kind, index, nomatch)         \
-  (name.data = (kind *)name.data, /* typechecking no-op */		\
-   (name.first <= index &&                                              \
-    index < name.last) ? name.data[index - name.first] : nomatch)
-
-#define LABCOMM_SIGNATURE_ARRAY_FOREACH(name, kind, var)		\
-  for (name.data = (kind *)name.data, /* typechecking no-op */		\
-       var = name.first ; var < name.last ; var++)
-
-/* Give signature a free local index, this may not be used concurrently */
-void labcomm2014_set_local_index(struct labcomm2014_signature *signature);
-
-/* Get the local index for a signature */
-int labcomm2014_get_local_index(const struct labcomm2014_signature *s);
-
-int labcomm2014_get_local_type_index(const struct labcomm2014_signature *s);
-
-#endif
diff --git a/lib/c/2014/labcomm2014_pthread_scheduler.c b/lib/c/2014/labcomm2014_pthread_scheduler.c
deleted file mode 100644
index e2f5a21be18660d34fbd36575d7012d0e594e66d..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_pthread_scheduler.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
-  labcomm2014_pthread_scheduler.c -- labcomm2014 pthread based task coordination
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  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 _POSIX_C_SOURCE (200112L)
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "labcomm2014.h"
-#include "labcomm2014_scheduler.h"
-#include "labcomm2014_scheduler_private.h"
-#include "labcomm2014_pthread_scheduler.h"
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#endif 
-
-struct pthread_time {
-  struct labcomm2014_time time;
-  struct labcomm2014_memory *memory;
-  struct timespec abstime;
-};
-
-struct pthread_deferred {
-  struct pthread_deferred *next;
-  struct pthread_deferred *prev;
-  struct timespec when;
-  void (*action)(void *context);
-  void *context;
-};
-
-struct pthread_scheduler {
-  struct labcomm2014_scheduler scheduler;
-  struct labcomm2014_memory *memory;
-  int wakeup;
-  pthread_mutex_t writer_mutex;
-  pthread_mutex_t data_mutex;
-  pthread_cond_t data_cond;
-  int running_deferred;
-  struct pthread_deferred deferred;
-  struct pthread_deferred deferred_with_delay;
-};
-
-static struct labcomm2014_time_action time_action;
-
-static int queue_empty(struct pthread_deferred *queue)
-{
-  return queue->next == queue;
-}
-
-static void timespec_add_usec(struct timespec *t, uint32_t usec)
-{
-  time_t sec = usec / 1000000;
-  long nsec = (usec % 1000000) * 1000;
-  
-  t->tv_nsec += nsec;
-  t->tv_sec += sec + t->tv_nsec / 1000000000;
-  t->tv_nsec %= 1000000000;
-}
-
-static int timespec_compare(struct timespec *t1, struct timespec *t2)
-{
-  if (t1->tv_sec == t2->tv_sec && t1->tv_nsec == t2->tv_nsec) {
-    return 0;
-  } else if (t1->tv_sec == 0 && t1->tv_nsec == 0) {
-    /* t1 is at end of time */
-    return 1;
-  } else  if (t2->tv_sec == 0 && t2->tv_nsec == 0) {
-    /* t2 is at end of time */
-    return -1;
-  } else if (t1->tv_sec < t2->tv_sec) {
-    return -1;
-  } else if (t1->tv_sec == t2->tv_sec) {
-    if (t1->tv_nsec < t2->tv_nsec) {
-      return -1;
-    } else if (t1->tv_nsec == t2->tv_nsec) {
-      return 0;
-    } else {
-      return 1;
-    }
-  } else {
-    return 1;
-  }
-}
-
-static struct labcomm2014_time *time_new(struct labcomm2014_memory *memory)
-{
-  struct pthread_time *time;
-
-  time = labcomm2014_memory_alloc(memory, 0, sizeof(*time));
-  if (time == NULL) {
-    return NULL;
-  } else {
-    time->time.action = &time_action;
-    time->time.context = time;
-    time->memory = memory;
-    clock_gettime(CLOCK_REALTIME, &time->abstime);
-    return &time->time;
-  }
-}
-
-static int time_free(struct labcomm2014_time *t)
-{
-  struct pthread_time *time = t->context;
-  struct labcomm2014_memory *memory = time->memory;
-  
-  labcomm2014_memory_free(memory, 0, time);
-  
-  return 0;
-}
- 
-static int time_add_usec(struct labcomm2014_time *t, uint32_t usec)
-{
-  struct pthread_time *time = t->context;
-
-  timespec_add_usec(&time->abstime, usec);
-
-  return 0;
-}
-
-static struct labcomm2014_time_action time_action = {
-  .free = time_free,
-  .add_usec = time_add_usec
-};
-
-static int run_action(struct pthread_scheduler *scheduler,
-		      struct pthread_deferred *element)
-{
-  /* Called with data_lock held */
-  element->prev->next = element->next;
-  element->next->prev = element->prev;
-  labcomm2014_scheduler_data_unlock(&scheduler->scheduler);
-  element->action(element->context);
-  labcomm2014_memory_free(scheduler->memory, 1, element);
-  labcomm2014_scheduler_data_lock(&scheduler->scheduler);
-  return 0;
-}
-
-static int run_deferred(struct pthread_scheduler *scheduler)
-{
-  /* Called with data_lock held */
-  if (scheduler->running_deferred) { goto out; }
-  scheduler->running_deferred = 1;
-  while (!queue_empty(&scheduler->deferred)) {
-    run_action(scheduler, scheduler->deferred.next);
-  }
-  if (!queue_empty(&scheduler->deferred_with_delay)) {
-    struct timespec now;
-
-    clock_gettime(CLOCK_REALTIME, &now);
-    while (timespec_compare(&scheduler->deferred_with_delay.next->when,
-			    &now) <= 0) {
-      run_action(scheduler, scheduler->deferred_with_delay.next);
-    }
-  }
-  scheduler->running_deferred = 0;
-out:
-  return 0;
-}
-
-static int scheduler_free(struct labcomm2014_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-  struct labcomm2014_memory *memory = scheduler->memory;
-  
-  labcomm2014_memory_free(memory, 0, scheduler);
-
-  return 0;
-}
- 
-static int scheduler_writer_lock(struct labcomm2014_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  labcomm2014_scheduler_data_lock(&scheduler->scheduler);
-  run_deferred(scheduler);  /* Run deferred tasks before taking lock */
-  labcomm2014_scheduler_data_unlock(&scheduler->scheduler);
-  if (pthread_mutex_lock(&scheduler->writer_mutex) != 0) {
-    return -errno;
-  }
-  return 0;
-}
- 
-static int scheduler_writer_unlock(struct labcomm2014_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  if (pthread_mutex_unlock(&scheduler->writer_mutex) != 0) {
-    return -errno;
-  }
-  labcomm2014_scheduler_data_lock(&scheduler->scheduler);
-  run_deferred(scheduler);  /* Run deferred tasks after releasing lock */
-  labcomm2014_scheduler_data_unlock(&scheduler->scheduler);
-  
-  return 0;
-}
-
-static int scheduler_data_lock(struct labcomm2014_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  if (pthread_mutex_lock(&scheduler->data_mutex) != 0) {
-    perror("Failed to lock data_mutex");
-    exit(1);
-  }
-  return 0;
-}
- 
-static int scheduler_data_unlock(struct labcomm2014_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  if (pthread_mutex_unlock(&scheduler->data_mutex) != 0) {
-    perror("Failed to unlock data_mutex");
-    exit(1);
-  }
-  
-  return 0;
-}
-
-static struct labcomm2014_time *scheduler_now(struct labcomm2014_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  return time_new(scheduler->memory);
-}
- 
-static int scheduler_sleep(struct labcomm2014_scheduler *s,
-			   struct labcomm2014_time *t)
-{
-  struct pthread_scheduler *scheduler = s->context;
-  struct pthread_time *time = t?t->context:NULL;
-
-  labcomm2014_scheduler_data_lock(&scheduler->scheduler);
-  while (1) {
-    struct timespec *wakeup, now;
-
-    /* Run deferred tasks before sleeping */
-    run_deferred(scheduler);
-    
-    clock_gettime(CLOCK_REALTIME, &now);
-    if (scheduler->wakeup ||
-	(time && timespec_compare(&time->abstime, &now) <= 0)) {
-      /* Done waiting */
-      scheduler->wakeup = 0;
-      break;
-    }
-    wakeup = NULL;
-    if (!queue_empty(&scheduler->deferred_with_delay)) {
-      wakeup = &scheduler->deferred_with_delay.next->when;
-      if (time && timespec_compare(&time->abstime, wakeup) < 0) {
-	wakeup = &time->abstime;
-      }
-    } else if (time) {
-      wakeup = &time->abstime;
-    }
- 
-    if (wakeup) {
-      pthread_cond_timedwait(&scheduler->data_cond, 
-			     &scheduler->data_mutex, 
-			     wakeup);
-    } else {
-      pthread_cond_wait(&scheduler->data_cond, 
-			&scheduler->data_mutex);
-    }
-  }
-  labcomm2014_scheduler_data_unlock(&scheduler->scheduler);
-  
-  return 0;
-}
-
-static int scheduler_wakeup(struct labcomm2014_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  labcomm2014_scheduler_data_lock(&scheduler->scheduler);
-  scheduler->wakeup = 1;
-  pthread_cond_signal(&scheduler->data_cond);
-  labcomm2014_scheduler_data_unlock(&scheduler->scheduler);
-  return 0;
-}
-
-static int scheduler_enqueue(struct labcomm2014_scheduler *s,
-			     uint32_t delay,
-			     void (*deferred)(void *context),
-			     void *context)
-{
-  struct pthread_scheduler *scheduler = s->context;
-  int result = 0;
-  struct pthread_deferred *element, *insert_before;
-
-  element = labcomm2014_memory_alloc(scheduler->memory, 1, sizeof(*element));
-  if (element == NULL) {
-    result = -ENOMEM;
-    goto out;
-  }
-  
-  element->action = deferred;
-  element->context = context;
-  labcomm2014_scheduler_data_lock(&scheduler->scheduler);
-  if (delay == 0) {
-    insert_before = &scheduler->deferred;
-  } else {
-    clock_gettime(CLOCK_REALTIME, &element->when);
-    timespec_add_usec(&element->when, delay);
-    for (insert_before = scheduler->deferred_with_delay.next ; 
-	 timespec_compare(&element->when, &insert_before->when) >= 0 ;
-	 insert_before = insert_before->next) {
-    }
-  }
-  element->next = insert_before;
-  element->prev = insert_before->prev;
-  element->prev->next = element;
-  element->next->prev = element;
-  pthread_cond_signal(&scheduler->data_cond);
-  labcomm2014_scheduler_data_unlock(&scheduler->scheduler);
-
-out:
-  return result;
-}
-
-static const struct labcomm2014_scheduler_action scheduler_action = {
-  .free = scheduler_free,
-  .writer_lock = scheduler_writer_lock,
-  .writer_unlock = scheduler_writer_unlock,
-  .data_lock = scheduler_data_lock,
-  .data_unlock = scheduler_data_unlock,
-  .now = scheduler_now,
-  .sleep = scheduler_sleep,
-  .wakeup = scheduler_wakeup,
-  .enqueue = scheduler_enqueue  
-};
-
-struct labcomm2014_scheduler *labcomm2014_pthread_scheduler_new(
-  struct labcomm2014_memory *memory)
-{
-  struct labcomm2014_scheduler *result = NULL;
-  struct pthread_scheduler *scheduler;
-
-  scheduler = labcomm2014_memory_alloc(memory, 0, sizeof(*scheduler));
-  if (scheduler == NULL) {
-    goto out;
-  } else {
-    scheduler->scheduler.action = &scheduler_action;
-    scheduler->scheduler.context = scheduler;
-    scheduler->wakeup = 0;
-    scheduler->memory = memory;
-    if (pthread_mutex_init(&scheduler->writer_mutex, NULL) != 0) {
-      goto free_scheduler;
-    }
-     if (pthread_mutex_init(&scheduler->data_mutex, NULL) != 0) {
-       goto destroy_writer_mutex;
-    }
-    if (pthread_cond_init(&scheduler->data_cond, NULL) != 0) {
-      goto destroy_data_mutex;
-    }
-    scheduler->running_deferred = 0;
-    scheduler->deferred.next = &scheduler->deferred;
-    scheduler->deferred.prev = &scheduler->deferred;
-    scheduler->deferred_with_delay.next = &scheduler->deferred_with_delay;
-    scheduler->deferred_with_delay.prev = &scheduler->deferred_with_delay;
-    scheduler->deferred_with_delay.when.tv_sec = 0;
-    scheduler->deferred_with_delay.when.tv_nsec = 0;
-    result = &scheduler->scheduler;
-    goto out;
-  }
-destroy_data_mutex:
-  pthread_mutex_destroy(&scheduler->data_mutex);
-destroy_writer_mutex:
-  pthread_mutex_destroy(&scheduler->writer_mutex);
-free_scheduler:
-  labcomm2014_memory_free(memory, 0, scheduler);
-out:
-  return result;
-  
-}
-
diff --git a/lib/c/2014/labcomm2014_pthread_scheduler.h b/lib/c/2014/labcomm2014_pthread_scheduler.h
deleted file mode 100644
index e8e5a1b49581e33098cb2ed7d41876433befd73c..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_pthread_scheduler.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-  labcomm2014_pthread_scheduler.h -- labcomm2014 pthread based task coordination
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_PTHREAD_SCHEDULER_H__
-#define __LABCOMM2014_PTHREAD_SCHEDULER_H__
-
-#include "labcomm2014.h"
-
-struct labcomm2014_scheduler *labcomm2014_pthread_scheduler_new(
-  struct labcomm2014_memory *memory);
-
-#endif
-
diff --git a/lib/c/2014/labcomm2014_scheduler.c b/lib/c/2014/labcomm2014_scheduler.c
deleted file mode 100644
index 40288207149d93efc11c5084433b04d374b26a0c..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_scheduler.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-  labcomm2014_scheduler.c -- labcomm2014 task coordination
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <errno.h>
-#include "labcomm2014_scheduler_private.h"
-
-#define SCHEDULER_scheduler(scheduler, ...) scheduler
-#define SCHEDULER(func, ...)						\
-  if (SCHEDULER_scheduler(__VA_ARGS__) &&				\
-      SCHEDULER_scheduler(__VA_ARGS__)->action->func) {			\
-    return SCHEDULER_scheduler(__VA_ARGS__)->action->func(__VA_ARGS__);	\
-  }									\
-  return -ENOSYS;
-
-int labcomm2014_scheduler_free(struct labcomm2014_scheduler *s)
-{
-  SCHEDULER(free, s);
-}
-
-int labcomm2014_scheduler_writer_lock(struct labcomm2014_scheduler *s)
-{
-  SCHEDULER(writer_lock, s);
-}
-
-int labcomm2014_scheduler_writer_unlock(struct labcomm2014_scheduler *s)
-{
-  SCHEDULER(writer_unlock, s);
-}
-
-int labcomm2014_scheduler_data_lock(struct labcomm2014_scheduler *s)
-{
-  SCHEDULER(data_lock, s);
-}
-
-int labcomm2014_scheduler_data_unlock(struct labcomm2014_scheduler *s)
-{
-  SCHEDULER(data_unlock, s);
-}
-
-struct labcomm2014_time *labcomm2014_scheduler_now(struct labcomm2014_scheduler *s)
-{
-  if (s && s->action->now) {
-    return s->action->now(s); 
-  } 
-  return NULL;
-}
-
-int labcomm2014_scheduler_sleep(struct labcomm2014_scheduler *s,
-			    struct labcomm2014_time *wakeup)
-{
-  SCHEDULER(sleep, s, wakeup);
-}
-
-int labcomm2014_scheduler_wakeup(struct labcomm2014_scheduler *s)
-{
-  SCHEDULER(wakeup, s);
-}
-
-int labcomm2014_scheduler_enqueue(struct labcomm2014_scheduler *s,
-			      uint32_t delay,
-			      void (*func)(void *context),
-			      void *context)
-{
-  SCHEDULER(enqueue, s, delay, func, context);
-}
-
-
diff --git a/lib/c/2014/labcomm2014_scheduler.h b/lib/c/2014/labcomm2014_scheduler.h
deleted file mode 100644
index 8d7e33217fcd7e7b043bfd527e10d429f29c42b4..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_scheduler.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-  labcomm2014_scheduler.h -- labcomm2014 task coordination
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_SCHEDULER_H__
-#define __LABCOMM2014_SCHEDULER_H__
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#else
-  #include <unistd.h>
-  #include <stdint.h>
-#endif
-
-struct labcomm2014_time;
-
-int labcomm2014_time_free(struct labcomm2014_time *t);
-int labcomm2014_time_add_usec(struct labcomm2014_time *t, uint32_t usec);
-
-struct labcomm2014_scheduler;
-
-int labcomm2014_scheduler_free(struct labcomm2014_scheduler *s);
-
-/* Lock and event handling */
-int labcomm2014_scheduler_writer_lock(struct labcomm2014_scheduler *s);
-int labcomm2014_scheduler_writer_unlock(struct labcomm2014_scheduler *s);
-int labcomm2014_scheduler_data_lock(struct labcomm2014_scheduler *s);
-int labcomm2014_scheduler_data_unlock(struct labcomm2014_scheduler *s);
-
-/* Time handling */
-struct labcomm2014_time *labcomm2014_scheduler_now(struct labcomm2014_scheduler *s);
-int labcomm2014_scheduler_sleep(struct labcomm2014_scheduler *s,
-			    struct labcomm2014_time *wakeup);
-int labcomm2014_scheduler_wakeup(struct labcomm2014_scheduler *s);
-
-/* Deferred action handling */
-int labcomm2014_scheduler_enqueue(struct labcomm2014_scheduler *s,
-			      uint32_t delay,
-			      void (*deferred)(void *context),
-			      void *context);
-
-#endif
-
diff --git a/lib/c/2014/labcomm2014_scheduler_private.h b/lib/c/2014/labcomm2014_scheduler_private.h
deleted file mode 100644
index 31f4cdae3cef6d89d6d42971f7fc13b36982e02d..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_scheduler_private.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-  labcomm2014_scheduler.h -- labcomm2014 task coordination, semi-private part
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LABCOMM2014_SCHEDULER_PRIVATE_H__
-#define __LABCOMM2014_SCHEDULER_PRIVATE_H__
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#else
-  #include <unistd.h>
-#endif
-
-#include "labcomm2014_scheduler.h"
-
-struct labcomm2014_time {
-  const struct labcomm2014_time_action {
-    int (*free)(struct labcomm2014_time *t);
-    int (*add_usec)(struct labcomm2014_time *t, uint32_t usec);
-  } *action;
-  void *context;
-};
-
-struct labcomm2014_scheduler {
-  const struct labcomm2014_scheduler_action {
-    int (*free)(struct labcomm2014_scheduler *s);
-    int (*writer_lock)(struct labcomm2014_scheduler *s);
-    int (*writer_unlock)(struct labcomm2014_scheduler *s);
-    int (*data_lock)(struct labcomm2014_scheduler *s);
-    int (*data_unlock)(struct labcomm2014_scheduler *s);
-    struct labcomm2014_time *(*now)(struct labcomm2014_scheduler *s);
-    int (*sleep)(struct labcomm2014_scheduler *s,
-		 struct labcomm2014_time *wakeup);
-    int (*wakeup)(struct labcomm2014_scheduler *s);
-    int (*enqueue)(struct labcomm2014_scheduler *s,
-		   uint32_t delay,
-		   void (*deferred)(void *context),
-		   void *context);
-  } *action;
-  void *context;
-};
-
-#endif
diff --git a/lib/c/2014/labcomm2014_time.c b/lib/c/2014/labcomm2014_time.c
deleted file mode 100644
index eb5e1f5e43ab2cf4c6e03739078b57d022267874..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_time.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-  labcomm2014_time.c -- labcomm2014 time handling
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <errno.h>
-#include "labcomm2014_scheduler_private.h"
-
-#define TIME_time(time, ...) time
-#define TIME(func, ...)						\
-  if (TIME_time(__VA_ARGS__) &&				\
-      TIME_time(__VA_ARGS__)->action->func) {			\
-    return TIME_time(__VA_ARGS__)->action->func(__VA_ARGS__);	\
-  }									\
-  return -ENOSYS;
-
-int labcomm2014_time_free(struct labcomm2014_time *s)
-{
-  TIME(free, s);
-}
-
-int labcomm2014_time_add_usec(struct labcomm2014_time *s, uint32_t usec)
-{
-  TIME(add_usec, s, usec);
-}
-
diff --git a/lib/c/2014/labcomm2014_type_signature.c b/lib/c/2014/labcomm2014_type_signature.c
deleted file mode 100644
index dce1836199fd47e30bf53f8f4766dd81cf3c7b43..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_type_signature.c
+++ /dev/null
@@ -1,128 +0,0 @@
-#include "labcomm2014.h"
-#include <string.h>   // for memcmp
-#include <stdio.h>   // for debug printf
-
-/* Dump signature bytes on stdout 
- */
-
-void labcomm2014_signature_print(struct labcomm2014_signature_data *signature)
-{
-  struct labcomm2014_signature_data *p = signature ;
-  while (p->length != -1) {
-    if (p->length) {
-      int i;
-      for ( i = 0 ; i < p->length ; i++) {
-        printf("%02x ", p->u.bytes[i]);
-      }
-    } else if(p->u.signature){
-      labcomm2014_signature_print(p->u.signature->treedata);
-    } else {
-      printf("neither data nor ref, bailing out.\n");
-      return;
-    }
-    p+=1;
-  }
-  printf("\n");
-}
-static labcomm2014_bool sig_dump_checked(struct labcomm2014_signature_data *signature, 
-                            char *buf, int *len, int buflen);
-
-/* buf (out)   : byte array to write signature into
-   len (in/out): input: buf size, out: signature length
-
-   return LABCOMM2014_TRUE if aborted due to overrun
- */
-labcomm2014_bool labcomm2014_signature_dump(struct labcomm2014_signature_data *signature, 
-                           char *buf, int *len)
-{
-  int buflen = *len;
-  *len = 0;
-  return sig_dump_checked(signature, buf, len, buflen);
-}
-
-/* internal function with bounds checking for buf.
- * buflen: capacity of buf
- */
-static labcomm2014_bool sig_dump_checked(struct labcomm2014_signature_data *signature, 
-                            char *buf, int *len, int buflen)
-{
-  struct labcomm2014_signature_data *p = signature;
-  while ( (p->length != -1) && (*len < buflen)) {
-    if (p->length) {
-      int i;
-      for ( i = 0 ; (i < p->length) && (*len < buflen); i++) {
-        *buf++ = p->u.bytes[i];
-        ++*len;
-      }
-    } else if(p->u.signature){
-      int tmplen=*len;
-      //recursing. c.f. dump()
-      sig_dump_checked(p->u.signature->treedata, buf, len, buflen);
-      int inner_len = *len-tmplen;
-      buf += inner_len;
-    } else {
-      //printf("neither data nor ref, bailing out.\n");
-      return LABCOMM2014_TRUE;
-    }
-    p+=1;
-  }
-  return (*len >= buflen);
-}
-
-/* compare signature (flattened, if needed) to other
-   return LABCOMM2014_TRUE if equal
-*/
-labcomm2014_bool labcomm2014_signature_cmp( struct labcomm2014_signature_data *s1,
-                           struct labcomm2014_signature_data *s2)
-{
-  int buflen=512;
-  char buf1[buflen];
-  int len1=buflen;
-  char buf2[buflen];
-  int len2=buflen;
-  labcomm2014_bool res1 = labcomm2014_signature_dump(s1, buf1, &len1);
-  labcomm2014_bool res2 = labcomm2014_signature_dump(s2, buf2, &len2);
-  if(res1 || res2) {
-    printf("WARNING: OVERRUN\n");
-    return LABCOMM2014_FALSE;
-  } else {
-    return(len1 == len2 && memcmp(buf1, buf2, len1)==0);
-  }
-}
-/* maps a function f(char b, struct labcomm2014_signature *s, void *context) 
- * on each byte (or type ref) in the signature. 
- *
- * If flatten, the signature is flattened to a byte array, and the 
- * second argument to f is always zero.
- *
- * Otherwise, when a type ref is encountered, f is called with the first
- * argument zero and the referenced type as the second argument.
- *
- * The context parameter is passed on, unaltered, to f
- */ 
-void map_signature( void(*f)(char, const struct labcomm2014_signature *, void *), 
-                    void *context,
-                    const struct labcomm2014_signature *signature, labcomm2014_bool flatten)
-{
-  struct labcomm2014_signature_data* p = signature->treedata;
-  while (p->length != -1) {
-    //fprintf(stderr, "%p %x\n", p, p->length);
-    if (p->length) {
-      int i;
-      for ( i = 0 ; i < p->length ; i++) {
-        (*f)(p->u.bytes[i], 0, context);
-      }
-    } else if (p->u.signature) {
-      if(p->u.signature == 0) printf("p->u.signature == null\n");
-      if(flatten) {
-        map_signature(f, context, p->u.signature, flatten);
-      } else {
-        (*f)(0, p->u.signature, context);
-      }
-    } else {
-      fprintf(stderr, "neither data nor ref, bailing out.\n");
-      return;
-    }
-    p+=1;
-  }
-}
diff --git a/lib/c/2014/labcomm2014_type_signature.h b/lib/c/2014/labcomm2014_type_signature.h
deleted file mode 100644
index 7c21b95b3435f14f81784a2d6f7fc0f5c926cb7d..0000000000000000000000000000000000000000
--- a/lib/c/2014/labcomm2014_type_signature.h
+++ /dev/null
@@ -1,139 +0,0 @@
-#ifndef __LABCOMM2014_TYPE_SIGNATURE_H__
-#define __LABCOMM2014_TYPE_SIGNATURE_H__
-
-//XXX move to common.h
-#ifndef labcomm2014_bool
-#define labcomm2014_bool char
-#define LABCOMM2014_TRUE 1
-#define LABCOMM2014_FALSE 0
-#endif
-
-/*
- * Signature entry
- */
-#ifndef LABCOMM_NO_TYPEDECL
-#ifdef USE_UNIONS
-
-/* Useful for C99 and up (or GCC without -pedantic) */ 
-
-#define LABCOMM_SIGDEF_BYTES_OR_SIGNATURE          \
-  union {                                   \
-    char *bytes;                            \
-    struct labcomm2014_signature* signature;            \
-  } u;
-
-#define LABCOMM_SIGDEF_BYTES(l, b) { l, .u.bytes=b }
-#define LABCOMM_SIGDEF_SIGNATURE(s) { 0, .u.signature=&s } // addressof, as s is pointing at the sig struct, not directly the the sig_bytes[]
-#define LABCOMM_SIGDEF_END { -1, .u.bytes=0 }
-
-#else
-
-#define LABCOMM_SIGDEF_BYTES_OR_SIGNATURE          \
-  struct {                                  \
-    char *bytes;                            \
-    const struct labcomm2014_signature *signature;            \
-  } u;
-
-#define LABCOMM_SIGDEF_BYTES(l, b) { l, { b, 0 } }
-#define LABCOMM_SIGDEF_SIGNATURE(s) { 0, { 0, &s } }
-#define LABCOMM_SIGDEF_END { -1, { 0, 0 } }
-
-#endif
-
-struct labcomm2014_signature_data {
-  int length;
-  LABCOMM_SIGDEF_BYTES_OR_SIGNATURE
-};
-
-#endif
-struct labcomm2014_signature {
-  char *name;
-  int (*encoded_size)(void *); /* void* refers to sample_data */
-  int size;
-  unsigned char *signature; 
-  int index;
-#ifndef LABCOMM_NO_TYPEDECL
-  int tdsize;
-  struct labcomm2014_signature_data *treedata;
-#endif  
-#ifdef LABCOMM_EXPERIMENTAL_CACHED_ENCODED_SIZE
-  int cached_encoded_size; // -1 if not initialized or type is variable size
-#endif
-};
-
-/* a struct for "raw" type_defs, to be used as an intermediate representation
- * between decoder and signature parser
- */
-
-struct labcomm2014_raw_type_def {
-    char *name;
-    int index;
-    int length;
-    char *signature_data;
-};
-
-/* a struct for type bindings
- */
-
-struct labcomm2014_type_binding {
-    int sample_index;
-    int type_index;
-};
-
-/*
- * functions
- */
-
-
-/* register a handler for type_defs and type bindings
- */
-
-int labcomm2014_decoder_register_labcomm2014_type_def(
-  struct labcomm2014_decoder *d,
-  void (*handler)(
-    struct labcomm2014_raw_type_def *v,
-    void *context
-  ),
-  void *context
-);
-
-int labcomm2014_decoder_register_labcomm2014_type_binding(
-  struct labcomm2014_decoder *d,
-  void (*handler)(
-    struct labcomm2014_type_binding *v,
-    void *context
-  ),
-  void *context
-);
-
-/* Dump signature bytes on stdout 
- */
-
-void labcomm2014_signature_print(struct labcomm2014_signature_data *signature);
-
-/* compare signatures (flattened, if needed) to other
-*  return LABCOMM2014_TRUE if equal
-*/
-labcomm2014_bool labcomm2014_signature_cmp( struct labcomm2014_signature_data *s2,
-                           struct labcomm2014_signature_data *s1);
-
-/* flatten and dump signature to a byte array.
- * buf (out)   : byte array to write signature into
- * len (in/out): input: buf size, out: signature length
- *
- * return LABCOMM2014_TRUE if aborted due to overrun
- */
-labcomm2014_bool labcomm2014_signature_dump(struct labcomm2014_signature_data *signature, 
-                           char *buf, int *len);
-
-/* maps function f on each byte in the signature
- * if flatten, the signature is flattened, and the second argument of
- * f is always zero
- * otherwise, when a type ref is encountered, f is called with the first
- * argument zero and the type ref as the second argument.
- */ 
-void map_signature( void(*f)(char, const struct labcomm2014_signature *, void *), 
-                    void *context,
-                    const struct labcomm2014_signature *signature, labcomm2014_bool flatten);
-
-#endif
diff --git a/lib/c/2014/test/.gitignore b/lib/c/2014/test/.gitignore
deleted file mode 100644
index 4f62b849d56cd043cb9725fe73e9f49522d3d931..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-gen
diff --git a/lib/c/2014/test/another_encoding.lc b/lib/c/2014/test/another_encoding.lc
deleted file mode 100644
index 2c545afd19d268a753fcb22753853087cf8f2dc9..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/another_encoding.lc
+++ /dev/null
@@ -1,2 +0,0 @@
-sample void V;
-sample byte B;
diff --git a/lib/c/2014/test/cppmacros.h b/lib/c/2014/test/cppmacros.h
deleted file mode 100644
index a3e446b0a76d4e3218d9146dc929473ebd68f9c0..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/cppmacros.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// C Preprocessor macros.
-#ifndef CPP_MACROS_H
-#define CPP_MACROS_H
-
-#define X_EMPTY(mac) var ## 1
-#define EMPTY(mac) X_EMPTY(mac)	// Returns 1 if macro mac is empty.
-
-#endif
diff --git a/lib/c/2014/test/generated_encoding.lc b/lib/c/2014/test/generated_encoding.lc
deleted file mode 100644
index e2de7133de344c45f3154811613028bd14f78a05..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/generated_encoding.lc
+++ /dev/null
@@ -1,12 +0,0 @@
-typedef void unused_t;
-typedef void v_t;
-sample v_t V;
-sample byte B;
-sample struct {
-  int i;
-} S1;
-sample int I[_];
-sample struct { int i; } P[_];
-sample void UnusedE;
-sample void UnusedD;
-sample sample R[4];
diff --git a/lib/c/2014/test/labcomm_mem_reader.c b/lib/c/2014/test/labcomm_mem_reader.c
deleted file mode 100644
index e111433731e746b12df536b98c01eb9a9336fedd..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/labcomm_mem_reader.c
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "labcomm_mem_reader.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* This implementation assumes labcomm will call end exactly once after each start
- * It is not allowed to save data in mcontext->enc_data,
- * this pointer will be set to NULL after decoding.
- */
-/* NOTE!!!!
- * start will be run first, once a signature or a data section is decoded
- * end will be run and then start again. If end of encoded data is reached this
- * must be handled in start.
- */
-
-// TODO make labcomm use result!
-int labcomm_mem_reader(labcomm_reader_t *r, 
-		       labcomm_reader_action_t action,
-		       ...)
-{
-  int result = -EINVAL;
-  labcomm_mem_reader_context_t *mcontext = (labcomm_mem_reader_context_t *) r->context;
-
-  switch (action) {
-    case labcomm_reader_alloc: {
-      r->data = NULL;
-      r->data_size = 0;
-      r->pos = 0;
-      r->count = 0;
-      } break;
-    case labcomm_reader_start: {
-      if (r->data == NULL && mcontext->enc_data != NULL) {
-        r->data = (unsigned char *) malloc(mcontext->size);
-        if(r->data != NULL) {
-          memcpy(r->data, mcontext->enc_data, mcontext->size);
-          r->data_size = mcontext->size;
-          r->count = mcontext->size;
-          r->pos = 0;
-          result = r->data_size;
-        } else {
-          r->data_size = 0;
-          result = -ENOMEM;
-        }
-      } else if (r->data == NULL && mcontext->enc_data == NULL) {
-        result = -1;
-      } else {
-        result = r->count - r->pos;
-      }
-    } break;
-    case labcomm_reader_continue: {
-      if (r->pos < r->count) {
-        result = r->count - r->pos;
-      } else {
-        // TODO set some describing error here
-        result = -1;
-      }
-    } break;
-    case labcomm_reader_end: {
-      if (r->pos >= r->count) {
-        free(r->data);
-        r->data = NULL;
-        r->data_size = 0;
-        mcontext->enc_data = NULL;
-        mcontext->size = 0;
-      }
-      result = r->count - r->pos;
-    } break;
-    case labcomm_reader_free: {
-      r->count = 0;
-      r->pos = 0;
-      result = 0;
-    } break;
-    case labcomm_reader_ioctl: {
-      result = -ENOTSUP;
-    }
-  }
-  return result;
-}
-
diff --git a/lib/c/2014/test/labcomm_mem_reader.h b/lib/c/2014/test/labcomm_mem_reader.h
deleted file mode 100644
index 55b8ea9784a6eaabffb5801d3a8dd7d2f07254c4..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/labcomm_mem_reader.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef LABCOMM_MEM_READER_H
-#define LABCOMM_MEM_READER_H
-
-#include "labcomm.h"
-
-/* enc_data: The data to be decoded
- * size: the size of the data to be decoded
- */
-typedef struct labcomm_mem_reader_context_t labcomm_mem_reader_context_t;
-struct labcomm_mem_reader_context_t {
-  size_t size;
-  unsigned char *enc_data;
-};
-
-int labcomm_mem_reader(labcomm_reader_t *r, 
-		       labcomm_reader_action_t action,
-		       ...);
-
-#endif
diff --git a/lib/c/2014/test/labcomm_mem_writer.c b/lib/c/2014/test/labcomm_mem_writer.c
deleted file mode 100644
index 4370361e97945f6aec61cbdb2c364bcb13a38fa7..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/labcomm_mem_writer.c
+++ /dev/null
@@ -1,146 +0,0 @@
-#include "labcomm_mem_writer.h"
-
-#include <stddef.h>  // For size_t.
-#include <stdarg.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "labcomm.h"
-#include "cppmacros.h"
-
-#define BUFFER_SIZE 150 // Suitable size is at least the size of a fully encoded message. Found by inspecting size of file genreated from the labcomm_fs_reader_writer.c on the same message type.
-
-// Put encdoded data directly in mcontext->mbuf or malloc new temporary memory.
-// 1 == Allocate new memory.
-// 2 == Use mcontext->buf directly. But _beware_; you can not then later change 
-// mcontext->buf to something else since the writer gets a reference to this 
-// buffer!
-#if defined(MEM_WRITER_ENCODED_BUFFER) && (EMPTY(MEM_WRITER_ENCODED_BUFFER) != 1)
-  #define ENCODED_BUFFER MEM_WRITER_ENCODED_BUFFER
-#else
-  #define ENCODED_BUFFER 1
-#endif
-
-static int get_writer_available(labcomm_writer_t *w, labcomm_mem_writer_context_t *mcontext);
-static void copy_data(labcomm_writer_t *w, labcomm_mem_writer_context_t *mcontext, unsigned char *mbuf);
-
-/*
- * Write encoded messages to memory. w->context is assumed to be a pointer to a
- * labcomm_mem_writer_context_t structure.
- */
-int labcomm_mem_writer(labcomm_writer_t *w, labcomm_writer_action_t action, ...)
-{
-  int result = 0;
-  // Unwrap pointers for easy access.
-  labcomm_mem_writer_context_t *mcontext = (labcomm_mem_writer_context_t *) w->context;
-  unsigned char *mbuf = mcontext->buf;
-
-  switch (action) {
-  case labcomm_writer_alloc: {
-#if (ENCODED_BUFFER == 1)
-    w->data = malloc(BUFFER_SIZE); // Buffer that LabComm will use for putting the encoded data.
-    if (w->data == NULL) {
-      result = -ENOMEM;
-      w->data_size = 0;
-      w->count = 0;
-      w->pos = 0;
-    } else {
-      w->data_size = BUFFER_SIZE;
-      w->count = BUFFER_SIZE;
-      w->pos = 0;
-    }
-#elif (ENCODED_BUFFER == 2)
-    w->data = mbuf;
-    int bytes_left = (mcontext->length - mcontext->write_pos);
-    w->data_size = bytes_left;
-    w->count = bytes_left;
-    w->pos = mcontext->write_pos;
-#endif
-     } break;
-  case labcomm_writer_free:{
-#if (ENCODED_BUFFER == 1)
-    free(w->data);
-#endif
-    w->data = 0;
-    w->data_size = 0;
-    w->count = 0;
-    w->pos = 0;
-   } break;
-  case labcomm_writer_start:
-    case labcomm_writer_start_signature: {
-#if (ENCODED_BUFFER == 1)
-    w->pos = 0;
-#elif (ENCODED_BUFFER == 2)
-    w->pos = mcontext->write_pos;
-#endif
-    } break;
-  case labcomm_writer_continue:
-  case labcomm_writer_continue_signature: { 
-    // Encode-buffer(w->data) is full; empty/handle it. (w->pos == w->count) most likely.
-#if (ENCODED_BUFFER == 1)
-    copy_data(w, mcontext, mbuf);
-    result = w->pos; // Assume result here should be number of bytes written.
-    w->pos = 0;
-#elif (ENCODED_BUFFER == 2)
-    mcontext->write_pos = w->pos;
-#endif
-     result = 0;
-    } break;
-  case labcomm_writer_end:
-  case labcomm_writer_end_signature:{ // Nothing more to encode, handle encode-buffer(w->data).
-#if (ENCODED_BUFFER == 1)
-    copy_data(w, mcontext, mbuf);
-    result = w->pos;
-    w->pos = 0;
-#elif (ENCODED_BUFFER == 2)
-    mcontext->write_pos = w->pos;
-#endif
-    result = 0;
-    } break;
-  }
-  return result;
-}
-
-labcomm_mem_writer_context_t *labcomm_mem_writer_context_t_new(size_t init_pos, size_t length, unsigned char *buf)
-{
-  labcomm_mem_writer_context_t *mcontext = (labcomm_mem_writer_context_t *) malloc(sizeof(labcomm_mem_writer_context_t));
-  if (mcontext == NULL) {
-    //fprintf(stderr, "error: Can not allocate labcomm_mem_writer_context_t.\n");
-  } else {
-    mcontext->write_pos = init_pos;
-    mcontext->length = length;
-    mcontext->buf = buf;
-  }
-  return mcontext;
-}
-
-void labcomm_mem_writer_context_t_free(labcomm_mem_writer_context_t **mcontext)
-{
-  free(*mcontext);
-  *mcontext = NULL;
-}
-
-// Get the number of available bytes in the mcontext->buf buffer.
-static int get_writer_available(labcomm_writer_t *w, labcomm_mem_writer_context_t *mcontext)
-{
-  return (mcontext->length - mcontext->write_pos);
-}
-
-// Copy data from encoded buffer to mbuf.
-static void copy_data(labcomm_writer_t *w, labcomm_mem_writer_context_t *mcontext, unsigned char *mbuf)
-{
-        int writer_available = get_writer_available(w, mcontext);
-  if (( writer_available - w->pos) < 0) {
-    w->on_error(LABCOMM_ERROR_ENC_BUF_FULL, 3, "labcomm_writer_t->pos=%i, but available in mcontext is %i", w->pos, writer_available); 
-  } else {
-    int i;
-    for (i = 0; i < w->pos; ++i, mcontext->write_pos++) {
-      mbuf[mcontext->write_pos] = w->data[i];
-    }
-  }
-}
-
-void test_copy_data(labcomm_writer_t *w, labcomm_mem_writer_context_t *mcontext, unsigned char *mbuf)
-{
-  copy_data(w, mcontext, mbuf); 
-}
diff --git a/lib/c/2014/test/labcomm_mem_writer.h b/lib/c/2014/test/labcomm_mem_writer.h
deleted file mode 100644
index 7506342a9844f442008eafae0a565432d0e06f2d..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/labcomm_mem_writer.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef LABCOMM_MEM_WRITER_H
-#define LABCOMM_MEM_WRITER_H
-
-#include "labcomm.h"
-
-/* Wrapper structure for the memory buffer including a writer position. */
-typedef struct labcomm_mem_writer_context_t labcomm_mem_writer_context_t;
-struct labcomm_mem_writer_context_t {
-  size_t write_pos;  // Position where next write should be.
-  size_t length;  // Length of the buffer.
-  unsigned char *buf;  // Allocated destination buffer.
-};
-
-int labcomm_mem_writer(labcomm_writer_t *w, labcomm_writer_action_t action, ...);
-
-/* Wrapper the internal static function copy_data. This is needed so that the exceptions can be unit tested. */
-void test_copy_data(labcomm_writer_t *w, labcomm_mem_writer_context_t *mcontext, unsigned char *mbuf);
-
-/* Allocate new labcomm_mem_writer_context_t. */
-labcomm_mem_writer_context_t *labcomm_mem_writer_context_t_new(size_t init_pos, size_t length, unsigned char *buf);
-
-/* Deallocate mcontext. */
-void labcomm_mem_writer_context_t_free(labcomm_mem_writer_context_t **mcontext);
-
-#endif
diff --git a/lib/c/2014/test/more_types.lc b/lib/c/2014/test/more_types.lc
deleted file mode 100644
index 91fb9358134fccf3149507e96d27680465c50411..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/more_types.lc
+++ /dev/null
@@ -1,7 +0,0 @@
-sample string S;
-sample int A[8];
-sample struct {
-  string s1;
-  string s2;
-} NS;
-sample string AS[_];
diff --git a/lib/c/2014/test/test_labcomm.c b/lib/c/2014/test/test_labcomm.c
deleted file mode 100644
index de36a7f4a34905a20360c272bf8f27c0d703593e..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_labcomm.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
-  test_labcomm2014.c -- Various labcomm2014 tests
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdint.h>
-#include <inttypes.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "labcomm2014_private.h"
-#include "labcomm2014_default_error_handler.h"
-#include "labcomm2014_default_memory.h"
-#include "labcomm2014_default_scheduler.h"
-#include "test/gen/test_sample.h"
-
-static struct labcomm2014_writer writer;
-
-static struct expect {
-  char *description;
-  int result;
-  int (*trampoline)(struct labcomm2014_decoder *context);
-  struct labcomm2014_decoder *context;
-} *expect;
-
-static void check_expect()
-{
-  struct expect *p = expect;
-
-  {
-    int i;
-    for (i = 0 ; i < writer.pos ; i++) {
-      fprintf(stderr, "%02x ", writer.data[i]);
-    }
-    fprintf(stderr, "\n");
-  }
-  if (p && p->trampoline) {
-    int err;
-    
-    expect = p + 1;
-    fprintf(stderr, "Checking '%s' expected=%d ", p->description, p->result);
-    err = p->trampoline(p->context);
-    fprintf(stderr, "actual=%d\n", err);
-    if (p->result >= 0 && p->result != err) {
-      fprintf(stderr, "FAILED\n");
-      exit(1);
-    } else if (err == 0) {
-      fprintf(stderr, "FAILED (unexpected 0)\n");
-      exit(1);
-    }
-    writer.pos = 0;
-  }
-}
-
-static unsigned char buffer[512];
-
-static int writer_alloc(struct labcomm2014_writer *w, 
-			struct labcomm2014_writer_action_context *action_context)
-{
-  w->data = buffer;
-  w->data_size = sizeof(buffer);
-  w->count = sizeof(buffer);
-  
-  return 0;
-}
-
-static int writer_start(struct labcomm2014_writer *w, 
-			 struct labcomm2014_writer_action_context *action_context,
-			 int index, const struct labcomm2014_signature *signature,
-			 void *value)
-{
-  return 0;
-}
-
-static int buf_writer_end(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context)
-{
-  check_expect();
-  return 0;
-}
-
-const struct labcomm2014_writer_action writer_action = {
-  .alloc = writer_alloc,
-  .start = writer_start,
-  .end = buf_writer_end,
-};
-
-static struct labcomm2014_writer_action_context writer_action_context = {
-  .next = NULL,
-  .action = &writer_action,
-  .context = NULL
-}; 
-
-static struct labcomm2014_writer writer =  {
-  .action_context = &writer_action_context,
-  .data = buffer,
-  .data_size = sizeof(buffer),
-  .count = sizeof(buffer),
-  .pos = 0,
-  .error = 0,
-};
-
-static int reader_alloc(struct labcomm2014_reader *r, 
-			struct labcomm2014_reader_action_context *action_context)
-{
-  r->data = buffer;
-  r->data_size = sizeof(buffer);
-  r->count = 0;
-  r->memory = labcomm2014_default_memory;
-  
-  return 0;
-}
-
-static int reader_fill(struct labcomm2014_reader *r, 
-		       struct labcomm2014_reader_action_context *action_context)
-{
-  r->error = -ENOMEM;
-  return r->error;
-}
-
-const struct labcomm2014_reader_action reader_action = {
-  .alloc = reader_alloc,
-  .fill = reader_fill,
-};
-
-static struct labcomm2014_reader_action_context reader_action_context = {
-  .next = NULL,
-  .action = &reader_action,
-  .context = NULL
-}; 
-
-static struct labcomm2014_reader reader =  {
-  .action_context = &reader_action_context,
-  .data = buffer,
-  .data_size = sizeof(buffer),
-  .count = 0,
-  .pos = 0,
-  .error = 0,
-};
-
-static int32_t encoder_data[256];
-static test_sample_test_var encoder_var = {
-  .n_0 = 1,
-  .n_2 = 1,
-  .a = encoder_data,
-};
-
-static int32_t decoder_data[256];
-static test_sample_test_var decoder_var = {
-  .n_0 = 1,
-  .n_2 = 1,
-  .a = decoder_data,
-};;
-
-void handle_test_var(test_sample_test_var *v, void *ctx)
-{
-  decoder_var.a[0] = v->a[0];  
-}
-
-int test_decode_one(struct labcomm2014_decoder *decoder)
-{
-  int result;
-
-  for (reader.count = 0 ; reader.count < writer.pos ; reader.count++) {
-    reader.error = 0;
-    reader.pos = 0;
-    result = labcomm2014_decoder_decode_one(decoder); 
-    if (result >= 0 ) {
-      fprintf(stderr,
-              "Got result from buffer with bogus length (%d, %d != %d)\n",
-	      result, reader.count, writer.pos);
-      exit(1);
-    }
-  }
-  reader.error = 0;
-  reader.pos = 0;
-  reader.count = writer.pos;
-  result = labcomm2014_decoder_decode_one(decoder);
-  if (result < 0) {
-    fprintf(stderr, "Got no result from buffer with correct length (%d)\n",
-	    result);
-    exit(1);
-  }
-  return result;
-}
-
-static void test_encode_decode(struct labcomm2014_encoder *encoder,
-			       struct labcomm2014_decoder *decoder,
-			       int expected, uint32_t n_0, uint32_t n_2)
-{
-  int err;
-
-  writer.pos = 0;
-  encoder_var.n_0 = n_0;
-  encoder_var.n_2 = n_2;
-  encoder_var.a[0] = 314;
-  labcomm2014_encode_test_sample_test_var(encoder, &encoder_var);
-  err = test_decode_one(decoder);
-  fprintf(stderr, "decode of sample %u * 2 * %u -> size=%d err=%d\n", 
-	  n_0, n_2, writer.pos, err);
-  if (writer.pos != labcomm2014_sizeof_test_sample_test_var(&encoder_var)) {
-    fprintf(stderr, "Incorrect sizeof %u * 2 * %u (%d != %d)\n",
-	    n_0, n_2, 
-	    writer.pos, labcomm2014_sizeof_test_sample_test_var(&encoder_var));
-    exit(1);
-  }
-  if (writer.pos != expected) {
-    fprintf(stderr, "Unexpected size %u * 2 * %u (%d != %d)\n",
-	    n_0, n_2, 
-	    writer.pos, expected);
-    exit(1);
-  }
-}
-
-int main(void)
-{
-  int i;
-  struct labcomm2014_decoder *decoder = labcomm2014_decoder_new(
-    &reader,
-    labcomm2014_default_error_handler,
-    labcomm2014_default_memory,
-    labcomm2014_default_scheduler);
-  struct expect expect_version[] = {
-    { "Version", 1, test_decode_one, decoder },
-    { 0, 0, 0 }
-  };
-  expect = expect_version;
-  struct labcomm2014_encoder *encoder = labcomm2014_encoder_new(
-    &writer, 
-    labcomm2014_default_error_handler,
-    labcomm2014_default_memory,
-    labcomm2014_default_scheduler);
-  labcomm2014_decoder_register_test_sample_test_var(decoder,
-						handle_test_var, 
-						NULL);
-  struct expect expect_registration[] = {
-    { "Sampledef", -1, test_decode_one, decoder },
-#ifdef SHOULD_THIS_BE_REMOVED
-    { "Typedef", -1, test_decode_one, decoder },
-#endif
-    { "Binding", -1, test_decode_one, decoder },
-    { 0, 0, 0 }
-  };
-  expect = expect_registration;
-  labcomm2014_encoder_register_test_sample_test_var(encoder);
-  test_encode_decode(encoder, decoder, 12, 1, 1);
-  if (decoder_var.a[0] != encoder_var.a[0]) {
-    fprintf(stderr, "Failed to decode correct value %d != %d\n", 
-	    encoder_var.a[0], decoder_var.a[0]);
-    exit(1);
-  }
-  test_encode_decode(encoder, decoder, 36, 2, 2);
-  test_encode_decode(encoder, decoder, 4, 0, 0);
-  for (i = 1 ; i <= 4 ; i++) {
-    test_encode_decode(encoder, decoder, 3+i, 0, (1<<(7*i))-1);
-    test_encode_decode(encoder, decoder, 4+i, 0, (1<<(7*i)));
-  }
-  test_encode_decode(encoder, decoder, 8, 0, 4294967295);
-  return 0;
-}
diff --git a/lib/c/2014/test/test_labcomm_basic_type_encoding.c b/lib/c/2014/test/test_labcomm_basic_type_encoding.c
deleted file mode 100644
index 29079df684b8f919a2ee15e8ca1992672d3db0f6..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_labcomm_basic_type_encoding.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-  test_labcomm2014_basic_type_encoding.c -- LabComm tests of basic encoding
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdint.h>
-#include <inttypes.h>
-#include <string.h>
-#include <stdlib.h>
-#include "labcomm2014_private.h"
-
-static int line;
-
-static unsigned char buffer[128];
-
-static struct labcomm2014_writer writer =  {
-  .action_context = NULL,
-  .data = buffer,
-  .data_size = sizeof(buffer),
-  .count = sizeof(buffer),
-  .pos = 0,
-  .error = 0,
-};
-
-static struct labcomm2014_reader reader =  {
-  .action_context = NULL,
-  .data = buffer,
-  .data_size = sizeof(buffer),
-  .count = 0,
-  .pos = 0,
-};
-
-typedef uint32_t packed32;
-
-#define TEST_WRITE_READ(type, ltype, format, value, expect_count, expect_bytes) \
-  {									\
-    type decoded;							\
-    line = __LINE__;							\
-    writer.pos = 0;							\
-    labcomm2014_write_##ltype(&writer, value);				\
-    writer_assert(#ltype, expect_count, (uint8_t*)expect_bytes);	\
-    reader.count = writer.pos;						\
-    reader.pos = 0;							\
-    decoded = labcomm2014_read_##ltype(&reader);				\
-    if (decoded != value) {						\
-      fprintf(stderr, "Decode error" format " != " format " @%s:%d \n", \
-	      value, decoded, __FILE__, __LINE__);					\
-      exit(1);								\
-    }									\
-  }
-
-static void writer_assert(char *type,
-			  int count,
-			  uint8_t *bytes)
-{
-  if (writer.pos != count) {
-    fprintf(stderr, 
-	    "Wrong number of bytes written for '%s' (%d != %d) @%s:%d\n",
-	    type, writer.pos, count, __FILE__, line);
-    exit(1);
-  }
-  if (memcmp(writer.data, bytes, count) != 0) {
-    int i;
-
-    fprintf(stderr, "Wrong bytes written for '%s' ( ", type);
-    for (i = 0 ; i < count ; i++) {
-      fprintf(stderr, "%2.2x ", writer.data[i]);
-    }
-    fprintf(stderr, "!= ");
-    for (i = 0 ; i < count ; i++) {
-      fprintf(stderr, "%2.2x ", bytes[i]);
-    }
-    fprintf(stderr, ") @%s:%d\n", __FILE__, line);
-    exit(1);
-  }
-}
-
-int main(void)
-{
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x0, 1, "\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x7f, 1, "\x7f");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x80, 2, "\x81\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x3fff, 2, "\xff\x7f");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x4000, 3, "\x81\x80\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x1fffff, 3, "\xff\xff\x7f");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x200000, 4, "\x81\x80\x80\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0xfffffff, 4, "\xff\xff\xff\x7f");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x10000000, 5, "\x81\x80\x80\x80\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0xffffffff, 5, "\x8f\xff\xff\xff\x7f");
-  TEST_WRITE_READ(uint8_t, boolean, "%d", 0, 1, "\x00");
-  TEST_WRITE_READ(uint8_t, boolean, "%d", 1, 1, "\x01");
-  TEST_WRITE_READ(uint8_t, byte, "%d", 0, 1, "\x00");
-  TEST_WRITE_READ(uint8_t, byte, "%d", 1, 1, "\x01");
-  TEST_WRITE_READ(uint8_t, byte, "%d", 0xff, 1, "\xff");
-  TEST_WRITE_READ(int16_t, short, "%d", 0, 2, "\x00\x00");
-  TEST_WRITE_READ(int16_t, short, "%d", 0x7fff, 2, "\x7f\xff");
-  TEST_WRITE_READ(int16_t, short, "%d", -1, 2, "\xff\xff");
-  TEST_WRITE_READ(int32_t, int, "%d", 0, 4, "\x00\x00\x00\x00");
-  TEST_WRITE_READ(int32_t, int, "%d", 0x7fffffff, 4, "\x7f\xff\xff\xff");
-  TEST_WRITE_READ(int32_t, int, "%d", -1, 4, "\xff\xff\xff\xff");
-  TEST_WRITE_READ(int64_t, long, "%" PRId64, INT64_C(0), 8, "\x00\x00\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(int64_t, long, "%" PRId64, INT64_C(0x7fffffffffffffff), 8, "\x7f\xff\xff\xff\xff\xff\xff\xff");
-  TEST_WRITE_READ(int64_t, long, "%" PRId64, INT64_C(-1), 8, "\xff\xff\xff\xff\xff\xff\xff\xff");
-  TEST_WRITE_READ(float, float, "%f", 0.0, 4, "\x00\x00\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", 1.0, 4, "\x3f\x80\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", 2.0, 4, "\x40\x00\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", 0.5, 4, "\x3f\x00\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", 0.25, 4, "\x3e\x80\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", -0.0, 4, "\x80\x00\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", -1.0, 4, "\xbf\x80\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", -2.0, 4, "\xc0\x00\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", -0.5, 4, "\xbf\x00\x00\x00");
-  TEST_WRITE_READ(float, float, "%f", -0.25, 4, "\xbe\x80\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", 0.0, 8, "\x00\x00\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", 1.0, 8, "\x3f\xf0\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", 2.0, 8, "\x40\x00\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", 0.5, 8, "\x3f\xe0\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", 0.25, 8, "\x3f\xd0\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", -0.0, 8, "\x80\x00\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", -1.0, 8, "\xbf\xf0\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", -2.0, 8, "\xc0\x00\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", -0.5, 8, "\xbf\xe0\x00\x00\x00\x00\x00\x00");
-  TEST_WRITE_READ(double, double, "%f", -0.25, 8, "\xbf\xd0\x00\x00\x00\x00\x00\x00");
-  fprintf(stderr, "%s succeded\n", __FILE__);
-  return 0;
-}
-
diff --git a/lib/c/2014/test/test_labcomm_copy.c b/lib/c/2014/test/test_labcomm_copy.c
deleted file mode 100644
index d26ef966ab7a318fa108ba79c1e9017fadd4a567..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_labcomm_copy.c
+++ /dev/null
@@ -1,283 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <err.h>
-
-#include "labcomm2014.h"
-#include "labcomm2014_private.h"
-#include "labcomm2014_default_error_handler.h"
-#include "labcomm2014_default_memory.h"
-#include "labcomm2014_default_scheduler.h"
-#include "labcomm2014_fd_writer.h"
-#include "labcomm2014_fd_reader.h"
-#include "test/gen/generated_encoding.h"
-#include "test/gen/test_sample.h"
-#include "test/gen/more_types.h"
-
-#define DATA_FILE "copy_test.dat"
-
-static void handle_s1(generated_encoding_S1 *v, void *context)
-{
-  labcomm2014_copy_generated_encoding_S1(labcomm2014_default_memory, context, v);
-}
-
-static void handle_b(generated_encoding_B *v, void *context)
-{
-  labcomm2014_copy_generated_encoding_B(labcomm2014_default_memory, context, v);
-}
-
-static void handle_i(generated_encoding_I *v, void *context)
-{
-  labcomm2014_copy_generated_encoding_I(labcomm2014_default_memory, context, v);
-}
-
-static void handle_p(generated_encoding_P *v, void *context)
-{
-  labcomm2014_copy_generated_encoding_P(labcomm2014_default_memory, context, v);
-}
-
-static void handle_r(generated_encoding_R *v, void *context)
-{
-  labcomm2014_copy_generated_encoding_R(labcomm2014_default_memory, context, v);
-}
-
-static void handle_test_var(test_sample_test_var *v, void *context)
-{
-  labcomm2014_copy_test_sample_test_var(labcomm2014_default_memory, context, v);
-}
-
-static void handle_a(more_types_A *v, void *context)
-{
-  labcomm2014_copy_more_types_A(labcomm2014_default_memory, context, v);
-}
-
-static void handle_s(more_types_S *v, void *context)
-{
-  labcomm2014_copy_more_types_S(labcomm2014_default_memory, context, v);
-}
-
-static void handle_ns(more_types_NS *v, void *context)
-{
-  labcomm2014_copy_more_types_NS(labcomm2014_default_memory, context, v);
-}
-
-static void handle_as(more_types_AS *v, void *context)
-{
-  labcomm2014_copy_more_types_AS(labcomm2014_default_memory, context, v);
-}
-
-int main(int argc, char **argv)
-{
-  struct labcomm2014_encoder *encoder;
-  struct labcomm2014_decoder *decoder;
-  int fd;
-  generated_encoding_S1 s1;
-  generated_encoding_S1 cache_s1;
-  generated_encoding_B b;
-  generated_encoding_B cache_b;
-  generated_encoding_I I;
-  generated_encoding_I cache_I;
-  generated_encoding_P p;
-  generated_encoding_P cache_p;
-  test_sample_test_var test_var;
-  test_sample_test_var cache_test_var;
-  more_types_A a;
-  more_types_A cache_a;
-  more_types_S s;
-  more_types_S cache_s = NULL;
-  more_types_NS ns;
-  more_types_NS cache_ns;
-  more_types_AS as;
-  more_types_AS cache_as;
-  generated_encoding_R r;
-  generated_encoding_R cache_r;
-
-  fd = open(DATA_FILE, O_RDWR | O_CREAT | O_TRUNC, 0644);
-  if (fd == -1)
-    err(1, "open()");
-  encoder =
-    labcomm2014_encoder_new(labcomm2014_fd_writer_new(labcomm2014_default_memory, fd, 0),
-			labcomm2014_default_error_handler,
-			labcomm2014_default_memory,
-			labcomm2014_default_scheduler);
-
-  labcomm2014_encoder_register_generated_encoding_S1(encoder);
-  s1.i = 1;
-  labcomm2014_encode_generated_encoding_S1(encoder, &s1);
-
-  labcomm2014_encoder_register_generated_encoding_B(encoder);
-  b = 2;
-  labcomm2014_encode_generated_encoding_B(encoder, &b);
-
-  labcomm2014_encoder_register_generated_encoding_I(encoder);
-  I.n_0 = 3;
-  I.a = calloc(I.n_0, sizeof(I.a[0]));
-  I.a[0] = 4;
-  I.a[1] = 5;
-  I.a[2] = 6;
-  labcomm2014_encode_generated_encoding_I(encoder, &I);
-
-  labcomm2014_encoder_register_generated_encoding_P(encoder);
-  p.n_0 = 7;
-  p.a = calloc(p.n_0, sizeof(p.a[0]));
-  for (int i = 0; i < p.n_0; i++)
-    p.a[i].i = 8 + i;
-  labcomm2014_encode_generated_encoding_P(encoder, &p);
-
-  labcomm2014_encoder_register_test_sample_test_var(encoder);
-  test_var.n_0 = 2;
-  test_var.n_2 = 7;
-  test_var.a = calloc(test_var.n_0 * 2 * test_var.n_2, sizeof(*test_var.a));
-  for (int i = 0; i < test_var.n_0; i++)
-    for (int j = 0; j < 2; j++)
-      for (int k = 0; k < test_var.n_2; k++) {
-        test_var.a[(((i) * 2 + j) * test_var.n_2) + k] = 100 * i + 10 * j + k;
-      }
-  labcomm2014_encode_test_sample_test_var(encoder, &test_var);
-
-  labcomm2014_encoder_register_more_types_A(encoder);
-  for (int i = 0; i < sizeof(a.a) / sizeof(a.a[0]); i++)
-    a.a[i] = i;
-  labcomm2014_encode_more_types_A(encoder, &a);
-
-  labcomm2014_encoder_register_more_types_S(encoder);
-  s = "this is a string";
-  labcomm2014_encode_more_types_S(encoder, &s);
-
-  labcomm2014_encoder_register_more_types_NS(encoder);
-  ns.s1 = "this is a string";
-  ns.s2 = "this is a another string";
-  labcomm2014_encode_more_types_NS(encoder, &ns);
-
-  labcomm2014_encoder_register_more_types_AS(encoder);
-  as.n_0 = 3;
-  as.a = calloc(as.n_0, sizeof(as.a[0]));
-  as.a[0] = "string 0";
-  as.a[1] = "string 1";
-  as.a[2] = "string 2";
-  labcomm2014_encode_more_types_AS(encoder, &as);
-
-  labcomm2014_encoder_register_generated_encoding_R(encoder);
-  labcomm2014_encoder_sample_ref_register(encoder, labcomm2014_signature_generated_encoding_V);
-  labcomm2014_encoder_sample_ref_register(encoder, 
-                                      labcomm2014_signature_generated_encoding_UnusedD);
-  labcomm2014_encoder_sample_ref_register(encoder, labcomm2014_signature_generated_encoding_R);
-  r.a[0] = labcomm2014_signature_generated_encoding_V;
-  r.a[1] = labcomm2014_signature_generated_encoding_UnusedE;
-  r.a[2] = labcomm2014_signature_generated_encoding_UnusedD;
-  r.a[3] = labcomm2014_signature_generated_encoding_R;
-  labcomm2014_encode_generated_encoding_R(encoder, &r);
-
-  labcomm2014_encoder_free(encoder);
-  encoder = NULL;
-  lseek(fd, 0, SEEK_SET);
-  decoder =
-    labcomm2014_decoder_new(labcomm2014_fd_reader_new(labcomm2014_default_memory, fd, 0),
-			labcomm2014_default_error_handler,
-			labcomm2014_default_memory,
-			labcomm2014_default_scheduler);
-
-  labcomm2014_decoder_register_generated_encoding_S1(decoder, handle_s1, &cache_s1);
-  labcomm2014_decoder_register_generated_encoding_B(decoder, handle_b, &cache_b);
-  labcomm2014_decoder_register_generated_encoding_I(decoder, handle_i, &cache_I);
-  labcomm2014_decoder_register_generated_encoding_P(decoder, handle_p, &cache_p);
-  labcomm2014_decoder_register_test_sample_test_var(decoder, handle_test_var,
-						&cache_test_var);
-  labcomm2014_decoder_register_more_types_A(decoder, handle_a, &cache_a);
-  labcomm2014_decoder_register_more_types_S(decoder, handle_s, &cache_s);
-  labcomm2014_decoder_register_more_types_NS(decoder, handle_ns, &cache_ns);
-  labcomm2014_decoder_register_more_types_AS(decoder, handle_as, &cache_as);
-  labcomm2014_decoder_register_generated_encoding_R(decoder, handle_r, &cache_r);
-  labcomm2014_decoder_sample_ref_register(decoder, labcomm2014_signature_generated_encoding_V);
-  labcomm2014_decoder_sample_ref_register(decoder, 
-                                      labcomm2014_signature_generated_encoding_UnusedE);
-  labcomm2014_decoder_sample_ref_register(decoder, labcomm2014_signature_generated_encoding_R);
-
-  while (labcomm2014_decoder_decode_one(decoder) > 0) ;
-
-  printf("cache_s1.i = %d, s1.i = %d\n", cache_s1.i, s1.i);
-  assert(cache_s1.i == s1.i);
-  puts("S1 copied ok");
-
-  assert(cache_b == b);
-  puts("B copied ok");
-
-  assert(cache_I.n_0 == I.n_0);
-  assert(cache_I.a[0] == I.a[0]);
-  assert(cache_I.a[1] == I.a[1]);
-  assert(cache_I.a[2] == I.a[2]);
-  free(I.a);
-  puts("I copied ok");
-
-  assert(cache_p.n_0 == p.n_0);
-  for (int i = 0; i < p.n_0; i++)
-    assert(cache_p.a[i].i == p.a[i].i);
-  free(p.a);
-  puts("P copied ok");
-
-  assert(cache_test_var.n_0 == test_var.n_0);
-  assert(cache_test_var.n_2 == test_var.n_2);
-  for (int i = 0; i < test_var.n_0; i++)
-    for (int j = 0; j < 2; j++)
-      for (int k = 0; k < test_var.n_2; k++) {
-        assert(cache_test_var.a[(((i) * 2 + j) * test_var.n_2) + k] == 
-                     test_var.a[(((i) * 2 + j) * test_var.n_2) + k]);
-        assert(cache_test_var.a[(((i) * 2 + j) * test_var.n_2) + k] == 
-               100 * i + 10 * j + k);
-      }
-  free(test_var.a);
-  puts("test_var copied ok");
-
-  for (int i = 0; i < sizeof(a.a) / sizeof(a.a[0]); i++)
-    assert(cache_a.a[i] == a.a[i]);
-  puts("A copied ok");
-
-  assert(!strcmp(cache_s, s));
-  puts("S copied ok");
-
-  assert(!strcmp(cache_ns.s1, ns.s1));
-  assert(!strcmp(cache_ns.s2, ns.s2));
-  puts("NS copied ok");
-
-  for (int i = 0; i < as.n_0; i++)
-    assert(!strcmp(cache_as.a[i], as.a[i]));
-  free(as.a);
-  puts("AS copied ok");
-
-  fprintf(stderr, "%p %p\n", r.a[0], cache_r.a[0]);
-  fprintf(stderr, "%p %p\n", r.a[1], cache_r.a[1]);
-  fprintf(stderr, "%p %p\n", r.a[2], cache_r.a[2]);
-  fprintf(stderr, "%p %p\n", r.a[3], cache_r.a[3]);
-  assert(cache_r.a[0] == r.a[0]);
-  assert(cache_r.a[1] == NULL); /* UnusedE */
-  assert(cache_r.a[2] == NULL); /* UnusedD */
-  assert(cache_r.a[3] == r.a[3]);
-  puts("R copied ok");
-
-  labcomm2014_decoder_free(decoder);
-  close(fd);
-  unlink(DATA_FILE);
-
-  labcomm2014_copy_free_generated_encoding_S1(labcomm2014_default_memory, &cache_s1);
-  puts("S1 deallocated ok");
-  labcomm2014_copy_free_generated_encoding_B(labcomm2014_default_memory, &cache_b);
-  puts("B deallocated ok");
-  labcomm2014_copy_free_generated_encoding_I(labcomm2014_default_memory, &cache_I);
-  puts("I deallocated ok");
-  labcomm2014_copy_free_generated_encoding_P(labcomm2014_default_memory, &cache_p);
-  puts("P deallocated ok");
-  labcomm2014_copy_free_test_sample_test_var(labcomm2014_default_memory, &cache_test_var);
-  puts("test_var deallocated ok");
-  labcomm2014_copy_free_more_types_A(labcomm2014_default_memory, &cache_a);
-  puts("A deallocated ok");
-  labcomm2014_copy_free_more_types_S(labcomm2014_default_memory, &cache_s);
-  puts("S deallocated ok");
-  labcomm2014_copy_free_more_types_NS(labcomm2014_default_memory, &cache_ns);
-  puts("NS deallocated ok");
-  labcomm2014_copy_free_more_types_AS(labcomm2014_default_memory, &cache_as);
-  puts("AS deallocated ok");
-}
diff --git a/lib/c/2014/test/test_labcomm_errors.c b/lib/c/2014/test/test_labcomm_errors.c
deleted file mode 100644
index 78085047502070da17d05264fd572a78fb91a366..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_labcomm_errors.c
+++ /dev/null
@@ -1,173 +0,0 @@
-#include "test_labcomm_errors.h"
-
-#include <stdlib.h>
-
-#include <labcomm.h>
-#include <labcomm_private.h>
-#include <labcomm_mem_writer.h>
-#include <labcomm_mem_reader.h>
-
-static enum labcomm_error callback_error_id;
-
-int assert_callback(enum labcomm_error expected, const char *name, const char *err_msg)
-{
-  int success;
-  printf("----> %s()\n", name);
-  if (callback_error_id == expected) {
-    printf("Succeeded.\n");
-    success = 1;
-  } else {
-    printf("Failed! %s\n", err_msg);
-    success = 0;
-  }
-  return success;
-}
-
-/* Our callback that just logs which error_id that the library reported. */
-void test_callback(enum labcomm_error error_id, size_t nbr_va_args, ...)
-{
-   va_list arg_pointer;
-   va_start(arg_pointer, nbr_va_args);
-   va_end(arg_pointer);
-   callback_error_id = error_id;
-}
- 
-void reset_callback_erro_id()
-{
-  callback_error_id = -128;
-}
-
-int encoded_size_mock(struct labcomm_signature *signature, void *voidp)
-{
-  return 0;
-}
-
-int test_enc_not_reg_encoder_sign()
-{
-  reset_callback_erro_id();
-  unsigned char *buf = (unsigned char *) "a";
-  labcomm_mem_writer_context_t *mcontext = labcomm_mem_writer_context_t_new(0, 1, buf);
-  labcomm_encoder_t *encoder = labcomm_encoder_new(labcomm_mem_writer, mcontext);
-  labcomm_register_error_handler_encoder(encoder, test_callback);
-  
-  labcomm_signature_t signature = {
-    .type = 0, 
-    .name = "test_signature", 
-    .encoded_size = encoded_size_mock, 
-    .size = 0, 
-    .signature = (unsigned char *) "0"};
-  encoder->do_encode(encoder, &signature, NULL);
-
-  return assert_callback(LABCOMM_ERROR_ENC_NO_REG_SIGNATURE, __FUNCTION__, "");
-}
-
-int test_enc_missing_do_reg()
-{
-  reset_callback_erro_id();
-  unsigned char *buf = (unsigned char *) "a";
-  labcomm_mem_writer_context_t *mcontext = labcomm_mem_writer_context_t_new(0, 1, buf);
-  labcomm_encoder_t *encoder = labcomm_encoder_new(labcomm_mem_writer, mcontext);
-  labcomm_register_error_handler_encoder(encoder, test_callback);
-
-  encoder->do_register = NULL;
-  labcomm_internal_encoder_register(encoder, NULL, NULL);
-
-  return assert_callback(LABCOMM_ERROR_ENC_MISSING_DO_REG, __FUNCTION__, "");
-}
-
-int test_enc_missing_do_encode()
-{
-  reset_callback_erro_id();
-  unsigned char *buf = (unsigned char *) "a";
-  labcomm_mem_writer_context_t *mcontext = labcomm_mem_writer_context_t_new(0, 1, buf);
-  labcomm_encoder_t *encoder = labcomm_encoder_new(labcomm_mem_writer, mcontext);
-  labcomm_register_error_handler_encoder(encoder, test_callback);
-
-  encoder->do_encode = NULL;
-  labcomm_internal_encode(encoder, NULL, NULL);
-
-  return assert_callback(LABCOMM_ERROR_ENC_MISSING_DO_ENCODE, __FUNCTION__, "");
-}
-
-int test_enc_buf_full()
-{
-  reset_callback_erro_id();
-  unsigned char *buf = (unsigned char *) "a";
-  labcomm_mem_writer_context_t *mcontext = labcomm_mem_writer_context_t_new(0, 1, buf);
-  labcomm_encoder_t *encoder = labcomm_encoder_new(labcomm_mem_writer, mcontext);
-  labcomm_register_error_handler_encoder(encoder, test_callback);
-
-  unsigned char *mbuf = mcontext->buf;
-  labcomm_writer_t writer = encoder->writer;
-  writer.data = malloc(1);
-  writer.pos = 1;
-  mcontext->write_pos = 1;
-  test_copy_data(&writer, mcontext, mbuf);
-
-  return assert_callback(LABCOMM_ERROR_ENC_BUF_FULL, __FUNCTION__, "");
-}
-
-void labcomm_decoder_typecast_t_mock(struct labcomm_decoder *decoder, labcomm_handler_typecast_t handler, void *voidp)
-{
-        ;
-}
-
-void labcomm_handler_typecast_t_mock(void *arg1, void *arg2)
-{
-        ;
-}
-
-int test_dec_missing_do_reg()
-{
-  reset_callback_erro_id();
-  unsigned char *buf = (unsigned char *) "a";
-  labcomm_mem_reader_context_t *mcontext = (labcomm_mem_reader_context_t *) malloc(sizeof(labcomm_mem_reader_context_t));
-  labcomm_decoder_t *decoder = labcomm_decoder_new(labcomm_mem_reader, mcontext);
-  labcomm_register_error_handler_decoder(decoder, test_callback);
-  
-  decoder->do_register = NULL;
-  labcomm_internal_decoder_register(decoder, NULL, labcomm_decoder_typecast_t_mock, labcomm_handler_typecast_t_mock, buf);
-
-  return assert_callback(LABCOMM_ERROR_DEC_MISSING_DO_REG, __FUNCTION__, "");
-}
-
-int test_dec_missing_do_decode_one()
-{
-  reset_callback_erro_id();
-  labcomm_mem_reader_context_t *mcontext = (labcomm_mem_reader_context_t *) malloc(sizeof(labcomm_mem_reader_context_t));
-  labcomm_decoder_t *decoder = labcomm_decoder_new(labcomm_mem_reader, mcontext);
-  labcomm_register_error_handler_decoder(decoder, test_callback);
-  
-  decoder->do_decode_one = NULL;
-  labcomm_decoder_decode_one(decoder);
-
-  return assert_callback(LABCOMM_ERROR_DEC_MISSING_DO_DECODE_ONE, __FUNCTION__, "");
-}
-
-int main()
-{
-  printf("####> Begin tests.\n");
-  unsigned int nbr_succeed = 0;
-  unsigned int nbr_tests = 6; // Increment this when new tests are written.
-  nbr_succeed += test_enc_not_reg_encoder_sign();
-  nbr_succeed += test_enc_missing_do_reg();
-  nbr_succeed += test_enc_missing_do_encode();
-  nbr_succeed += test_enc_buf_full();
-  nbr_succeed += test_dec_missing_do_reg();
-  nbr_succeed += test_dec_missing_do_decode_one();
-
-  // Too tedius to test really...
-  //nbr_succeed += test_dec_unknown_datatype();
-  //nbr_succeed += test_dec_index_mismatch();
-  //nbr_succeed += test_dec_type_not_found();
-
-  //nbr_succeed += test_unimplemented_func(); // This test will be obsolete in the future ;-)
-  //nbr_succeed += test_user_def();           // There are no user defined errors in the library of course.
-
-  printf("####> End tests.\nSummary: %u/%u tests succeed.\n", nbr_succeed, nbr_tests);
-  if (nbr_succeed == nbr_tests) {
-	  return EXIT_SUCCESS;
-  } else {
-  	  return EXIT_FAILURE;
-  }
-}
diff --git a/lib/c/2014/test/test_labcomm_errors.h b/lib/c/2014/test/test_labcomm_errors.h
deleted file mode 100644
index 8cc39182950f981e3955537da46780f9263256a9..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_labcomm_errors.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef TEST_LABCOMM_ERRORS_H
-#define TEST_LABCOMM_ERRORS_H
-
-void test_not_reg_encoder_sign();
-
-#endif
diff --git a/lib/c/2014/test/test_labcomm_generated_encoding.c b/lib/c/2014/test/test_labcomm_generated_encoding.c
deleted file mode 100644
index f728ac0d6600ae8f5862c0a7725c821a6d11f33f..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_labcomm_generated_encoding.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
-  test_labcomm2014_generated_encoding.c -- LabComm tests of generated encoding
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include "labcomm2014_private.h"
-#include "labcomm2014_default_error_handler.h"
-#include "labcomm2014_default_memory.h"
-#include "labcomm2014_pthread_scheduler.h"
-#include "test/gen/generated_encoding.h"
-
-#define IOCTL_WRITER_ASSERT_BYTES 4096
-#define IOCTL_WRITER_RESET 4097
-
-#define EXPECT(...)							\
-  {                                                                     \
-    int expected[] = __VA_ARGS__;					\
-    labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_ASSERT_BYTES,       \
-			  __LINE__,					\
-			  sizeof(expected)/sizeof(expected[0]),		\
-			  expected);					\
-  }
-
-#define VARIABLE(i) -(i + 1)
-#define IS_VARIABLE(i) (i < 0)
-
-static unsigned char buffer[128];
-struct labcomm2014_writer *writer;
-static int seen_variable[1024];
-
-static int buf_writer_alloc(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context)
-{
-  writer = w; /* Hack */
-  w->data_size = sizeof(buffer);
-  w->count = w->data_size;
-  w->data = buffer;
-  w->pos = 0;
-  
-  return 0;
-}
-
-static int buf_writer_free(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context)
-{
-  return 0;
-}
-
-static int buf_writer_start(
-  struct labcomm2014_writer *w,
-  struct labcomm2014_writer_action_context *action_context,
-  int index,
-  const struct labcomm2014_signature *signature,
-  void *value)
-{
-  return 0;
-}
-
-static int buf_writer_end(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context)
-{
-  return 0;
-}
-
-static int buf_writer_flush(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context)
-{
-  fprintf(stderr, "Should not come here %s:%d\n", __FILE__, __LINE__);
-  exit(1);
-  
-  return 0;
-}
-
-static int buf_writer_ioctl(
-  struct labcomm2014_writer *w, 
-  struct labcomm2014_writer_action_context *action_context,
-  int signature_index, const struct labcomm2014_signature *signature,
-  uint32_t action, va_list arg)
-{
-  int result = -ENOTSUP;
-  switch (action) {
-    case IOCTL_WRITER_ASSERT_BYTES: {
-      int line = va_arg(arg, int);
-      int count = va_arg(arg, int);
-      int *expected = va_arg(arg, int *);
-      int i, mismatch;
-
-      mismatch = 0;
-      if (w->pos != count) {
-	fprintf(stderr, "Invalid length detected %d != %d (%s:%d)\n", 
-		w->pos, count, __FILE__, line);
-	mismatch = 1;
-      } 
-      for (i = 0 ; i < count ; i++) {
-        if (IS_VARIABLE(expected[i])) {
-          if (seen_variable[VARIABLE(expected[i])] == -1) {
-            seen_variable[VARIABLE(expected[i])] = buffer[i];
-          }
-          if (seen_variable[VARIABLE(expected[i])] != buffer[i]) {
-            fprintf(stderr, "Unexpected variable (%d:  != %d)\n",
-                    seen_variable[VARIABLE(expected[i])], buffer[i]);
-            mismatch = 1;
-          }
-        } else if (expected[i] != buffer[i]) {
-	  mismatch = 1;
-	}
-      }
-      if (mismatch) {
-	fprintf(stderr, "Encoder mismatch (%s:%d)\n",
-		__FILE__, line);
-
-	for (i = 0 ; i < w->pos ; i++) {
-	  printf("%2.2x ", w->data[i]);
-	}
-	printf("\n");
-	for (i = 0 ; i < count ; i++) {
-	  if (expected[i] < 0) {
-	    printf("v%d ", VARIABLE(expected[i]));
-	  } else {
-	    printf("%2.2x ", expected[i] );
-	  }
-	}
-	printf("\n");
-	exit(1);
-      }
-      result = 0;
-    } break;
-    case IOCTL_WRITER_RESET: {
-      w->pos = 0;
-      result = 0;
-    }
-  }
-  return result;
-}
-
-const struct labcomm2014_writer_action writer_action = {
-  .alloc = buf_writer_alloc,
-  .free = buf_writer_free,
-  .start = buf_writer_start,
-  .end = buf_writer_end,
-  .flush = buf_writer_flush,
-  .ioctl = buf_writer_ioctl
-};
-
-static struct labcomm2014_writer_action_context action_context = {
-  .next = NULL,
-  .action = &writer_action,
-  .context = NULL
-}; 
-static struct labcomm2014_writer buffer_writer = {
-  .action_context = &action_context,
-  .data = buffer,
-  .data_size = sizeof(buffer),
-  .count = sizeof(buffer),
-  .pos = 0,
-  .error = 0,
-};
-
-void dump_encoder(struct labcomm2014_encoder *encoder)
-{
-  int i;
-  
-  for (i = 0 ; i < writer->pos ; i++) {
-    printf("%2.2x ", writer->data[i]);
-  }
-  printf("\n");
-}
-
-int main(void)
-{
-  generated_encoding_B B = 1;
-  generated_encoding_R R;
-  struct labcomm2014_encoder *encoder;
-  int i;
-
-  for (i = 0 ; i < sizeof(seen_variable)/sizeof(seen_variable[0]) ; i++) {
-    seen_variable[i] = -1;
-  }
-
-  encoder = labcomm2014_encoder_new(
-    &buffer_writer, 
-    labcomm2014_default_error_handler,
-    labcomm2014_default_memory,
-    labcomm2014_pthread_scheduler_new(labcomm2014_default_memory));
-  EXPECT({ 0x01, 0x0c, 0x0b, 
-           'L', 'a', 'b', 'C', 'o', 'm', 'm', '2','0', '1', '4' });
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  /* Register twice to make sure that only one registration gets encoded */
-  labcomm2014_encoder_register_generated_encoding_V(encoder);
-  labcomm2014_encoder_register_generated_encoding_V(encoder);
-  EXPECT({ 0x02, 0x06, VARIABLE(0), 0x01, 'V', 0x02, 0x11, 0x00,
-           0x04, 0x08, VARIABLE(1), 0x03, 'v', '_', 't', 0x02, 0x11, 0x00,
-           0x04, 0x05, VARIABLE(2), 0x01, 'V', 0x01, VARIABLE(1),
-           0x05, 0x02, VARIABLE(0), VARIABLE(2) });
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  /* Register twice to make sure that only one registration gets encoded */
-  labcomm2014_encoder_register_generated_encoding_B(encoder);
-  labcomm2014_encoder_register_generated_encoding_B(encoder);
-  EXPECT({ 0x02, 0x05, VARIABLE(3), 0x01, 'B', 0x01, 0x21,
-           0x05, 0x02, VARIABLE(3), LABCOMM_BIND_SELF });
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  /* Register twice to make sure that only one registration gets encoded */
-  labcomm2014_encoder_register_generated_encoding_R(encoder);
-  labcomm2014_encoder_register_generated_encoding_R(encoder);
-  EXPECT({ 0x02, 0x08, VARIABLE(4), 0x01, 'R', 0x04, 0x10, 0x01, 0x04, 0x28,
-           0x05, 0x02, VARIABLE(4), LABCOMM_BIND_SELF });
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  /* Register twice to make sure that only one registration gets encoded */
-  labcomm2014_encoder_sample_ref_register(encoder, 
-                                      labcomm2014_signature_generated_encoding_V);
-  labcomm2014_encoder_sample_ref_register(encoder, 
-                                      labcomm2014_signature_generated_encoding_V);
-  EXPECT({0x03, 0x06, VARIABLE(5), 0x01, 'V', 0x02, 0x11, 0x00});
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  /* Register twice to make sure that only one registration gets encoded */
-  labcomm2014_encoder_sample_ref_register(encoder, 
-                                      labcomm2014_signature_generated_encoding_B);
-  labcomm2014_encoder_sample_ref_register(encoder, 
-                                      labcomm2014_signature_generated_encoding_B);
-  EXPECT({0x03, 0x05, VARIABLE(6), 0x01, 'B', 0x01, 0x21});
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  /* Register twice to make sure that only one registration gets encoded */
-  labcomm2014_encoder_sample_ref_register(encoder, 
-                                      labcomm2014_signature_generated_encoding_R);
-  labcomm2014_encoder_sample_ref_register(encoder, 
-                                      labcomm2014_signature_generated_encoding_R);
-  EXPECT({0x03, 0x08, VARIABLE(7), 0x01, 'R', 0x04, 0x10, 0x01, 0x04, 0x28});
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  // was: labcomm2014_encode_generated_encoding_V(encoder, &V);
-  labcomm2014_encode_generated_encoding_V(encoder);
-  EXPECT({VARIABLE(10), 0x00 });
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  labcomm2014_encode_generated_encoding_B(encoder, &B);
-  EXPECT({VARIABLE(20), 0x01, 1});
-
-  labcomm2014_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  R.a[0] = labcomm2014_signature_generated_encoding_V;
-  R.a[1] = labcomm2014_signature_generated_encoding_B;
-  R.a[2] = labcomm2014_signature_generated_encoding_UnusedE;
-  R.a[3] = labcomm2014_signature_generated_encoding_R;
-  labcomm2014_encode_generated_encoding_R(encoder, &R);
-  EXPECT({VARIABLE(4), 0x10, 0x00, 0x00, 0x00, VARIABLE(5),
-                             0x00, 0x00, 0x00, VARIABLE(6),
-                             0x00, 0x00, 0x00, 0x00,
-                             0x00, 0x00, 0x00, VARIABLE(7)});
-  return 0;
-}
-
diff --git a/lib/c/2014/test/test_labcomm_pthread_scheduler.c b/lib/c/2014/test/test_labcomm_pthread_scheduler.c
deleted file mode 100644
index aa7c5f0e08a77ccdf46717418ed06a4d4d64f3bf..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_labcomm_pthread_scheduler.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-  test_labcomm2014_pthread_scheduler.c -- test labcomm2014 pthread based task 
-                                      coordination
-
-  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
-
-  This file is part of LabComm.
-
-  LabComm is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  LabComm is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "labcomm2014_default_memory.h"
-#include "labcomm2014_scheduler.h"
-#include "labcomm2014_pthread_scheduler.h"
-
-#define TICK 100000
-struct func_arg {
-  struct labcomm2014_scheduler *scheduler;
-  int i;
-};
-
-static void func(void *arg) 
-{
-  struct func_arg *func_arg = arg;
-  
-  printf("%p %d\n", arg, func_arg->i);
-  if (func_arg->i == 999) {
-    labcomm2014_scheduler_wakeup(func_arg->scheduler);
-  }
-}
-
-void enqueue(struct labcomm2014_scheduler *scheduler, 
-	     int first, int last)
-{
-  int i;
-  
-  for (i = first ; i <= last ; i++) {
-    struct func_arg *tmp = malloc(sizeof(*tmp));
-    
-    tmp->scheduler = scheduler;
-    tmp->i = i;
-    labcomm2014_scheduler_enqueue(scheduler, i*TICK, func, tmp);
-  }
-}
-
-int main(int argc, char *argv[])
-{
-  struct labcomm2014_scheduler *scheduler;
-  struct labcomm2014_time *time;
-
-  scheduler = labcomm2014_pthread_scheduler_new(labcomm2014_default_memory);
-  enqueue(scheduler, 0, 5);
-  enqueue(scheduler, 0, 1);
-  enqueue(scheduler, 1, 3);
-  enqueue(scheduler, 7, 10);
-  {
-    struct func_arg *tmp = malloc(sizeof(*tmp));
-    
-    tmp->scheduler = scheduler;
-    tmp->i = 999;
-    labcomm2014_scheduler_enqueue(scheduler, 6*TICK, func, tmp);
-  }
-  time = labcomm2014_scheduler_now(scheduler);
-  labcomm2014_time_add_usec(time, 12*TICK);
-  labcomm2014_scheduler_sleep(scheduler, NULL);
-  labcomm2014_scheduler_sleep(scheduler, time);
-
-  return 0;
-}
diff --git a/lib/c/2014/test/test_sample.lc b/lib/c/2014/test/test_sample.lc
deleted file mode 100644
index 302c6158f2f6598995101898eec85bd9ae0f9835..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_sample.lc
+++ /dev/null
@@ -1 +0,0 @@
-sample int test_var[_,2,_];
diff --git a/lib/c/2014/test/test_signature_numbers.c b/lib/c/2014/test/test_signature_numbers.c
deleted file mode 100644
index c540f81f51c8a558b097738a543023362daa284e..0000000000000000000000000000000000000000
--- a/lib/c/2014/test/test_signature_numbers.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include "labcomm2014_private.h"
-#include "test/gen/another_encoding.h"
-#include "test/gen/generated_encoding.h"
-
-static void info(char *name, char *full_name, 
-		 const struct labcomm2014_signature *signature) {
-  printf("%s %s %p -> %d\n", name,  full_name, signature, 
-	 labcomm2014_get_local_index(signature));
-  if (labcomm2014_get_local_index(signature) < 0x40) {
-    exit(1);
-  }
-};
-
-int main(int argc, char *argv[])
-{
-#define FUNC(name, full_name) \
-  info( #name, #full_name, labcomm2014_signature_##full_name)
-
-  LABCOMM_FORALL_SAMPLES_generated_encoding(FUNC, ;);
-  LABCOMM_FORALL_SAMPLES_another_encoding(FUNC, ;);
-  return 0;
-}
diff --git a/lib/c/Makefile b/lib/c/Makefile
index 5d36fef53c20424e93bc83107bcf83be9d64f36c..dd8f6eda4b521aa0a80e02fc7cd201a29e3305f3 100644
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -1,4 +1,4 @@
-VERSIONS=2006 2014
+VERSIONS=2006
 
 all:
 
diff --git a/lib/csharp/.gitignore b/lib/csharp/.gitignore
index 7252dda3fb2158fc919cd5132fa2aec35d82ef86..3f59eaa9490a1f6a40010a865268962b6f7ade31 100644
--- a/lib/csharp/.gitignore
+++ b/lib/csharp/.gitignore
@@ -1 +1 @@
-labcomm.dll
+labcomm2006.dll
diff --git a/lib/csharp/Makefile b/lib/csharp/Makefile
index 7dfb2de341bb094c32d1e1f63c06af0ed6aa7aaa..a833268fbc0ff6713471d854130fc5729732b427 100644
--- a/lib/csharp/Makefile
+++ b/lib/csharp/Makefile
@@ -11,9 +11,9 @@ MODULES=Constant\
 	SampleType 
 
 .PHONY: all
-all: labcomm.dll
+all: labcomm2006.dll
 
-labcomm.dll: $(MODULES:%=se/lth/control/labcomm/%.cs) Makefile
+labcomm2006.dll: $(MODULES:%=se/lth/control/labcomm2006/%.cs) Makefile
 	mcs -out:$@ -target:library $(filter %.cs, $^)
 
 .PHONY: test
@@ -24,4 +24,4 @@ clean:
 
 .PHONY: distclean
 distclean:
-	rm -f labcomm.dll
+	rm -f labcomm2006.dll
diff --git a/lib/csharp/se/lth/control/labcomm/Constant.cs b/lib/csharp/se/lth/control/labcomm2006/Constant.cs
similarity index 74%
rename from lib/csharp/se/lth/control/labcomm/Constant.cs
rename to lib/csharp/se/lth/control/labcomm2006/Constant.cs
index 37615448d0cec858190bbb16dd9a465677a8ccbb..e74678fe54bd9baef3e10f81a8981c373865fc44 100644
--- a/lib/csharp/se/lth/control/labcomm/Constant.cs
+++ b/lib/csharp/se/lth/control/labcomm2006/Constant.cs
@@ -2,17 +2,10 @@ namespace se.lth.control.labcomm {
 
   public class Constant {
 
-    public const string CURRENT_VERSION = "LabComm2014";
-
     /*
      * Allowed packet tags
      */
-    public const int VERSION          = 0x01;
     public const int SAMPLE_DEF       = 0x02;
-    public const int SAMPLE_REF       = 0x03;
-    public const int TYPE_DEF         = 0x04;
-    public const int TYPE_BINDING     = 0x05;
-    public const int PRAGMA           = 0x3f;
     public const int FIRST_USER_INDEX = 0x40; /* ..0xffffffff */
 
     /*
diff --git a/lib/csharp/se/lth/control/labcomm/Decoder.cs b/lib/csharp/se/lth/control/labcomm2006/Decoder.cs
similarity index 76%
rename from lib/csharp/se/lth/control/labcomm/Decoder.cs
rename to lib/csharp/se/lth/control/labcomm2006/Decoder.cs
index 4e8868fc7bc86949897b90911522c865bbc56887..70c8138803e837a3f4a283a0ec0e5c164643b930 100644
--- a/lib/csharp/se/lth/control/labcomm/Decoder.cs
+++ b/lib/csharp/se/lth/control/labcomm2006/Decoder.cs
@@ -6,7 +6,6 @@ namespace se.lth.control.labcomm {
 
     void register(SampleDispatcher dispatcher, 
 		  SampleHandler handler);
-    void registerSampleRef(SampleDispatcher dispatcher);
 
     bool decodeBoolean();
     byte decodeByte();
@@ -16,8 +15,6 @@ namespace se.lth.control.labcomm {
     float decodeFloat();
     double decodeDouble();
     String decodeString();
-    int decodePacked32();
-    Type decodeSampleRef();
 
   }
 
diff --git a/lib/csharp/se/lth/control/labcomm/DecoderChannel.cs b/lib/csharp/se/lth/control/labcomm2006/DecoderChannel.cs
similarity index 59%
rename from lib/csharp/se/lth/control/labcomm/DecoderChannel.cs
rename to lib/csharp/se/lth/control/labcomm2006/DecoderChannel.cs
index 99e17fbac0f6065f3364c72dddfe1bce78808cb9..334742f69d3340fb7aa7fdc38b866053bf739b44 100644
--- a/lib/csharp/se/lth/control/labcomm/DecoderChannel.cs
+++ b/lib/csharp/se/lth/control/labcomm2006/DecoderChannel.cs
@@ -2,14 +2,13 @@ namespace se.lth.control.labcomm {
 
   using System;
   using System.IO;
-  using System.Runtime.InteropServices;
   using System.Text;
+  using System.Runtime.InteropServices;
 
   public class DecoderChannel : Decoder {
 
     private Stream stream;
-    private DecoderRegistry def_registry = new DecoderRegistry();
-    private DecoderRegistry ref_registry = new DecoderRegistry();
+    private DecoderRegistry registry = new DecoderRegistry();
     byte[] buf = new byte[8];
 
     public DecoderChannel(Stream stream) {
@@ -19,40 +18,18 @@ namespace se.lth.control.labcomm {
     public void runOne() {
       bool done = false;
       while (!done) {
-	int tag = decodePacked32();
-        int length = decodePacked32();
+	int tag = decodeInt();
+
 	switch (tag) {
-        case Constant.VERSION: {
-          String version = decodeString();
-          if (version != Constant.CURRENT_VERSION) {
-  	    throw new IOException("LabComm version mismatch " +
-			          version + " != " + Constant.CURRENT_VERSION);
-          }
-        } break;
         case Constant.SAMPLE_DEF: {
-          int index = decodePacked32();
-          String name = decodeString();
-          int signature_length = decodePacked32();
-          byte[] signature = new byte[signature_length];
-          ReadBytes(signature, signature_length);
-	  def_registry.add(index, name, signature);
-        } break;
-        case Constant.SAMPLE_REF: {
-          int index = decodePacked32();
+          int index = decodeInt();
           String name = decodeString();
-          int signature_length = decodePacked32();
-          byte[] signature = new byte[signature_length];
-          ReadBytes(signature, signature_length);
-	  ref_registry.add(index, name, signature);
-        } break;
-        case Constant.TYPE_DEF: 
-        case Constant.TYPE_BINDING: {
-            for(int i=0; i<length;i++){
-                decodeByte();
-            }                
+	  MemoryStream signature = new MemoryStream();
+	  collectFlatSignature(new EncoderChannel(signature));
+	  registry.add(index, name, signature.ToArray());
         } break;
         default: {
-          DecoderRegistry.Entry e = def_registry.get(tag);
+          DecoderRegistry.Entry e = registry.get(tag);
           if (e == null) {
             throw new IOException("Unhandled tag " + tag);
           }
@@ -77,13 +54,45 @@ namespace se.lth.control.labcomm {
       }
     }
 
-    public void register(SampleDispatcher dispatcher, 
-			 SampleHandler handler) {
-      def_registry.add(dispatcher, handler);
+    private void collectFlatSignature(Encoder e) {
+      int type = decodeInt();
+      e.encodeInt(type);
+      switch (type) {
+        case Constant.ARRAY: {
+          int dimensions = decodeInt();
+          e.encodeInt(dimensions);
+          for (int i = 0 ; i < dimensions ; i++) {
+             e.encodeInt(decodeInt());
+          }
+          collectFlatSignature(e);
+        } break;
+        case Constant.STRUCT: {
+          int fields = decodeInt();
+          e.encodeInt(fields);
+          for (int i = 0 ; i < fields ; i++) {
+            e.encodeString(decodeString());
+            collectFlatSignature(e);
+          }
+        } break;
+        case Constant.BOOLEAN:
+        case Constant.BYTE:
+        case Constant.SHORT:
+        case Constant.INT:
+        case Constant.LONG:
+        case Constant.FLOAT:
+        case Constant.DOUBLE:
+        case Constant.STRING: {
+        } break;
+        default: {
+          throw new IOException("Unimplemented type=" + type);
+        }
+      }
+      e.end(null);
     }
 
-    public void registerSampleRef(SampleDispatcher dispatcher) {
-      ref_registry.add(dispatcher, null);
+    public void register(SampleDispatcher dispatcher, 
+			 SampleHandler handler) {
+      registry.add(dispatcher, handler);
     }
 
     private void ReadBytes(byte[] result, int length) {
@@ -147,35 +156,12 @@ namespace se.lth.control.labcomm {
     }
 
     public String decodeString() {
-      int length = decodePacked32();
+      int length = decodeInt();
       byte[] buf = new byte[length];
       ReadBytes(buf, length);
       return Encoding.UTF8.GetString(buf);
     }
 
-    public int decodePacked32() {
-      Int64 res = 0;
-      bool cont = true; 
-
-      do {
-        Int64 c = decodeByte();
-	res = (res << 7) | (c & 0x7f);
-        cont = (c & 0x80) != 0;
-      } while(cont);
-
-      return (int) (res & 0xffffffff);
-    }
-
-    public Type decodeSampleRef() {
-      int index = (int)ReadInt(4);
-      try {
-        DecoderRegistry.Entry e = ref_registry.get(index);
-        return e.getSampleDispatcher().getSampleClass();
-      } catch (NullReferenceException) {
-        return null;
-      }
-    }
-
   }
 
 } 
diff --git a/lib/csharp/se/lth/control/labcomm/DecoderRegistry.cs b/lib/csharp/se/lth/control/labcomm2006/DecoderRegistry.cs
similarity index 100%
rename from lib/csharp/se/lth/control/labcomm/DecoderRegistry.cs
rename to lib/csharp/se/lth/control/labcomm2006/DecoderRegistry.cs
diff --git a/lib/csharp/se/lth/control/labcomm/Encoder.cs b/lib/csharp/se/lth/control/labcomm2006/Encoder.cs
similarity index 77%
rename from lib/csharp/se/lth/control/labcomm/Encoder.cs
rename to lib/csharp/se/lth/control/labcomm2006/Encoder.cs
index 1deb1b7ee9d28e52c952eb78aaef1c7fe7cf3db7..5fe9d1fcc7ac34e3aac05437f118d08943de7186 100644
--- a/lib/csharp/se/lth/control/labcomm/Encoder.cs
+++ b/lib/csharp/se/lth/control/labcomm2006/Encoder.cs
@@ -5,7 +5,6 @@ namespace se.lth.control.labcomm {
   public interface Encoder {
     
     void register(SampleDispatcher dispatcher);
-    void registerSampleRef(SampleDispatcher dispatcher);
     void begin(Type c);
     void end(Type c);
 
@@ -17,8 +16,6 @@ namespace se.lth.control.labcomm {
     void encodeFloat(float value);
     void encodeDouble(double value);
     void encodeString(String value);
-    void encodePacked32(Int64 value);
-    void encodeSampleRef(Type value);
     
   }
 
diff --git a/lib/csharp/se/lth/control/labcomm/EncoderChannel.cs b/lib/csharp/se/lth/control/labcomm2006/EncoderChannel.cs
similarity index 62%
rename from lib/csharp/se/lth/control/labcomm/EncoderChannel.cs
rename to lib/csharp/se/lth/control/labcomm2006/EncoderChannel.cs
index 2f3da1cc99cc0c1abe24fa991fc31d73eb4fef96..3ef38e0e80fd28691ca46a600ec020ea871a0075 100644
--- a/lib/csharp/se/lth/control/labcomm/EncoderChannel.cs
+++ b/lib/csharp/se/lth/control/labcomm2006/EncoderChannel.cs
@@ -10,38 +10,19 @@ namespace se.lth.control.labcomm {
     private Stream writer;
     private MemoryStream bytes = new MemoryStream();
     private EncoderRegistry def_registry = new EncoderRegistry();
-    private EncoderRegistry ref_registry = new EncoderRegistry();
     byte[] buf = new byte[8];
     private int current_tag; 
 
     public EncoderChannel(Stream writer) {
       this.writer = writer;
-
-      begin(Constant.VERSION);
-      encodeString(Constant.CURRENT_VERSION);
-      end(null);
     }
 
     public void register(SampleDispatcher dispatcher) {
       int index = def_registry.add(dispatcher);
       begin(Constant.SAMPLE_DEF);
-      encodePacked32(index);
-      encodeString(dispatcher.getName());
-      byte[] signature = dispatcher.getSignature();
-      encodePacked32(signature.Length);
-      for (int i = 0 ; i < signature.Length ; i++) {
-	encodeByte(signature[i]);
-      }
-      end(null);
-    }
-
-    public void registerSampleRef(SampleDispatcher dispatcher) {
-      int index = ref_registry.add(dispatcher);
-      begin(Constant.SAMPLE_REF);
-      encodePacked32(index);
+      encodeInt(index);
       encodeString(dispatcher.getName());
       byte[] signature = dispatcher.getSignature();
-      encodePacked32(signature.Length);
       for (int i = 0 ; i < signature.Length ; i++) {
 	encodeByte(signature[i]);
       }
@@ -51,6 +32,7 @@ namespace se.lth.control.labcomm {
     private void begin(int tag) {
       current_tag = tag;
       bytes.SetLength(0);
+      encodeInt(tag);
     }
 
     public void begin(Type c) {
@@ -58,25 +40,11 @@ namespace se.lth.control.labcomm {
     }
 
     public void end(Type c) {
-      WritePacked32(writer, current_tag);
-      WritePacked32(writer, bytes.Length);
       bytes.WriteTo(writer);
       bytes.SetLength(0);
       writer.Flush();
     }
 
-    private void WritePacked32(Stream s, Int64 value) {
-      Int64 v = value & 0xffffffff;
-      int i;
-  
-      for (i = 0 ; i == 0 || v != 0 ; i++, v = (v >> 7)) {
-        buf[i] = (byte)(v & 0x7f | (i!=0?0x80:0x00));
-      }
-      for (i = i - 1 ; i >= 0 ; i--) {
-        s.WriteByte(buf[i]);
-      }      
-    }
-
     private void WriteInt(Int64 value, int length) {
       for (int i = length - 1 ; i >= 0 ; i--) {
 	buf[i] = (byte)(value & 0xff);
@@ -124,22 +92,10 @@ namespace se.lth.control.labcomm {
 
     public void encodeString(String value) {
       byte[] buf = Encoding.UTF8.GetBytes(value);
-      encodePacked32(buf.Length);
+      encodeInt(buf.Length);
       bytes.Write(buf, 0, buf.Length);
     }
 
-    public void encodePacked32(Int64 value) {
-      WritePacked32(bytes, value);
-    }
-
-    public void encodeSampleRef(Type value) {
-      int index = 0;
-      try {
-        index = ref_registry.getTag(value);
-      } catch (NullReferenceException) {
-      }
-      WriteInt(index, 4);
-    }
-
   }
+
 }
diff --git a/lib/csharp/se/lth/control/labcomm/EncoderRegistry.cs b/lib/csharp/se/lth/control/labcomm2006/EncoderRegistry.cs
similarity index 100%
rename from lib/csharp/se/lth/control/labcomm/EncoderRegistry.cs
rename to lib/csharp/se/lth/control/labcomm2006/EncoderRegistry.cs
diff --git a/lib/csharp/se/lth/control/labcomm/Sample.cs b/lib/csharp/se/lth/control/labcomm2006/Sample.cs
similarity index 100%
rename from lib/csharp/se/lth/control/labcomm/Sample.cs
rename to lib/csharp/se/lth/control/labcomm2006/Sample.cs
diff --git a/lib/csharp/se/lth/control/labcomm/SampleDispatcher.cs b/lib/csharp/se/lth/control/labcomm2006/SampleDispatcher.cs
similarity index 100%
rename from lib/csharp/se/lth/control/labcomm/SampleDispatcher.cs
rename to lib/csharp/se/lth/control/labcomm2006/SampleDispatcher.cs
diff --git a/lib/csharp/se/lth/control/labcomm/SampleHandler.cs b/lib/csharp/se/lth/control/labcomm2006/SampleHandler.cs
similarity index 100%
rename from lib/csharp/se/lth/control/labcomm/SampleHandler.cs
rename to lib/csharp/se/lth/control/labcomm2006/SampleHandler.cs
diff --git a/lib/csharp/se/lth/control/labcomm/SampleType.cs b/lib/csharp/se/lth/control/labcomm2006/SampleType.cs
similarity index 100%
rename from lib/csharp/se/lth/control/labcomm/SampleType.cs
rename to lib/csharp/se/lth/control/labcomm2006/SampleType.cs
diff --git a/lib/java/Makefile b/lib/java/Makefile
index 27029d5986fd799329f7c692730d22b1dc47a65f..c478886546851dc6f3e2448f2266cf42d31e1fc8 100644
--- a/lib/java/Makefile
+++ b/lib/java/Makefile
@@ -19,17 +19,7 @@ MODULES=Constant \
 	WriterWrapper
 
 .PHONY: all
-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
-
-labcomm2014.jar: gen/JAVAC
-	echo $@
-	cd gen ; jar cf ../$@ se/lth/control/labcomm/*.class
+all: labcomm2006.jar
 
 labcomm2006.jar: gen/JAVAC
 	echo $@
@@ -38,10 +28,9 @@ labcomm2006.jar: gen/JAVAC
 gen:
 	mkdir gen
 
-gen/JAVAC: $(MODULES:%=se/lth/control/labcomm/%.java) \
-	   $(MODULES:%=se/lth/control/labcomm2006/%.java) \
+gen/JAVAC: $(MODULES:%=se/lth/control/labcomm2006/%.java) \
 	   Makefile | gen
-	javac -cp ../../compiler/labcomm_compiler.jar -d gen \
+	javac -cp ../../compiler/labcomm2006_compiler.jar -d gen \
             $(filter %.java, $^)
 	touch $@
 
@@ -55,4 +44,4 @@ clean:
 
 .PHONY: distclean
 distclean: clean
-	rm -rf labcomm.jar labcomm2006.jar labcomm2014.jar
+	rm -rf labcomm2006.jar 
diff --git a/lib/java/se/lth/control/labcomm/ASTbuilder.java b/lib/java/se/lth/control/labcomm/ASTbuilder.java
deleted file mode 100644
index 73bd171750c722c910a12549f535272eafc3b5a5..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/ASTbuilder.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.EOFException;
-
-import se.lth.control.labcomm.TypeDef;
-import se.lth.control.labcomm.TypeDefParser;
-
-import se.lth.control.labcomm2014.compiler.LabComm;
-import se.lth.control.labcomm2014.compiler.LabCommParser;
-
-import se.lth.control.labcomm2014.compiler.List;
-import se.lth.control.labcomm2014.compiler.Program;
-import se.lth.control.labcomm2014.compiler.Decl;
-import se.lth.control.labcomm2014.compiler.TypeDecl;
-import se.lth.control.labcomm2014.compiler.SampleDecl;
-import se.lth.control.labcomm2014.compiler.Type;
-import se.lth.control.labcomm2014.compiler.VoidType;
-import se.lth.control.labcomm2014.compiler.PrimType;
-import se.lth.control.labcomm2014.compiler.UserType;
-import se.lth.control.labcomm2014.compiler.StructType;
-import se.lth.control.labcomm2014.compiler.Field;
-import se.lth.control.labcomm2014.compiler.ArrayType;
-import se.lth.control.labcomm2014.compiler.VariableArrayType;
-import se.lth.control.labcomm2014.compiler.FixedArrayType;
-import se.lth.control.labcomm2014.compiler.Dim;
-import se.lth.control.labcomm2014.compiler.Exp;
-import se.lth.control.labcomm2014.compiler.IntegerLiteral;
-import se.lth.control.labcomm2014.compiler.VariableSize;
-
-
-/** A class for building a JastAdd AST from the parsed types
- *  created by a TypeDefParser. This class depends on the LabComm compiler.
- */
-public class ASTbuilder implements TypeDefParser.ParsedSymbolVisitor {
-
-        private LinkedList<Type> typeStack;
-        private LinkedList<Field> fieldStack;
-
-        public ASTbuilder() {
-            this.typeStack = new LinkedList<Type>();
-            this.fieldStack = new LinkedList<Field>();
-        }
-
-        private void assertStacksEmpty() throws RuntimeException {
-            if(!typeStack.isEmpty()) {
-               throw new RuntimeException("Error: type stack not empty"); 
-            }
-            if(!fieldStack.isEmpty()) {
-               throw new RuntimeException("Error: field stack not empty"); 
-            }
-        }
-
-        public void visit(TypeDefParser.TypeSymbol s){
-            throw new Error("not implemented? needed?");
-
-        }
-        public void visit(TypeDefParser.SampleSymbol s){
-            throw new Error("not implemented? needed?");
-
-        }
-        public void visit(TypeDefParser.NameSymbol s){
-            throw new Error("not implemented? needed?");
-        }
-
-        public void visit(TypeDefParser.PrimitiveType t){
-            typeStack.push(new PrimType(t.getName(), t.getTag()));
-        }
-
-// SampleRefs are currently represented as primitive types,
-// see comment in TypeDefParser
-//        public void visit(TypeDefParser.SampleRefType t){
-//            typeStack.push(new SampleRefType());
-//        }
-
-        public void visit(TypeDefParser.ParsedStructType t){
-            if(t.isVoid()) {
-                typeStack.push(new VoidType());
-            } else {
-                List<Field> tmpF = new List<Field>();
-                for( TypeDefParser.ParsedField f : t.getFields()) {
-                    f.accept(this);
-                    tmpF.add(fieldStack.pop());
-                }
-                typeStack.push(new StructType(tmpF));
-            }
-        }
-        public void visit(TypeDefParser.ParsedField t){
-            t.getType().accept(this);
-            fieldStack.push(new Field(typeStack.pop(),t.getName()));
-
-        }
-        public void visit(TypeDefParser.ArrayType t){
-            boolean isFixed = true;
-            List<Exp> dim = new List<Exp>();
-            for(int i : t.getIdx()) {
-                if(i == 0) {
-                    dim.add(new VariableSize());
-                    isFixed = false;
-                } else {
-                    dim.add(new IntegerLiteral(Integer.toString(i)));
-                }
-            }
-            t.getType().accept(this);
-            if(isFixed) {
-                typeStack.push(new FixedArrayType(typeStack.pop(), dim));
-            } else {
-                typeStack.push(new VariableArrayType(typeStack.pop(), dim));
-            }
-
-        }
-        public void visit(TypeDefParser.ParsedUserType t){
-            typeStack.push(new UserType(t.getName()));
-        }
-
-
-       public Decl makeDecl(TypeDefParser.ParsedTypeDef d) {
-           d.getType().accept(this);
-           Decl result = new TypeDecl(typeStack.pop(), d.getName());
-           return result;
-       }
-
-       private Program createAndCheckProgram(List<Decl> ds) {
-            Program p = new Program(ds);
-            LinkedList errors = new LinkedList();
-            p.errorCheck(errors);
-            if(errors.isEmpty()) {
-                return p;
-            } else {
-                // This should not happen
-                // get errors and throw exception
-                StringBuilder sb = new StringBuilder();
-                for (Iterator iter = errors.iterator(); iter.hasNext(); ) {
-                    String s = (String)iter.next();
-                    sb.append(s);
-                }
-                throw new RuntimeException("Internal error: parsed labcomm declaration has errors: "+sb.toString());
-            }
-       }
-       
-       public Program makeProgram(TypeDefParser.ParsedTypeDef d) {
-           assertStacksEmpty();
-           List<Decl> ds = new List<Decl>();
-
-           ds.add(makeDecl(d));
-           assertStacksEmpty();
-           return createAndCheckProgram(ds);
-       }
-
-       public Decl makeDecl(TypeDefParser.ParsedSampleDef d) {
-           d.getType().accept(this);
-           Decl result = new SampleDecl(typeStack.pop(), d.getName());
-           return result;
-       }
-       public Program makeProgram(TypeDefParser.ParsedSampleDef d) {
-           assertStacksEmpty();
-           List<Decl> ds = new List<Decl>();
-
-           Iterator<TypeDefParser.ParsedTypeDef> it = d.getDepIterator();
-           while(it.hasNext()){
-               ds.add(makeDecl(it.next()));
-           }
-
-           ds.add(makeDecl(d));
-
-           assertStacksEmpty();
-           return createAndCheckProgram(ds);
-       }
-    }
-
diff --git a/lib/java/se/lth/control/labcomm/BuiltinType.java b/lib/java/se/lth/control/labcomm/BuiltinType.java
deleted file mode 100644
index adb8cd02f62a536f6291071155dcd6ee4dad3f2c..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/BuiltinType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package se.lth.control.labcomm;
-
-public interface BuiltinType extends SampleType{
-
-}
diff --git a/lib/java/se/lth/control/labcomm/Constant.java b/lib/java/se/lth/control/labcomm/Constant.java
deleted file mode 100644
index e109b30445c953abbe43347d5ba5a42d26cbb15f..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/Constant.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package se.lth.control.labcomm;
-
-public class Constant {
-
-  public static final String CURRENT_VERSION = "LabComm2014";
-
-  /*
-   * Allowed packet tags
-   */
-  /*
-   * Predeclared aggregate type indices
-   */
-  public static final int VERSION          = 0x01;
-  public static final int SAMPLE_DEF       = 0x02;
-  public static final int SAMPLE_REF       = 0x03;
-  public static final int TYPE_DEF         = 0x04;
-  public static final int TYPE_BINDING     = 0x05;
-  public static final int PRAGMA           = 0x3f;
-  public static final int FIRST_USER_INDEX = 0x40; /* ..0xffffffff */
-
-  /*
-   * Predefined aggregate type indices
-   */
-  public static final int ARRAY            = 0x10;
-  public static final int STRUCT           = 0x11;
-  
-  /*
-   * Predeclared primitive type indices
-   */
-  public static final int BOOLEAN          = 0x20;
-  public static final int BYTE             = 0x21;
-  public static final int SHORT            = 0x22;
-  public static final int INT              = 0x23;
-  public static final int LONG             = 0x24;
-  public static final int FLOAT            = 0x25;
-  public static final int DOUBLE           = 0x26;
-  public static final int STRING           = 0x27;
-  public static final int SAMPLE           = 0x28;
-
-
-  /*
-   * Other predefined symbols
-   */
-
-  public static final int TYPE_BIND_SELF   = 0x00;
-}
diff --git a/lib/java/se/lth/control/labcomm/Decoder.java b/lib/java/se/lth/control/labcomm/Decoder.java
deleted file mode 100644
index ae684467b0ab7ce23471fc4e5142b8d5264b6d75..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/Decoder.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.IOException;
-
-public interface Decoder {
-  
-  public void register(SampleDispatcher dispatcher, 
-		       SampleHandler handler) throws IOException;
-  public void registerSampleRef(SampleDispatcher dispatcher) throws IOException;
-
-  public boolean decodeBoolean() throws IOException;
-  public byte decodeByte() throws IOException;
-  public short decodeShort() throws IOException;
-  public int decodeInt() throws IOException;
-  public long decodeLong() throws IOException;
-  public float decodeFloat() throws IOException;
-  public double decodeDouble() throws IOException;
-  public String decodeString() throws IOException;
-  public int decodePacked32() throws IOException;
-  public Class decodeSampleRef() throws IOException;
-
-}
diff --git a/lib/java/se/lth/control/labcomm/DecoderChannel.java b/lib/java/se/lth/control/labcomm/DecoderChannel.java
deleted file mode 100644
index 05382913ec659d7ed548f585884ecb4a097bcac5..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/DecoderChannel.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.EOFException;
-
-public class DecoderChannel implements Decoder {
-
-  private DataInputStream in;
-  private DecoderRegistry def_registry = new DecoderRegistry();
-  private DecoderRegistry ref_registry = new DecoderRegistry();
-
-  public DecoderChannel(InputStream in) throws IOException {
-    this.in = new DataInputStream(in);
-  }
-
-  private void processSampleDef() throws IOException {
-    int index = decodePacked32();
-    String name = decodeString();
-    int signature_length = decodePacked32();
-    byte[] signature = new byte[signature_length];
-    ReadBytes(signature, signature_length);
-    def_registry.add(index, name, signature);
-  }	   
-
-  private void processSampleRef() throws IOException {
-    int index = decodePacked32();
-    String name = decodeString();
-    int signature_length = decodePacked32();
-    byte[] signature = new byte[signature_length];
-    ReadBytes(signature, signature_length);
-    ref_registry.add(index, name, signature);
-  }	   
-
-  private void processTypeDef(int len) throws IOException {
-       try {
-           processSample(Constant.TYPE_DEF);
-      } catch(Exception ex) {
-       int idx = decodePacked32();
-       String name = decodeString(); 
-       int siglen = decodePacked32();
-       for(int i=0; i<siglen; i++) {
-           byte b = decodeByte();		  
-       }
-      }
-  }
-
-  private void processTypeBinding(int len) throws IOException {
-      try {
-           processSample(Constant.TYPE_BINDING);
-      } catch(Exception ex) {
-          for(int i=0; i<len; i++) {
-              decodeByte();		  
-          }
-      } 
-  }
-
-  private void processPragma(int len) throws IOException {
-       for(int i=0; i<len; i++) {
-           decodeByte();		  
-       }
-  }
-
-  private void processSample(int tag) throws IOException {
-	  DecoderRegistry.Entry e = def_registry.get(tag);
-	  if (e == null) {
-	    throw new IOException("Unhandled tag " + tag);
-	  }
-	  SampleDispatcher d = e.getDispatcher();
-	  if (d == null) {
-	    throw new IOException("No dispatcher for '" + e.getName() + "'");
-	  }
-	  SampleHandler h = e.getHandler();
-	  if (h == null) {
-	    throw new IOException("No handler for '" + e.getName() +"'");
-	  }
-      try {
-        //XXX why does decodeAndHandle throw Exception and not IOException?
-        d.decodeAndHandle(this, h);
-      } catch (IOException ex) {
-          throw ex;
-      } catch (Exception ex) {
-          ex.printStackTrace();
-      }
-  }	  
-
-  public void runOne() throws Exception {
-    boolean done = false;
-    while (!done) {
-      int tag = decodePacked32();
-      int length = decodePacked32();
-      switch (tag) {
-        case Constant.VERSION: {
-          String version = decodeString();
-          if (! version.equals(Constant.CURRENT_VERSION)) {
-            throw new IOException("LabComm version mismatch " +
-			          version + " != " + Constant.CURRENT_VERSION);
-          }
-        } break;
-        case Constant.SAMPLE_DEF: {
-            processSampleDef();
-        } break;
-        case Constant.SAMPLE_REF: {
-            processSampleRef();
-        } break;
-        case Constant.TYPE_DEF: {
-            processTypeDef(length);
-        } break;
-        case Constant.TYPE_BINDING: {
-            processTypeBinding(length);
-        } break;
-        case Constant.PRAGMA: {
-            processPragma(length);
-        } break;
-        default: {
-            processSample(tag);
-            done = true;
-
-        }
-      }
-    }
-  }
-
-  public void run() throws Exception {
-    while (true) {
-      runOne();
-    }
-  }
-
-  public void register(SampleDispatcher dispatcher, 
-                       SampleHandler handler) throws IOException {
-    def_registry.add(dispatcher, handler);
-  }
-
-  public void registerSampleRef(SampleDispatcher dispatcher) throws IOException {
-    ref_registry.add(dispatcher, null);
-  }
-
-  private void ReadBytes(byte[] result, int length) throws IOException {
-      int offset = 0;
-      while (offset < length) {
-	int count = in.read(result, offset, length - offset);
-	if (count <= 0) {
-	  throw new EOFException(
-	    "End of stream reached with " +
-            (length - offset) + " bytes left to read");
-        }
-	offset += count;
-      }
-    }
-
-  public boolean decodeBoolean() throws IOException {
-    return in.readBoolean();
-  }
-
-  public byte decodeByte() throws IOException {
-    return in.readByte();
-  }
-  
-  public short decodeShort() throws IOException {
-    return in.readShort();
-  }
-
-  public int decodeInt() throws IOException {
-    return in.readInt();
-  }
-
-  public long decodeLong() throws IOException {
-    return in.readLong();
-  }
-
-  public float decodeFloat() throws IOException {
-    return in.readFloat();
-  }
-
-  public double decodeDouble() throws IOException {
-    return in.readDouble();
-  }
-
-  public String decodeString() throws IOException {
-    //in.readShort(); // HACK
-    //return in.readUTF();
-    int len = decodePacked32() & 0xffffffff;
-    byte[] chars = new byte[len];
-    for(int i=0; i<len; i++) {
-      chars[i] = in.readByte();
-    }
-    return new String(chars);
-  }
-
-  public int decodePacked32() throws IOException {
-    long res=0;
-    byte i=0;
-    boolean cont=true;
-
-    do {
-      byte c = in.readByte();
-      res = (res << 7) | (c & 0x7f);
-      cont = (c & 0x80) != 0;
-      i++;
-    } while(cont);
-
-    return (int) (res & 0xffffffff);
-  }
-
-  public Class decodeSampleRef() throws IOException {
-    int index = in.readInt();
-    try {
-      DecoderRegistry.Entry e = ref_registry.get(index);
-      return e.getDispatcher().getSampleClass();
-    } catch (NullPointerException e) {
-      return null;
-    }
-
-  }
-    
-  /* Package visible methods for use from TypeDefParser */
-
-  String getSampleName(int idx) {
-    DecoderRegistry.Entry e = def_registry.get(idx); 
-    return e.getName();  
-  }
-
-  byte[] getSampleSignature(int idx) {
-    DecoderRegistry.Entry e = def_registry.get(idx); 
-    return e.getSignature();  
-  }
-}
-
diff --git a/lib/java/se/lth/control/labcomm/DecoderRegistry.java b/lib/java/se/lth/control/labcomm/DecoderRegistry.java
deleted file mode 100644
index 79a78063a20f1eff1cfef28816b624e8ea326290..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/DecoderRegistry.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-public class DecoderRegistry {
-
-  public static class Entry {
-    
-    private SampleDispatcher dispatcher;
-    private SampleHandler handler;
-    private int index;
-    private String name;
-    private byte[] signature;
-
-    public Entry(SampleDispatcher dispatcher,
-		 SampleHandler handler) {
-      this.dispatcher = dispatcher;
-      this.name = dispatcher.getName();
-      this.signature = dispatcher.getSignature();
-      this.handler = handler;
-    }
-
-    public Entry(int index, String name, byte[] signature) {
-      this.index = index;
-      this.name = name;
-      this.signature = signature;
-    }
-
-    public SampleDispatcher getDispatcher() {
-      return dispatcher;
-    }
-
-    public void setDispatcher(SampleDispatcher dispatcher) {
-      this.dispatcher = dispatcher;
-    }
-
-    public SampleHandler getHandler() {
-      return handler;
-    }
-
-    public void setHandler(SampleHandler handler) {
-      this.handler = handler;
-    }
-
-    public String getName() {
-      return name;
-    }
-
-    public int getIndex() {
-      return index;
-    }
-
-    // protected, for TypeDefParser...
-    byte[] getSignature() {
-        return signature;
-    }
-
-    public void setIndex(int index) throws IOException {
-      if (this.index != 0 && this.index != index) {
-	throw new IOException("Index mismatch " + 
-			      this.index + " != " + index);
-      }
-      this.index = index;
-    }
-
-    public boolean matchName(String name) {
-      return this.name.equals(name);
-    }
-
-    public boolean matchSignature(byte[] signature) {
-      boolean result = this.signature.length == signature.length;
-      for (int i = 0 ; result && i < signature.length ; i++) {
-	result = this.signature[i] == signature[i];
-      }
-      return result;
-    }
-
-    public boolean match(String name, byte[] signature) {
-      return matchName(name) && matchSignature(signature);
-    }
-
-    public void check(String name, byte[] signature) throws IOException {
-      if (!matchName(name)) {
-	throw new IOException("Name mismatch '" + 
-			      this.name + "' != '" + name + "'");
-      } 
-      if (!matchSignature(signature)) {
-	throw new IOException("Signature mismatch");
-      } 
-    }
-  }
-
-  private HashMap<Class, Entry> byClass;
-  private HashMap<Integer, Entry> byIndex;
-
-  public DecoderRegistry() {
-    byClass = new HashMap<Class, Entry>();
-    byIndex = new HashMap<Integer, Entry>();
-  }
-
-  public synchronized void add(SampleDispatcher dispatcher,
-			       SampleHandler handler) throws IOException{
- //XXX kludge: special handling of predefined types
-    if(dispatcher.getSampleClass() == TypeDef.class){
-      Entry e = new Entry(dispatcher, handler);
-      e.setIndex(Constant.TYPE_DEF);
-      byClass.put(dispatcher.getSampleClass(), e);
-      byIndex.put(Integer.valueOf(Constant.TYPE_DEF), e);
-      //System.out.println("LCDecoderRegistry.add("+e.getName()+", "+e.getIndex()+")");
-    } else if(dispatcher.getSampleClass() == TypeBinding.class){
-      Entry e = new Entry(dispatcher, handler);
-      e.setIndex(Constant.TYPE_BINDING);
-      byClass.put(dispatcher.getSampleClass(), e);
-      byIndex.put(Integer.valueOf(Constant.TYPE_BINDING), e);
-      //System.out.println("LCDecoderRegistry.add("+e.getName()+", "+e.getIndex()+")");
-    } else {
-    Entry e = byClass.get(dispatcher.getSampleClass());
-    if (e != null) {
-      e.check(dispatcher.getName(), dispatcher.getSignature());
-      e.setHandler(handler);
-    } else {
-      for (Entry e2 : byIndex.values()) {
-	if (e2.match(dispatcher.getName(), dispatcher.getSignature())) {
-	  e2.setDispatcher(dispatcher);
-	  e2.setHandler(handler);
-	  e = e2;
-	  break;
-	}
-      }
-      if (e == null) {
-	e = new Entry(dispatcher, handler);
-	byClass.put(dispatcher.getSampleClass(), e);
-      }
-    }
-   }
-  }
-
-  public synchronized void add(int index, 
-			       String name,
-			       byte[] signature) throws IOException {
-    Entry e = byIndex.get(Integer.valueOf(index));
-    if (e != null) {
-      e.check(name, signature);
-    } else {
-      for (Entry e2 : byClass.values()) {
-	if (e2.match(name, signature)) {
-	  e2.setIndex(index);
-	  e = e2;
-	  break;
-	}
-      }
-      if (e == null) {
-	e = new Entry(index, name, signature);
-      }
-      byIndex.put(Integer.valueOf(index), e);
-    }
-  }
-
-  public synchronized Entry get(int index) {
-    return byIndex.get(Integer.valueOf(index));
-  }
-
-}
diff --git a/lib/java/se/lth/control/labcomm/Encoder.java b/lib/java/se/lth/control/labcomm/Encoder.java
deleted file mode 100644
index 41901151c2efeab95c24d66ab85caa3e088dfc4f..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/Encoder.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.IOException;
-
-public interface Encoder {
-
-  public void register(SampleDispatcher dispatcher) throws IOException;
-  public void registerSampleRef(SampleDispatcher dispatcher) throws IOException;
-  public void begin(Class<? extends SampleType> c) throws IOException;
-  public void end(Class<? extends SampleType> c) throws IOException;
-
-  public void begin(int t) throws IOException;
-  public int getTypeId(Class<? extends SampleType> c) throws IOException;
-
-  public void encodeBoolean(boolean value) throws IOException;
-  public void encodeByte(byte value) throws IOException;
-  public void encodeShort(short value) throws IOException;
-  public void encodeInt(int value) throws IOException;
-  public void encodeLong(long value) throws IOException;
-  public void encodeFloat(float value) throws IOException;
-  public void encodeDouble(double value) throws IOException;
-  public void encodeString(String value) throws IOException;
-  public void encodePacked32(long value) throws IOException;
-  public void encodeSampleRef(Class value) throws IOException;
-
-}
diff --git a/lib/java/se/lth/control/labcomm/EncoderChannel.java b/lib/java/se/lth/control/labcomm/EncoderChannel.java
deleted file mode 100644
index f429f94e7bf311ed57ae89b8cd7406b43ff07b2c..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/EncoderChannel.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class EncoderChannel implements Encoder {
-
-  private Writer writer;
-  private ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-  private DataOutputStream data = new DataOutputStream(bytes);
-  private EncoderRegistry sample_def_registry = new EncoderRegistry();
-  private EncoderRegistry sample_ref_registry = new EncoderRegistry();
-  private EncoderRegistry type_def_registry = new EncoderRegistry();
-  private int current_tag;
-
-  private EncoderChannel(Writer writer, boolean emitVersion) throws IOException {
-    this.writer = writer;
-
-    if(emitVersion){
-      begin(Constant.VERSION);
-      encodeString(Constant.CURRENT_VERSION);
-      end(null);
-    }
-  }
-  public EncoderChannel(Writer writer) throws IOException {
-      this(writer, true);
-  }
-
-  public EncoderChannel(OutputStream writer) throws IOException {
-    this(new WriterWrapper(writer), true);
-  }
-
-  private EncoderChannel(OutputStream writer, boolean emitVersion) throws IOException {
-    this(new WriterWrapper(writer), emitVersion);
-  }
-  private void bindType(int sampleId, int typeId) throws IOException {
-        begin(Constant.TYPE_BINDING);
-        encodePacked32(sampleId);
-        encodePacked32(typeId);
-        end(null);
-  }
-
-  private void registerSample(SampleDispatcher dispatcher) throws IOException {
-        int index = sample_def_registry.add(dispatcher);
-        begin(dispatcher.getTypeDeclTag());
-        encodePacked32(index);
-        encodeString(dispatcher.getName());
-        byte[] signature = dispatcher.getSignature();
-        encodePacked32(signature.length);
-        for (int i = 0 ; i < signature.length ; i++) {
-            encodeByte(signature[i]);
-        }
-        end(null);
-        int tindex;
-        if(dispatcher.hasDependencies()){
-            tindex = registerTypeDef(dispatcher);
-        } else {
-            tindex = Constant.TYPE_BIND_SELF;
-        }
-        bindType(index, tindex);
-
-  }
-
-  private static class WrappedEncoder extends EncoderChannel{
-      private Encoder wrapped;
-
-      public WrappedEncoder(Encoder e, OutputStream s, boolean emitVersion) throws IOException {
-          super(s,emitVersion);
-          this.wrapped = e;
-      }
-      public int getTypeId(Class<? extends SampleType> c) throws IOException{
-         return wrapped.getTypeId(c);
-      }
-  }
-
-
-  private int registerTypeDef(SampleDispatcher dispatcher) throws IOException {
-      // check if already registered
-        try {
-            return type_def_registry.getTag(dispatcher);
-        } catch (IOException e) {
-            //otherwise, add to the registry
-            int index = type_def_registry.add(dispatcher);
-            //wrap encoder to get encoded length of signature
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            EncoderChannel wrapped = new WrappedEncoder(this, baos, false);
-            dispatcher.encodeTypeDef(wrapped, index);
-            wrapped.flush();
-            byte b[] = baos.toByteArray();
-
-            begin(Constant.TYPE_DEF);
-            encodePacked32(index);
-            encodeString(dispatcher.getName());
-            encodePacked32(b.length);
-            for(int i = 0; i<b.length; i++) {
-                encodeByte(b[i]);
-            }
-            end(null);
-
-            return index;
-        }
-  }
-
-  public void register(SampleDispatcher dispatcher) throws IOException {
-    switch (dispatcher.getTypeDeclTag())  {
-        case Constant.SAMPLE_DEF: {
-            registerSample(dispatcher);
-            break;
-        }
-        case Constant.TYPE_DEF: {
-            registerTypeDef(dispatcher);
-            break;
-        }
-        default:
-            throw new Error("Unknown typeDeclTag: "+dispatcher.getTypeDeclTag());
-    }
-  }
-
-  public void registerSampleRef(SampleDispatcher dispatcher) throws IOException {
-    System.err.println(dispatcher);
-    int index = sample_ref_registry.add(dispatcher);
-    begin(Constant.SAMPLE_REF);
-    encodePacked32(index);
-    encodeString(dispatcher.getName());
-    byte[] signature = dispatcher.getSignature();
-    encodePacked32(signature.length);
-    for (int i = 0 ; i < signature.length ; i++) {
-      encodeByte(signature[i]);
-    }
-    end(null);
-  }
-
-  public void begin(int tag) {
-    current_tag = tag;
-    bytes.reset();
-  }
-
-  public void begin(Class<? extends SampleType> c) throws IOException {
-    begin(sample_def_registry.getTag(c));
-  }
-
-  /* aux. method used to allow nesting encoders to find encoded size */
-  private void flush() throws IOException{
-    data.flush();
-    writer.write(bytes.toByteArray());
-    bytes.reset();
-  }
-  public void end(Class<? extends SampleType> c) throws IOException {
-    data.flush();
-    WritePacked32(writer, current_tag);
-    WritePacked32(writer, bytes.size());
-    writer.write(bytes.toByteArray());
-    bytes.reset();
-  }
-
-  /**
-   * @return the id of a TYPE_DEF
-   */
-  public int getTypeId(Class<? extends SampleType> c) throws IOException {
-    return type_def_registry.getTag(c);
-  }
-
-  private void WritePacked32(Writer s, long value) throws IOException {
-    byte[] tmp1 = new byte[5];
-    byte[] tmp2 = new byte[1];
-    long v = value & 0xffffffff;
-    int i;
-
-    for (i = 0 ; i == 0 || v != 0 ; i++, v = (v >> 7)) {
-      tmp1[i] = (byte)(v & 0x7f | (i!=0?0x80:0x00));
-    }
-    for (i = i - 1 ; i >= 0 ; i--) {
-      tmp2[0] = tmp1[i];
-      writer.write(tmp2);
-    }
-  }
-
-  public void encodeBoolean(boolean value) throws IOException{
-    data.writeBoolean(value);
-  }
-
-  public void encodeByte(byte value) throws IOException {
-    data.writeByte(value);
-  }
-
-  public void encodeShort(short value) throws IOException {
-    data.writeShort(value);
-  }
-
-  public void encodeInt(int value) throws IOException {
-    data.writeInt(value);
-  }
-
-  public void encodeLong(long value) throws IOException {
-    data.writeLong(value);
-  }
-
-  public void encodeFloat(float value) throws IOException {
-    data.writeFloat(value);
-  }
-
-  public void encodeDouble(double value) throws IOException {
-    data.writeDouble(value);
-  }
-
-  public void encodeString(String value) throws IOException {
-    ByteArrayOutputStream tmpb = new ByteArrayOutputStream();
-    DataOutputStream tmps = new DataOutputStream(tmpb);
-
-    tmps.writeUTF(value);
-    tmps.flush();
-    byte[] tmp = tmpb.toByteArray();
-
-    //the two first bytes written by writeUTF is the length of
-    //the string, so we skip those
-    encodePacked32(tmp.length-2);
-    for (int i = 2 ; i < tmp.length ; i++) {
-      encodeByte(tmp[i]);
-    }
-  }
-
-  public void encodePacked32(long value) throws IOException {
-    byte[] tmp = new byte[5];
-    long v = value & 0xffffffff;
-    int i;
-
-    for (i = 0 ; i == 0 || v != 0 ; i++, v = (v >> 7)) {
-      tmp[i] = (byte)(v & 0x7f);
-    }
-    for (i = i - 1 ; i >= 0 ; i--) {
-      encodeByte((byte)(tmp[i] | (i!=0?0x80:0x00)));
-    }
-  }
-
-  public void encodeSampleRef(Class value) throws IOException {
-    int index = 0;
-    try {
-      index = sample_ref_registry.getTag(value);
-    } catch (NullPointerException e) {
-        //we want to return 0 for unregistered ref types
-    }
-    data.writeInt(index);
-  }
-
-}
-
diff --git a/lib/java/se/lth/control/labcomm/EncoderRegistry.java b/lib/java/se/lth/control/labcomm/EncoderRegistry.java
deleted file mode 100644
index f990d1813920a0624c557b4a895cae1f64331a69..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/EncoderRegistry.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-public class EncoderRegistry {
-
-  public static class Entry {
-    
-    private SampleDispatcher dispatcher;
-    private int index;
-
-    public Entry(SampleDispatcher dispatcher, int index) {
-      this.dispatcher = dispatcher;
-      this.index = index;
-    }
-
-    public SampleDispatcher getDispatcher() {
-      return dispatcher;
-    }
-
-    public int getIndex() {
-      return index;
-    }
-
-  }
-
-  private int userIndex = Constant.FIRST_USER_INDEX;
-  private HashMap<Class, Entry> byClass;
-
-  public EncoderRegistry() {
-    byClass = new HashMap<Class, Entry>();
-  }
-
-  public synchronized int add(SampleDispatcher dispatcher) {
-    Entry e = byClass.get(dispatcher.getSampleClass());
-    if (e == null) {
-      e = new Entry(dispatcher, userIndex);
-      byClass.put(dispatcher.getSampleClass(), e);
-      userIndex++;
-    }
-    return e.getIndex();
-  }
-  
-  public int getTag(SampleDispatcher d) throws IOException {
-      return getTag(d.getSampleClass());
-  }
-
-  public int getTag(Class<? extends SampleType> sample) throws IOException {
-    Entry e = byClass.get(sample);
-    if (e == null) {
-      throw new IOException("'" + 
-			    sample.getSimpleName() + 
-			    "' is not registered");
-    }
-    return e.index;
-  }
-
-  public boolean contains(Class<? extends SampleType> sample) {
-    return byClass.containsKey(sample);
-  }
-
-}
diff --git a/lib/java/se/lth/control/labcomm/Reader.java b/lib/java/se/lth/control/labcomm/Reader.java
deleted file mode 100644
index 1dd0dacd16ecab62bfb7e1de7ed30d082741c9ec..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/Reader.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package se.lth.control.labcomm;
-
-public interface Reader {
-
-  public void handle(byte[] data, int begin, int end);
-
-}
diff --git a/lib/java/se/lth/control/labcomm/Sample.java b/lib/java/se/lth/control/labcomm/Sample.java
deleted file mode 100644
index 2dd432b878f509538aca71f0b7840ff8fe2513b2..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/Sample.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package se.lth.control.labcomm;
-
-public interface Sample extends SampleType {
-
-  public SampleDispatcher getDispatcher();
-
-}
diff --git a/lib/java/se/lth/control/labcomm/SampleDispatcher.java b/lib/java/se/lth/control/labcomm/SampleDispatcher.java
deleted file mode 100644
index b2ed2fd98658f15461c6a8a60e8f4bb9df39418b..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/SampleDispatcher.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.IOException;
-
-public interface SampleDispatcher <T extends SampleType>{
-    
-  public Class<T> getSampleClass();
-    
-  public String getName();
-
-  public byte[] getSignature();
-
-  public void decodeAndHandle(Decoder decoder,
-			      SampleHandler handler) throws Exception;
-
-  /** @return true if the type depends on one or more typedefs
-   */
-  public boolean hasDependencies();
-
-  public void encodeTypeDef(Encoder e, int index) throws IOException;
-
-  /** return the tag SAMPLE_DEF or TYPE_DEF, for use
-   *  by encoder.register.
-   *  TODO: refactor types, moving this to a super-interface
-   *  applicable to both type and sample defs.
-   */ 
-  public byte getTypeDeclTag();
-}
-
diff --git a/lib/java/se/lth/control/labcomm/SampleHandler.java b/lib/java/se/lth/control/labcomm/SampleHandler.java
deleted file mode 100644
index d03da88d64f8a23e795149bda5b7ed1080dd88e4..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/SampleHandler.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package se.lth.control.labcomm;
-
-public interface SampleHandler {
-}
diff --git a/lib/java/se/lth/control/labcomm/SampleType.java b/lib/java/se/lth/control/labcomm/SampleType.java
deleted file mode 100644
index f51ce99de5bbf360b8cd319387fd4dcb16b9904a..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/SampleType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package se.lth.control.labcomm;
-
-public interface SampleType {
-
-}
diff --git a/lib/java/se/lth/control/labcomm/TypeBinding.java b/lib/java/se/lth/control/labcomm/TypeBinding.java
deleted file mode 100644
index 1c0cd41345f1aa20470e0327570eb17413d6e811..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/TypeBinding.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import se.lth.control.labcomm.Decoder;
-import se.lth.control.labcomm.DecoderChannel;
-import se.lth.control.labcomm.SampleDispatcher;
-import se.lth.control.labcomm.SampleHandler;
-
-public class TypeBinding implements BuiltinType {
-    private int sampleIndex;
-    private int typeIndex;
-
-  public TypeBinding(int sampleIndex, int typeIndex) {
-      this.sampleIndex = sampleIndex;
-      this.typeIndex = typeIndex;
-  }
-
-  public int getSampleIndex() {
-    return sampleIndex;
-  }
-
-  public int getTypeIndex() {
-    return typeIndex;
-  }
-
-  public boolean isSelfBinding() {
-      return typeIndex == Constant.TYPE_BIND_SELF;
-  }
-
-  public interface Handler extends SampleHandler {
-    public void handle_TypeBinding(TypeBinding value) throws Exception;
-  }
-
-  public static void register(Decoder d, Handler h) throws IOException {
-    d.register(Dispatcher.singleton(), h);
-  }
-
-  public static void register(Encoder e) throws IOException {
-    register(e,false);
-  }
-
-  public static void register(Encoder e, boolean sendMetaData) throws IOException {
-    throw new IOException("cannot send TypeDefs");
-  }
-
- static class Dispatcher implements SampleDispatcher<TypeBinding> {
-
-    private static Dispatcher singleton;
-
-    public synchronized static Dispatcher singleton() {
-      if(singleton==null) singleton=new Dispatcher();
-      return singleton;
-    }
-
-    public Class<TypeBinding> getSampleClass() {
-      return TypeBinding.class;
-    }
-
-    public String getName() {
-      return "TypeBinding";
-    }
-
-    public byte getTypeDeclTag() {
-      throw new Error("Should not be called");
-    }
-
-    public boolean isSample() {
-      throw new Error("Should not be called");
-    }
-    public boolean hasStaticSignature() {
-      throw new Error("Should not be called");
-    }
-
-    public byte[] getSignature() {
-      return null; // not used for matching
-    }
-
-    public void encodeTypeDef(Encoder e, int index) throws IOException{
-      throw new Error("Should not be called");
-    }
-
-    public void decodeAndHandle(Decoder d,
-                                SampleHandler h) throws Exception {
-      ((Handler)h).handle_TypeBinding(TypeBinding.decode(d));
-    }
-
-    public boolean hasDependencies() {
-        return false;
-    }
-  }
-
-  public static void encode(Encoder e, TypeBinding value) throws IOException {
-    throw new Error("Should not be called");
-  }
-
-  /* HERE BE DRAGONS!
-   * This exposes (and relies on the stability of) indices that are
-   * internal to a decoder.
-   *
-   * The SAMPLE_DEF and TYPE_DEF must already have been received for the
-   * indices to be known, so this can be changed to instead return
-   * references to the SampleDispactcher corresponding to the sample type
-   * and the matching TypeDef.
-   *
-   * Sketch:
-   *
-   * SampleDispatcher sd = d.getDispatcherForId(sampleIndex);
-   * TypeDef td = d.getTypeDefForId(typeIndex);
-   *
-   * return new TypeBinding(sd, td);
-   *
-   * assuming that the Decoder keeps a registry for TypeDefs
-   */
-  public static TypeBinding decode(Decoder d) throws IOException {
-    TypeBinding result;
-    int sampleIndex = d.decodePacked32();
-    int typeIndex = d.decodePacked32();
-
-    result = new TypeBinding(sampleIndex, typeIndex);
-    return result;
-  }
-}
-
diff --git a/lib/java/se/lth/control/labcomm/TypeDef.java b/lib/java/se/lth/control/labcomm/TypeDef.java
deleted file mode 100644
index 067c400e9b0a668ddff6786e231aa4ff3a9f9067..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/TypeDef.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import se.lth.control.labcomm.Decoder;
-import se.lth.control.labcomm.DecoderChannel;
-import se.lth.control.labcomm.SampleDispatcher;
-import se.lth.control.labcomm.SampleHandler;
-
-public class TypeDef implements BuiltinType {
-    private int index;
-    private String name;
-    private byte signature[];
-
-  public int getIndex() {
-    return index;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public String toString() {
-     return getName();
-  }
- 
-  public byte[] getSignature() {
-    return signature;
-  }
-
-  public void dump() {
-      System.out.print("=== TypeDef "+getName()+"( "+Integer.toHexString(getIndex())+") : ");
-      for (byte b : signature) {
-        System.out.print(String.format("0x%02X ", b));
-      }
-      System.out.println();
-  }
-  public interface Handler extends SampleHandler {
-    public void handle_TypeDef(TypeDef value) throws Exception;
-  }
-  
-  public static void register(Decoder d, Handler h) throws IOException {
-    d.register(Dispatcher.singleton(), h);
-  }
-  
-  public static void register(Encoder e) throws IOException {
-    register(e,false);
-  }
-  
-  public static void register(Encoder e, boolean sendMetaData) throws IOException {
-    throw new IOException("cannot send TypeDefs");
-  }
-  
- static class Dispatcher implements SampleDispatcher<TypeDef> {
-    
-    private static Dispatcher singleton;
-    
-    public synchronized static Dispatcher singleton() {
-      if(singleton==null) singleton=new Dispatcher();
-      return singleton;
-    }
-    
-    public Class<TypeDef> getSampleClass() {
-      return TypeDef.class;
-    }
-    
-    public String getName() {
-      return "TypeDef";
-    }
-
-    public byte getTypeDeclTag() {
-      throw new Error("Should not be called");
-    }
-    
-    public boolean isSample() {
-      throw new Error("Should not be called");
-    }
-    public boolean hasStaticSignature() {
-      throw new Error("Should not be called");
-    }
-    
-    /** return the flat signature. Intended use is on decoder side */
-    public byte[] getSignature() {
-      return null; // not used for matching
-    }
-    
-    public void encodeTypeDef(Encoder e, int index) throws IOException{
-      throw new Error("Should not be called");
-    }
-    
-//    public boolean canDecodeAndHandle() {
-//      return true;
-//    }
-    
-    public void decodeAndHandle(Decoder d,
-                                SampleHandler h) throws Exception {
-      ((Handler)h).handle_TypeDef(TypeDef.decode(d));
-    }
-    
-    public boolean hasDependencies() {
-        return false;
-    }
-  }
-  
-  public static void encode(Encoder e, TypeDef value) throws IOException {
-    throw new Error("Should not be called");
-  }
-  
-  protected TypeDef() {
-  }
-
-  public TypeDef(int index, String name, byte sig[]) {
-      this.index = index;
-      this.name = name;
-      this.signature = sig;
-  }
-
-  public static TypeDef decode(Decoder d) throws IOException {
-    TypeDef result;
-    int index = d.decodePacked32();
-    String name = d.decodeString();
-    int siglen= d.decodePacked32();
-    byte sig[] = new byte[siglen];
-    for(int i=0; i<siglen;i++){
-        sig[i] = d.decodeByte();
-    }
-    result = new TypeDef(index, name, sig);
-    return result;
-  }
-}
-
diff --git a/lib/java/se/lth/control/labcomm/TypeDefParser.java b/lib/java/se/lth/control/labcomm/TypeDefParser.java
deleted file mode 100644
index a72e96510e6ee1544f42aa39c548b637172c1cbd..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/TypeDefParser.java
+++ /dev/null
@@ -1,663 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.EOFException;
-
-import se.lth.control.labcomm.Decoder;
-import se.lth.control.labcomm.DecoderChannel;
-import se.lth.control.labcomm.TypeDef;
-import se.lth.control.labcomm.TypeBinding;
-
-public class TypeDefParser implements TypeDef.Handler, TypeBinding.Handler {
-
-    static class SelfBinding extends TypeDef {
-
-        private int sampleIndex;
-        private Decoder decoder;
-        private byte[] dummy = new byte[0];
-        public String toString() {return "self";} 
-        public String getName() {
-            if(decoder instanceof DecoderChannel) {
-                DecoderChannel dc = (DecoderChannel) decoder;
-                return dc.getSampleName(sampleIndex);
-            } else {
-                return "self";
-            }
-        } 
-        public int getIndex() {return 0;}
-        public byte[] getSignature() {
-            if(decoder instanceof DecoderChannel) {
-                DecoderChannel dc = (DecoderChannel) decoder;
-                return dc.getSampleSignature(sampleIndex);
-            } else {
-                return dummy;
-            }
-        }
-
-        public SelfBinding(int sampleIndex, Decoder decoder) {
-            super();
-            this.sampleIndex = sampleIndex;
-            this.decoder = decoder;
-        }
-    }
-
-    public interface TypeDefListener {
-        void onTypeDef(ParsedTypeDef d);
-    }
-
-    private HashMap<Integer,TypeDef> typeDefs;
-    private HashMap<Integer,Integer> typeBindings;
-    private HashSet<TypeDefListener> listeners;
-    private LinkedList<ParsedSampleDef> sampleDefs;
-    private Decoder decoder;
-
-    protected TypeDefParser(Decoder d) {
-        this.decoder = d;
-        typeDefs = new HashMap<Integer,TypeDef>();
-        typeBindings = new HashMap<Integer,Integer>();
-        listeners = new HashSet<TypeDefListener>();
-        sampleDefs = new LinkedList<ParsedSampleDef>();
-    }
-
-    public void addListener(TypeDefListener l) {
-        listeners.add(l);
-    }
-
-
-    public Iterator<ParsedSampleDef> sampleDefIterator() {
-        return sampleDefs.iterator();
-    }
-
-    public void handle_TypeDef(TypeDef d) throws java.io.IOException {
-        typeDefs.put(d.getIndex(), d);
-    }
-
-    public void handle_TypeBinding(TypeBinding d) throws java.io.IOException {
-        TypeDef td;
-        if(d.isSelfBinding()){
-             td = new SelfBinding(d.getSampleIndex(), decoder);
-        } else {
-            typeBindings.put(d.getSampleIndex(), d.getTypeIndex());
-            td = getTypeDefForIndex(d.getSampleIndex());
-        }
-        ParsedSampleDef result = parseSignature(td);
-
-        sampleDefs.add(result);
-
-        Iterator<TypeDefListener> it = listeners.iterator();
-        while(it.hasNext()){
-            notifyListener(it.next(), result);
-        }
-    }
-
-    private void notifyListener(TypeDefListener l, ParsedTypeDef d) {
-        l.onTypeDef(d);
-        if(d instanceof ParsedSampleDef) {
-            for(ParsedTypeDef dep : ((ParsedSampleDef)d).getDependencies()) {
-                //do we want to change ParseTypeDef to have dependencies,
-                //and do recursion here?
-                //if so, do notifyListener(l, dep);
-                l.onTypeDef(dep);
-            }
-        }
-    }
-
-    private TypeDef getTypeDefForIndex(int sampleIndex) {
-        return typeDefs.get(typeBindings.get(sampleIndex));
-    }
-
-
-    /** Factory method for use by application programs:
-     *  registers a TypeDefParser for handling TypeDef and TypeBinding
-     *  on the Decoder d.
-     *
-     *  @return a new TypeDefParser registered on d
-     */
-    public static TypeDefParser registerTypeDefParser(Decoder d) throws java.io.IOException  {
-
-        TypeDefParser res = new TypeDefParser(d);
-
-        TypeDef.register(d,res);
-        TypeBinding.register(d,res);
-
-        return res;
-    }
-
-    public LinkedList<ParsedSymbol> symbolify() {
-
-        LinkedList<ParsedSymbol> result = new LinkedList<ParsedSymbol>();
-
-        Iterator<ParsedSampleDef> sdi = sampleDefIterator();
-
-        while(sdi.hasNext()) {
-            ParsedSampleDef sd = sdi.next();
-            result.add(new SampleSymbol());
-            result.add(sd.getType());
-            result.add(new NameSymbol(sd.getName()));
-
-            Iterator<ParsedTypeDef> di = sd.getDepIterator();        
-            while(di.hasNext()) {
-                ParsedTypeDef d = di.next();
-                result.add(new TypeSymbol());
-                result.add(d.getType());
-                result.add(new NameSymbol(d.getName()));
-            }
-        }
-        return result;
-    }
-
-    public String symbolString() {
-        Iterator<ParsedSymbol> i = symbolify().iterator();
-
-        StringBuilder sb = new StringBuilder();
-
-        while(i.hasNext()) {
-            sb.append(i.next().toString());
-        }
-        return sb.toString();
-    }
-
-    /* An interface for using Visitor pattern to traverse 
-     * ParsedTypeDefs
-     */
-    public interface ParsedSymbolVisitor {
-        void visit(TypeSymbol s);
-        void visit(SampleSymbol s);
-        void visit(NameSymbol s);
-        void visit(PrimitiveType t);
-        //sampleRefs are sent as primitive types
-        //Put this back if that is changed to SampleRefType
-        //void visit(SampleRefType t);
-        void visit(ParsedStructType t);
-        void visit(ParsedField t);
-        void visit(ArrayType t);
-        void visit(ParsedUserType t);
-    }
-    public abstract class ParsedSymbol{
-        public abstract void accept(ParsedSymbolVisitor v);
-    }
-
-    public class TypeSymbol extends ParsedSymbol {
-        public String toString() {
-            return "typedef ";
-        }
-        public void accept(ParsedSymbolVisitor v){
-            v.visit(this);
-        }
-    }
-
-    public class SampleSymbol extends ParsedSymbol {
-        public String toString() {
-            return "sample ";
-        }
-        public void accept(ParsedSymbolVisitor v){
-            v.visit(this);
-        }
-    }
-
-    public class NameSymbol extends ParsedSymbol {
-        private String name;
-
-        public NameSymbol(String name) {
-            this.name = name;
-        }
-
-        public String toString() { 
-            return name;
-        }
-        public void accept(ParsedSymbolVisitor v){
-            v.visit(this);
-        }
-    }
-
-    public abstract class ParsedType extends ParsedSymbol{
-    }
-
-// SampleRefType currently not sent, se above
-//    public class SampleRefType extends ParsedType {
-//        public void accept(ParsedSymbolVisitor v) {
-//            v.visit(this);
-//        }
-//
-//        public String toString() { 
-//            return "sample";}
-//    }
-
-    public class PrimitiveType extends ParsedType {
-        private final String name;
-        private int tag;
-
-        String getName() {
-            return name;
-        }
-
-        int getTag() {
-            return tag;
-        }
-        PrimitiveType(int tag) {
-            this.tag = tag;
-            switch(tag) {
-                case Constant.BOOLEAN:
-                    this.name = "boolean";
-                    break;
-                case Constant.BYTE:
-                    this.name = "byte";
-                    break;
-                case Constant.SHORT:
-                    this.name = "short";
-                    break;
-                case Constant.INT:
-                    this.name = "int";
-                    break;
-                case Constant.LONG:
-                    this.name = "long";
-                    break;
-                case Constant.FLOAT:
-                    this.name = "float";
-                    break;
-                case Constant.DOUBLE:
-                    this.name = "double";
-                    break;
-                case Constant.STRING:
-                    this.name = "string";
-                    break;
-                case Constant.SAMPLE:
-                    this.name = "sample";
-                    break;
-                default:
-                    this.name = "??? unknown tag 0x"+Integer.toHexString(tag);    
-            }
-        }
-
-        public void accept(ParsedSymbolVisitor v) {
-            v.visit(this);
-        }
-
-        public String toString() { 
-            return name;}
-    }
-
-    public class ParsedStructType extends ParsedType {
-        private ParsedField fields[];
-
-        ParsedStructType(int nParsedFields) {
-            this.fields = new ParsedField[nParsedFields];
-        }
-
-        public ParsedField[] getFields() {
-            return fields;
-        }
-
-        void setParsedField(int idx, ParsedField f) {
-            fields[idx] = f;
-        }
-
-        public boolean isVoid() {
-            return fields.length == 0;
-        }
-
-        public String toString() {
-            if(isVoid()) { //void type is empty struct
-                return "void";
-            } else {
-                StringBuilder sb = new StringBuilder();
-                sb.append("struct {\n");
-                for(ParsedField f : fields) {
-                    sb.append(f.toString());
-                    sb.append(";\n");        
-                }
-                sb.append("}");
-                return sb.toString();
-            }
-        }
-
-        public void accept(ParsedSymbolVisitor v) {
-            v.visit(this);
-        }
-    }
-
-    public class ParsedField extends ParsedSymbol{
-        private ParsedType type;
-        private String name;
-
-        ParsedField(String name, ParsedType type) {
-            this.name = name;
-            this.type = type;
-        }
-
-        public ParsedType getType() {
-            return type;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public String toString() {
-            return type.toString() + " " + name;
-        }
-
-        public void accept(ParsedSymbolVisitor v) {
-            v.visit(this);
-        }
-    }
-
-    public class ArrayType extends ParsedType {
-        private int idx[];
-        private ParsedType type;
-
-        ArrayType(int idx[], ParsedType elementType) {
-            this.idx = idx;
-            this.type = elementType;
-        }
-
-        public ParsedType getType() {
-            return type;
-        }
-
-        public int[] getIdx() {
-            return idx;
-        }
-
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(type.toString());
-            for(int i : idx) {
-                sb.append("["+(i>0 ? i : "_")+"]");
-            }
-            return sb.toString();
-        }
-
-        public void accept(ParsedSymbolVisitor v) {
-            v.visit(this);
-        }
-    }
-
-    public class ParsedUserType extends ParsedType {
-        private String name;
-        public String getName() {
-            return name;
-        }
-
-        public String toString() {
-            return name;
-        }
-
-        ParsedUserType(String name) {
-            this.name = name;
-        }
-
-        public void accept(ParsedSymbolVisitor v) {
-            v.visit(this);
-        }
-    }
-
-    public class ParsedTypeDef{
-       private int idx;
-       private String name;
-       private ParsedType type;
-
-       ParsedTypeDef(int idx, String name){
-            this.idx = idx;
-            this.name = name;
-       }
-
-       ParsedTypeDef(int idx, String name, ParsedType type) {
-           this(idx, name);
-           this.type = type;
-       }
-
-       /** To be overridden in ParsedSampleDef
-        */
-       public boolean isSampleDef() {
-           return false;
-       }
-
-       void setType(ParsedType type) {
-           this.type = type;
-       }
-
-       ParsedType getType() {
-           return type;
-       }
-
-       int getIndex() {
-           return idx;
-       }
-
-       public String getName() {
-            return name;
-       }
-
-       public String toString() {
-          return type.toString();
-       }
-
-       public int hashCode() {
-           return name.hashCode();
-       }
-
-       public boolean equals(Object o) {
-            if(! (o instanceof ParsedTypeDef)){
-                return false;
-            } else {
-                ParsedTypeDef other = (ParsedTypeDef) o;
-                return other.idx == idx && other.name.equals(name);
-            }
-       }
-
-       public void accept(ParsedSymbolVisitor v) {
-            type.accept(v);
-       }
-    }
-   
-    public class ParsedSampleDef extends ParsedTypeDef{
-
-        private HashSet<ParsedTypeDef> deps;
-        ParsedSampleDef(ParsedTypeDef td) {
-            super(td.getIndex(), td.getName(), td.getType());
-            this.deps = new HashSet<ParsedTypeDef>();
-        }
-
-        void addDependency(ParsedTypeDef d) {
-            deps.add(d);
-        }
-
-        @Override
-        public boolean isSampleDef() {
-            return true;
-        }
-        private HashSet<ParsedTypeDef> getDependencies() {
-            return deps;
-        }
-
-        Iterator<ParsedTypeDef> getDepIterator() {
-            return deps.iterator();
-        }        
-    }
-
-    private class ParserState {
-        private ByteArrayInputStream bis;
-        private DataInputStream in;
-        private TypeDef current;
-        private ParsedTypeDef currentParsed;
-
-        private LinkedList<TypeDef> typeStack;
-
-        ParsedTypeDef newTypeDef() {
-            currentParsed =new ParsedTypeDef(getCurrentIndex(), getCurrentName());
-            return currentParsed;
-        }
-
-        private ParserState() {
-            typeStack = new LinkedList<TypeDef>();
-        }
-
-        ParserState(int typeIdx) {
-            this();
-            pushType(typeIdx);
-        }
-         
-        ParserState(TypeDef td) {
-            this();
-            pushType(td);
-        }
-         
-        ParserState(byte sig[]) {
-            this();
-            bis= new ByteArrayInputStream(sig);
-            in = new DataInputStream(bis);
-        }
-
-        void pushType(TypeDef td) {
-            if(!typeStack.contains(td)) {
-                typeStack.push(td);
-            }
-        }
-        void pushType(int typeIdx) {
-            if(typeIdx >= 0x40 && !typeStack.contains(typeIdx)) {
-                typeStack.push(typeDefs.get(typeIdx));
-            } 
-        }
-
-        void popType() {
-            TypeDef td2 = typeStack.pop();
-            current = td2;
-            bis =new ByteArrayInputStream(td2.getSignature());
-            in = new DataInputStream(bis);
-        }
-
-        boolean moreTypes() {
-            return !typeStack.isEmpty();
-        }
-
-        int getCurrentIndex() {
-            return current.getIndex();
-        }
-
-        String getCurrentName() {
-            return current.getName();
-        }
-
-        String decodeString() throws IOException {
-            int len = decodePacked32() & 0xffffffff;
-            byte[] chars = new byte[len];
-            for(int i=0; i<len; i++) {
-                chars[i] = in.readByte();
-            }
-            return new String(chars);
-        }
-
-        int decodePacked32() throws IOException {
-            long res=0;
-            byte i=0;
-            boolean cont=true;
-
-            do {
-            byte c = in.readByte();
-            res = (res << 7) | (c & 0x7f);
-            cont = (c & 0x80) != 0;
-            i++;
-            } while(cont);
-
-            return (int) (res & 0xffffffff);
-        }
-    }
-
-    public ParsedSampleDef parseSignature(TypeDef td) throws IOException{
-        ParserState s = new ParserState(td);
-
-        ParsedSampleDef result=null;
-        try {
-            s.popType();
-            result = parseSampleTypeDef(s);
-            while(s.moreTypes()) {
-                s.popType();
-                result.addDependency(parseTypeDef(s));
-            }
-        } catch(java.io.EOFException ex) {
-            System.out.println("EOF: self_binding");
-        }
-        return result;
-    }    
-
-    private ArrayType  parseArray(ParserState in) throws IOException {
-        int numIdx = in.decodePacked32();
-        int idx[] = new int[numIdx];
-        for(int i=0; i<numIdx; i++){
-            idx[i] = in.decodePacked32(); 
-        }
-        int type = in.decodePacked32();
-        ParsedType elementType = lookupType(type, in); 
-        ArrayType result = new ArrayType(idx, elementType);
-        for(int i=0; i<numIdx; i++){
-            idx[i] = in.decodePacked32(); 
-        }
-        return result;
-    }
-
-    private ParsedStructType parseStruct(ParserState in) throws IOException {
-        int numParsedFields = in.decodePacked32();
-        ParsedStructType result = new ParsedStructType(numParsedFields);
-        for(int i=0; i<numParsedFields; i++) {
-            result.setParsedField(i, parseParsedField(in));
-        }
-        return result;
-    }
-
-    private ParsedField parseParsedField(ParserState in) throws IOException {
-        String name = in.decodeString();
-        return new ParsedField(name, parseType(in));
-    }
-
-    private ParsedType lookupType(int tag, ParserState in) {
-        ParsedType result;
-        if(tag >= Constant.FIRST_USER_INDEX) {
-                TypeDef td = typeDefs.get(tag);
-                result = new ParsedUserType(td.getName());
-                in.pushType(tag);
-// sampleRefs are sent as primitive types, see above
-//        } else if(tag == Constant.SAMPLE) {
-//                result = new SampleRefType();       
-        } else {
-                result = new PrimitiveType(tag);
-        }
-        return result;
-    }
-
-    private ParsedSampleDef parseSampleTypeDef(ParserState in) throws IOException {
-        ParsedTypeDef td = parseTypeDef(in);
-        return new ParsedSampleDef(td);
-    }
-    private ParsedTypeDef parseTypeDef(ParserState in) throws IOException {
-        ParsedTypeDef result = in.newTypeDef();
-        result.setType(parseType(in));
-        return result;
-    }
-    private ParsedType parseType(ParserState in) throws IOException {
-        int tag = in.decodePacked32();
-        ParsedType result = null;
-        switch(tag) {
-            case 0:
-                System.out.println("SELF");
-                break;
-            case Constant.ARRAY:
-                result = parseArray(in);
-                break;
-            case Constant.STRUCT:
-                result = parseStruct(in);
-                break;
-            default:
-                result = lookupType(tag, in);
-                break;
-        }    
-        return result;
-    }
-}
diff --git a/lib/java/se/lth/control/labcomm/Writer.java b/lib/java/se/lth/control/labcomm/Writer.java
deleted file mode 100644
index 2e015b0f4d94c0c916c76043178a2dda90403d86..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/Writer.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.IOException;
-
-public interface Writer {
-
-  public void write(byte[] data) throws IOException;
-
-}
diff --git a/lib/java/se/lth/control/labcomm/WriterWrapper.java b/lib/java/se/lth/control/labcomm/WriterWrapper.java
deleted file mode 100644
index 7c33137e31b309521a7526685dcdc3de6ef04b91..0000000000000000000000000000000000000000
--- a/lib/java/se/lth/control/labcomm/WriterWrapper.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package se.lth.control.labcomm;
-
-import java.io.OutputStream;
-import java.io.IOException;
-
-class WriterWrapper implements Writer{
-
-  private OutputStream os;
-
-  public WriterWrapper(OutputStream os) {
-    this.os = os;
-  }
-
-  public void write(byte[] data) throws IOException {
-    os.write(data);
-  }
-}
diff --git a/lib/python/labcomm/LabComm.py b/lib/python/labcomm/LabComm.py
index 208b92f172dcba3d6503ae43878ad9c2e056747c..6d096f2738099d5529176f3a4a25e4b063d83b1f 100644
--- a/lib/python/labcomm/LabComm.py
+++ b/lib/python/labcomm/LabComm.py
@@ -1,95 +1,5 @@
 #!/usr/bin/python
 #
-# LabComm2014 packet has the following layout
-#
-#   +----+----+----+----+
-#   | id                    (packed32)
-#   +----+----+----+----+
-#   | length                (packed32)
-#   +----+----+----+----+
-#   | data
-#   | ...
-#   +----+--
-#
-# LabComm2014 SAMPLE_DEF:
-#
-#   +----+----+----+----+
-#   | id = 0x02             (packed32)
-#   +----+----+----+----+
-#   | length                (packed32)
-#   +----+----+----+----+
-#   | type number           (packed32)
-#   +----+----+----+----+
-#   | type name (UTF8)
-#   | ...
-#   +----+----+----+----+
-#   | signature length      (packed32)
-#   +----+----+----+----+
-#   | type signature
-#   | ...
-#   +----+--
-#
-# LabComm2014 SAMPLE_REF:
-#
-#   +----+----+----+----+
-#   | id = 0x03             (packed32)
-#   +----+----+----+----+
-#   | length                (packed32)
-#   +----+----+----+----+
-#   | type number           (packed32)
-#   +----+----+----+----+
-#   | type name (UTF8)
-#   | ...
-#   +----+----+----+----+
-#   | signature length      (packed32)
-#   +----+----+----+----+
-#   | type signature
-#   | ...
-#   +----+--
-#
-# LabComm2014 TYPE_DEF: (as SAMPLE_DEF, but signatures are hierarchical,
-#                         i.e., may contain references to other types
-#
-#   +----+----+----+----+
-#   | id = 0x04             (packed32)
-#   +----+----+----+----+
-#   | length                (packed32)
-#   +----+----+----+----+
-#   | type number           (packed32)
-#   +----+----+----+----+
-#   | type name (UTF8)
-#   | ...
-#   +----+----+----+----+
-#   | signature length      (packed32)
-#   +----+----+----+----+
-#   | type signature
-#   | ...
-#   +----+--
-#
-# LabComm2014 TYPE_BINDING
-#
-#   +----+----+----+----+
-#   | id = 0x05             (packed32)
-#   +----+----+----+----+
-#   | length                (packed32)
-#   +----+----+----+----+
-#   | sample number         (packed32)
-#   +----+----+----+----+
-#   | type number           (packed32)
-#   +----+----+----+----+
-#
-# LabComm2014 User data:
-#
-#   +----+----+----+----+
-#   | id >= 0x00000040      (packed32)
-#   +----+----+----+----+
-#   | length                (packed32)
-#   +----+----+----+----+
-#   | user data
-#   | ...
-#   +----+--
-#   
-#
 # LabComm2006 packets has the following layout
 #
 #   +----+----+----+----+
@@ -169,15 +79,8 @@
 import types
 import struct as packer
 
-DEFAULT_VERSION = "LabComm2014"
-
 # Allowed packet tags
-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
 
 # Predefined types
@@ -192,12 +95,14 @@ i_LONG    = 0x24
 i_FLOAT   = 0x25
 i_DOUBLE  = 0x26
 i_STRING  = 0x27
-i_SAMPLE  = 0x28
 
 
 # Version testing
 def usePacketLength(version):
-    return version in [ None, "LabComm2014" ]
+    if version != "LabComm2006":
+        import sys
+        print>>sys.stderr, "No version please %s" % version
+    return False
 
 class length_encoder:
     def __init__(self, encoder):
@@ -369,38 +274,19 @@ class STRING(primitive):
     def __repr__(self):
         return "labcomm.STRING()"
 
-class SAMPLE(primitive):
-
-    def encode_decl(self, encoder):
-        return encoder.encode_type(i_SAMPLE)
-
-    def encode(self, encoder, value):
-        return encoder.encode_int(encoder.ref_to_index.get(value, 0))
-    
-    def decode(self, decoder, obj=None):
-        return decoder.decode_ref()
-
-    def new_instance(self):
-        return ""
-
-    def __repr__(self):
-        return "labcomm.SAMPLE()"
-
 #
 # Aggregate types
 #
-class sampledef_or_sampleref_or_typedef(type_decl):
+class sampledef(type_decl):
     def __init__(self, name=None, decl=None):
         self.name = name
         self.decl = decl
 
     def encode_decl(self, encoder):
         encoder.encode_type(self.type_index)
-        with length_encoder(encoder) as e1:
-            e1.encode_type(self.get_index(encoder))
-            e1.encode_string(self.name)
-            with length_encoder(e1) as e2:
-                self.decl.encode_decl(e2)
+        encoder.encode_type(self.get_index(encoder))
+        encoder.encode_string(self.name)
+        self.decl.encode_decl(encoder)
 
     def encode(self, encoder, value):
         self.decl.encode(encoder, value)
@@ -408,8 +294,6 @@ class sampledef_or_sampleref_or_typedef(type_decl):
     def decode_decl(self, decoder):
         index = decoder.decode_type_number()
         name = decoder.decode_string()
-        if usePacketLength(decoder.version):
-            length = decoder.decode_packed32()
         decl = decoder.decode_decl()
         result = self.__class__.__new__(self.__class__)
         result.__init__(name=name, decl=decl)
@@ -438,7 +322,7 @@ class sampledef_or_sampleref_or_typedef(type_decl):
     def __repr__(self):
         return "%s('%s', %s)" % (self.type_name, self.name, self.decl)
 
-class sample_def(sampledef_or_sampleref_or_typedef):
+class sample_def(sampledef):
     type_index = i_SAMPLE_DEF
     type_name = 'sample'
 
@@ -448,34 +332,6 @@ class sample_def(sampledef_or_sampleref_or_typedef):
     def add_index(self, decoder, index, decl):
         decoder.add_decl(decl, index)
     
-class sample_ref(sampledef_or_sampleref_or_typedef):
-    type_index = i_SAMPLE_REF
-    type_name = 'sample_ref'
-    
-    def __init__(self, name=None, decl=None, sample=None):
-        self.name = name
-        self.decl = decl
-        if sample == None and name != None and decl != None:
-            self.sample = sample_def(name, decl)
-        else:
-            self.sample = sample
-
-    def get_index(self, encoder):
-        return encoder.ref_to_index[self.sample]
-
-    def add_index(self, decoder, index, decl):
-        decoder.add_ref(decl, index)
-
-class typedef(sampledef_or_sampleref_or_typedef):
-    type_index = i_TYPE_DEF
-    type_name = 'typedef'
-
-    def encode_decl(self, encoder):
-        self.decl.encode_decl(encoder)
-
-    def encode(self, encoder, value):
-        self.decl.encode(encoder, value)
-
 class array(type_decl):
     def __init__(self, indices, decl):
         self.indices = tuple(indices)
@@ -664,7 +520,6 @@ class struct(type_decl):
         return result
 
 SAMPLE_DEF = sample_def()
-SAMPLE_REF = sample_ref()
 
 ARRAY = array([], None)
 STRUCT = struct([])
@@ -699,7 +554,6 @@ class Codec(object):
 
     def predefined_types(self):
         self.add_decl(SAMPLE_DEF, i_SAMPLE_DEF)
-        self.add_decl(SAMPLE_REF, i_SAMPLE_REF)
 
         self.add_decl(ARRAY, i_ARRAY)
         self.add_decl(STRUCT, i_STRUCT)
@@ -712,7 +566,6 @@ class Codec(object):
         self.add_decl(FLOAT(), i_FLOAT)
         self.add_decl(DOUBLE(), i_DOUBLE)
         self.add_decl(STRING(), i_STRING)
-        self.add_decl(SAMPLE(), i_SAMPLE)
         
     def add_decl(self, decl, index=0):
         if index == 0:
@@ -758,18 +611,9 @@ class Codec(object):
         
 
 class Encoder(Codec):
-    def __init__(self, writer, version=DEFAULT_VERSION, codec=None):
+    def __init__(self, writer, codec=None):
         super(Encoder, self).__init__(codec)
         self.writer = writer
-        self.version = version
-        if self.version in [ "LabComm2014" ]:
-            self.encode_type(i_VERSION)
-            with length_encoder(self) as e:
-                e.encode_string(version)
-        elif self.version in [ None,  "LabComm2006" ]:
-            pass
-        else:
-            raise Exception("Unsupported labcomm version %s" % self.version)    
 
     def pack(self, format, *args):
         self.writer.write(packer.pack(format, *args))
@@ -783,16 +627,6 @@ class Encoder(Codec):
                 decl.encode_decl(self)
             self.writer.mark_end(decl, None)
  
-    def add_ref(self, decl, index=0):
-        if not isinstance(decl, type_decl):
-            decl = decl.signature
-        ref = sample_ref(name=decl.name, decl=decl.decl, sample=decl)
-        if index == 0:
-            self.writer.mark_begin(decl, None)
-            if super(Encoder, self).add_ref(ref, index):
-                ref.encode_decl(self)
-            self.writer.mark_end(decl, None)
- 
     def encode(self, object, decl=None):
         if decl == None:
             name = self.type_to_name[object.__class__]
@@ -801,8 +635,7 @@ class Encoder(Codec):
             decl = decl.signature
         self.writer.mark_begin(decl, object)
         self.encode_type_number(decl)
-        with length_encoder(self) as e:
-            decl.encode(e, object)
+        decl.encode(self, object)
         self.writer.mark_end(decl, object)
 
     def encode_type_number(self, decl):
@@ -812,20 +645,8 @@ class Encoder(Codec):
             decl.encode_decl(self)
             
     def encode_packed32(self, v):
-        if self.version in [ None, "LabComm2014" ]:
-            v = v & 0xffffffff
-            tmp = [ v & 0x7f ]
-            v = v >> 7
-            while v:
-                tmp.append(v & 0x7f | 0x80)
-                v = v >> 7
-            for c in reversed(tmp):
-                self.encode_byte(c) 
-        elif self.version == "LabComm2006" :
-            v = v & 0xffffffff
-            self.encode_int(v)
-        else :
-            raise Exception("Unsupported labcomm version %s" % self.version)
+        v = v & 0xffffffff
+        self.encode_int(v)
 
     def encode_type(self, index):
         self.encode_packed32(index)
@@ -860,10 +681,9 @@ class Encoder(Codec):
 	self.pack("%ds" % len(s),s)
 
 class Decoder(Codec):
-    def __init__(self, reader, version=DEFAULT_VERSION):
+    def __init__(self, reader):
         super(Decoder, self).__init__()
         self.reader = reader
-        self.version = version
         
     def unpack(self, format):
         size = packer.calcsize(format)
@@ -882,47 +702,11 @@ class Decoder(Codec):
             raise Exception('Should not be used')
         return result
 
-    def skip(self, length):
-        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()
-            if usePacketLength(self.version):
-                length = self.decode_packed32()
-            if index != i_VERSION:
-                break
-            else:
-                other_version = self.decode_string()  
-                if self.version != other_version:
-                    raise Exception("LabComm version mismatch %s != %s" %
-                                    (version, other_version))
+        index = self.decode_type_number()
         if index == i_SAMPLE_DEF:
             decl = self.index_to_decl[index].decode_decl(self)
             value = None
-        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:
@@ -945,18 +729,7 @@ class Decoder(Codec):
         return result
     
     def decode_packed32(self):
-        if self.version in [ "LabComm2013", "LabComm2014" ] :
-            result = 0
-            while True:
-                tmp = self.decode_byte()
-                result = (result << 7) | (tmp & 0x7f)
-                if (tmp & 0x80) == 0:
-                    break
-            return result
-        elif self.version == "LabComm2006" :
-            return self.decode_int()
-        else :
-            raise Exception("Unsupported labcomm version %s" % self.version)
+        return self.decode_int()
 
     def decode_type_number(self):
         return self.decode_packed32()
diff --git a/lib/python/labcomm/__init__.py b/lib/python/labcomm/__init__.py
index fb2c085247062efa9b21ffcafc9b9e80cb34eb21..8bcecac730279edb4314226f348e872d1167a42f 100644
--- a/lib/python/labcomm/__init__.py
+++ b/lib/python/labcomm/__init__.py
@@ -7,9 +7,6 @@ Decoder = labcomm.LabComm.Decoder
 Encoder = labcomm.LabComm.Encoder
 
 sample = labcomm.LabComm.sample_def
-sample_def = labcomm.LabComm.sample_def
-sample_ref = labcomm.LabComm.sample_ref
-typedef = labcomm.LabComm.typedef
 
 array = labcomm.LabComm.array
 struct = labcomm.LabComm.struct
@@ -23,7 +20,6 @@ LONG = labcomm.LabComm.LONG
 FLOAT = labcomm.LabComm.FLOAT
 DOUBLE = labcomm.LabComm.DOUBLE
 STRING = labcomm.LabComm.STRING
-SAMPLE = labcomm.LabComm.SAMPLE
 
 decl_from_signature = labcomm.LabComm.decl_from_signature
 
diff --git a/test/Makefile b/test/Makefile
index 106810bafe9053807a2f59f8a46212d13853afad..bc72f1a3a3fd2022cd061eede522476fe42e2d24 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,5 +1,5 @@
-TESTS=basic simple nested ref
-LABCOMM_JAR=../compiler/labcomm_compiler.jar
+TESTS=basic simple nested
+LABCOMM_JAR=../compiler/labcomm2006_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR)
 
 include ../lib/c/os_compat.mk
@@ -25,8 +25,8 @@ test_%: gen/%/signatures.py \
 		--test tee gen/$*/testdata \
 		--test gen/$*/c_relay /dev/stdin /dev/stdout \
 		--test mono gen/$*/cs_relay.exe /dev/stdin /dev/stdout \
-		--test java \\-cp gen/$*:../lib/java/labcomm.jar java_relay \
-			    /dev/stdin /dev/stdout
+		--test java \\-cp gen/$*:../lib/java/labcomm2006.jar \
+			    java_relay /dev/stdin /dev/stdout
 
 # test cases for compiler error checking
 .PHONY: compiler_errors testErrorsOK testErrorsNOK
@@ -65,8 +65,8 @@ gen/%/c_relay.c: gen/%/typeinfo relay_gen_c.py Makefile
 
 .PRECIOUS: gen/%/c_relay
 gen/%/c_relay: gen/%/c_relay.c gen/%/c_code.c Makefile
-	$(CC) $(CFLAGS) -o $@ $< -I../lib/c/2014 -I. -L../lib/c \
-		gen/$*/c_code.c -llabcomm2014
+	$(CC) $(CFLAGS) -o $@ $< -I../lib/c/2006 -I. -L../lib/c \
+		gen/$*/c_code.c -llabcomm2006
 
 # C# relay test rules
 .PRECIOUS: gen/%/cs_code.cs
@@ -77,14 +77,14 @@ gen/%/cs_code.cs: %.lc Makefile | gen/%/.dir
 gen/%/cs_relay.cs:  gen/%/typeinfo relay_gen_cs.py Makefile
 	./relay_gen_cs.py $< > $@
 
-.PRECIOUS: gen/%/labcomm.dll
-gen/%/labcomm.dll:
-	ln -s ../../../lib/csharp/labcomm.dll $@
+.PRECIOUS: gen/%/labcomm2006.dll
+gen/%/labcomm2006.dll:
+	ln -s ../../../lib/csharp/labcomm2006.dll $@
 
 .PRECIOUS: gen/%/cs_relay.exe
 gen/%/cs_relay.exe: gen/%/cs_relay.cs gen/%/cs_code.cs \
-		    gen/%/labcomm.dll Makefile
-	mcs -out:$@ $(filter %.cs, $^) -lib:../lib/csharp/ -r:labcomm
+		    gen/%/labcomm2006.dll Makefile
+	mcs -out:$@ $(filter %.cs, $^) -lib:../lib/csharp/ -r:labcomm2006
 
 # Java relay test rules
 .PRECIOUS: gen/%/java_code
@@ -98,4 +98,4 @@ gen/%/java_relay.java: gen/%/typeinfo relay_gen_java.py Makefile
 
 .PRECIOUS: gen/%/java_relay.class
 gen/%/java_relay.class: gen/%/java_relay.java gen/%/java_code Makefile
-	javac -d gen/$*  -cp ../lib/java/labcomm.jar:gen/$*/java_code $<
+	javac -d gen/$*  -cp ../lib/java/labcomm2006.jar:gen/$*/java_code $<
diff --git a/test/ref.lc b/test/ref.lc
deleted file mode 100644
index 6fa041eb30a2d4128e9814f9fc54d9c2a4f5d988..0000000000000000000000000000000000000000
--- a/test/ref.lc
+++ /dev/null
@@ -1,4 +0,0 @@
-sample sample s1;
-sample sample s2;
-sample sample s3;
-sample sample sample_list[4];
diff --git a/test/relay_gen_c.py b/test/relay_gen_c.py
index 4d050640d0ec5b9091ff0c19d464ffd52361b5ba..cc5e45ee823fd958ac3edc4f0560ed7d4d38d6f9 100755
--- a/test/relay_gen_c.py
+++ b/test/relay_gen_c.py
@@ -27,26 +27,26 @@ if __name__ == '__main__':
       |#include <sys/types.h>
       |#include <sys/stat.h>
       |#include <fcntl.h>
-      |#include <labcomm2014.h>
-      |#include <labcomm2014_default_error_handler.h>
-      |#include <labcomm2014_default_memory.h>
-      |#include <labcomm2014_default_scheduler.h>
-      |#include <labcomm2014_fd_reader.h>
-      |#include <labcomm2014_fd_writer.h>
+      |#include <labcomm2006.h>
+      |#include <labcomm2006_default_error_handler.h>
+      |#include <labcomm2006_default_memory.h>
+      |#include <labcomm2006_default_scheduler.h>
+      |#include <labcomm2006_fd_reader.h>
+      |#include <labcomm2006_fd_writer.h>
       |#include "c_code.h"
     """))
     for func,arg,stype in sample:
         result.extend(split_match('^[^|]*\|(.*)$', """
           |void handle_%(func)s(%(arg)s *v, void *context)
           |{
-          |  struct labcomm2014_encoder *e = context;
-          |  labcomm2014_encode_%(func)s(e%(valargstr)s);
+          |  struct labcomm2006_encoder *e = context;
+          |  labcomm2006_encode_%(func)s(e%(valargstr)s);
           |}""" % { 'func': func, 'arg': arg, 'valargstr': '' if stype == "void" else', v' }))
         pass
     result.extend(split_match('^[^|]*\|(.*)$', """
       |int main(int argc, char *argv[]) {
-      |  struct labcomm2014_encoder *e;
-      |  struct labcomm2014_decoder *d;
+      |  struct labcomm2006_encoder *e;
+      |  struct labcomm2006_decoder *d;
       |  int in, out;
       |  
       |  if (argc < 3) { return 1; }
@@ -54,26 +54,24 @@ if __name__ == '__main__':
       |  if (in < 0) { return 1; }
       |  out = open(argv[2], O_WRONLY);
       |  if (out < 0) { return 1; }
-      |  e = labcomm2014_encoder_new(labcomm2014_fd_writer_new(
-      |                              labcomm2014_default_memory, out, 1), 
-      |                              labcomm2014_default_error_handler,
-      |                              labcomm2014_default_memory,
-      |                              labcomm2014_default_scheduler);
-      |  d = labcomm2014_decoder_new(labcomm2014_fd_reader_new(
-      |                              labcomm2014_default_memory, in, 1), 
-      |                              labcomm2014_default_error_handler,
-      |                              labcomm2014_default_memory,
-      |                              labcomm2014_default_scheduler);
+      |  e = labcomm2006_encoder_new(labcomm2006_fd_writer_new(
+      |                              labcomm2006_default_memory, out, 1), 
+      |                              labcomm2006_default_error_handler,
+      |                              labcomm2006_default_memory,
+      |                              labcomm2006_default_scheduler);
+      |  d = labcomm2006_decoder_new(labcomm2006_fd_reader_new(
+      |                              labcomm2006_default_memory, in, 1), 
+      |                              labcomm2006_default_error_handler,
+      |                              labcomm2006_default_memory,
+      |                              labcomm2006_default_scheduler);
     """))
     for func,arg,stype in sample:
         result.extend(split_match('^[^|]*\|(.*)$', """
-          |  labcomm2014_encoder_register_%(func)s(e);
-          |  labcomm2014_encoder_sample_ref_register(e, labcomm2014_signature_%(func)s);
-          |  labcomm2014_decoder_register_%(func)s(d, handle_%(func)s, e);
-          |  labcomm2014_decoder_sample_ref_register(d, labcomm2014_signature_%(func)s);
+          |  labcomm2006_encoder_register_%(func)s(e);
+          |  labcomm2006_decoder_register_%(func)s(d, handle_%(func)s, e);
        """ % { 'func': func, 'arg': arg }))
     result.extend(split_match('^[^|]*\|(.*)$', """
-      |  labcomm2014_decoder_run(d);
+      |  labcomm2006_decoder_run(d);
       |  return 0;
       |}
     """))
diff --git a/test/relay_gen_cs.py b/test/relay_gen_cs.py
index 8cd90431bd9cf4eee5bc747f613651f3c6999cbe..3568ea9fb294dd19e1650839daaa7c1ccc50c6d4 100755
--- a/test/relay_gen_cs.py
+++ b/test/relay_gen_cs.py
@@ -73,15 +73,9 @@ if __name__ == '__main__':
     for func,arg in shuffle(sample):
         result.append('    %s.register(decoder, this);' % func)
         pass
-    for func,arg in shuffle(sample):
-        result.append('    %s.registerSampleRef(decoder);' % func)
-        pass
     for func,arg in shuffle(sample):
         result.append('    %s.register(encoder);' % func)
         pass
-    for func,arg in shuffle(sample):
-        result.append('    %s.registerSampleRef(encoder);' % func)
-        pass
     
     result.extend(split_match('^[^|]*\|(.*)$', """
       |    try {
diff --git a/test/relay_gen_java.py b/test/relay_gen_java.py
index a4a3b88d8e6fb60422b3db10ab79f32cec72ef25..39252c18a2cb14bc141f12ed24a8a37c441d2488 100755
--- a/test/relay_gen_java.py
+++ b/test/relay_gen_java.py
@@ -31,9 +31,9 @@ if __name__ == '__main__':
       |import java.io.FileInputStream;
       |import java.io.FileOutputStream;
       |import java.io.IOException;
-      |import se.lth.control.labcomm.DecoderChannel;
-      |import se.lth.control.labcomm.EncoderChannel;
-      |import se.lth.control.labcomm.Sample;
+      |import se.lth.control.labcomm2006.DecoderChannel;
+      |import se.lth.control.labcomm2006.EncoderChannel;
+      |import se.lth.control.labcomm2006.Sample;
       |
       |public class java_relay implements
     """))
@@ -72,15 +72,9 @@ if __name__ == '__main__':
     for func,arg in shuffle(sample):
         result.append('    %s.register(decoder, this);' % func)
         pass
-    for func,arg in shuffle(sample):
-        result.append('    %s.registerSampleRef(decoder);' % func)
-        pass
     for func,arg in shuffle(sample):
         result.append('    %s.register(encoder);' % func)
         pass
-    for func,arg in shuffle(sample):
-        result.append('    %s.registerSampleRef(encoder);' % func)
-        pass
     result.extend(split_match('^[^|]*\|(.*)$', """
       |    try {
       |      decoder.run();
diff --git a/test/test_encoder_decoder.py b/test/test_encoder_decoder.py
index 29960cb7245874db49da8085eb04740e15823e34..074330d8c589898283a906a68cef456b274a652d 100755
--- a/test/test_encoder_decoder.py
+++ b/test/test_encoder_decoder.py
@@ -53,12 +53,6 @@ class Test:
                 result.append((decl, values))
             return result
     
-        elif decl.__class__ == labcomm.typedef:
-            result = []
-            for values in self.generate(decl.decl):
-                result.append(values)
-            return result
-
         elif decl.__class__ == labcomm.struct:
             result = []
             if len(decl.field) == 0:
@@ -128,26 +122,6 @@ class Test:
         print>>sys.stderr, decl
         raise Exception("unhandled decl %s" % decl.__class__)
 
-    def uses_refs(self, decls):
-        for decl in decls:
-            if decl.__class__ == labcomm.sample:
-                if self.uses_refs([ decl.decl ]):
-                    return True
-    
-            elif decl.__class__ == labcomm.struct:
-                if self.uses_refs([ d for n,d in decl.field ]):
-                    return True
-        
-            elif decl.__class__ == labcomm.array:
-                if self.uses_refs([ decl.decl ]):
-                    return True
-
-            elif decl.__class__ == labcomm.SAMPLE:
-                return True
-
-        return False
-        
-
     def run(self):
         print>>sys.stderr, 'Testing', self.program
         p = subprocess.Popen(self.program, 
@@ -163,9 +137,6 @@ class Test:
         for signature in self.signatures:
             encoder.add_decl(signature)
             pass
-        if self.uses_refs(self.signatures):
-            for signature in self.signatures:
-                encoder.add_ref(signature)
         for signature in self.signatures:
             print>>sys.stderr, "Checking", signature.name,
             for decl,value in self.generate(signature):
diff --git a/tools/lc_to_matlab_coder.py b/tools/lc_to_matlab_coder.py
deleted file mode 100755
index f1fbf361c548d05aa918ab2171ddefbdf66dc736..0000000000000000000000000000000000000000
--- a/tools/lc_to_matlab_coder.py
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import imp
-import subprocess
-import os
-import labcomm
-
-TRANSLATE={
-    labcomm.SHORT() : 'short',
-    labcomm.DOUBLE() : 'double'
-}
-
-def compile_lc(lc):
-    p = subprocess.Popen([ 'labcomm2014', '--python=/dev/stdout', lc],
-                         stdout=subprocess.PIPE)
-    src = p.stdout.read()
-    code = compile(src, 'lc_import', 'exec')
-    mod = sys.modules.setdefault('lc_import', imp.new_module('lc_import'))
-    exec code in mod.__dict__
-    import lc_import
-    return (lc_import.typedef, lc_import.sample)
-
-def gen_binding(decl, lc_prefix, prefix, suffix):
-    if isinstance(decl, labcomm.sample):
-        if isinstance(decl.decl, labcomm.typedef):
-            print "%(n1)s = coder.cstructname(%(n1)s, '%(lc)s_%(n2)s')" % dict(
-                n1=decl.name, n2=decl.decl.name, lc=lc_prefix)
-        else:
-            print "%(n1)s = coder.cstructname(%(n1)s, '%(lc)s_%(n2)s')" % dict(
-                n1=decl.name, n2=decl.name, lc=lc_prefix)
-        gen_binding(decl.decl, lc_prefix, '%s.' % decl.name, suffix)
-    elif isinstance(decl, labcomm.typedef):
-        print "%(p)s%(s)s = coder.cstructname(%(p)s%(s)s, '%(lc)s_%(n)s')" % dict(
-            n=decl.name, lc=lc_prefix, p=prefix, s=suffix)
-        gen_binding(decl.decl, lc_prefix, prefix, suffix)
-    elif isinstance(decl, labcomm.array):
-         raise Exception("Array unhandled")
-    elif isinstance(decl, labcomm.struct):
-        for n, d in decl.field:
-            gen_binding(d, lc_prefix, '%sFields.%s' % (prefix, n), suffix)
-    elif isinstance(decl, labcomm.primitive):
-        pass
-    else:
-        raise Exception("Unhandled type. %s", decl)
-    
-def gen_sample(lc_prefix, decl):
-    if isinstance(decl, labcomm.sample):
-        print "%s = " % decl.name,
-        gen_sample(lc_prefix, decl.decl)
-        print
-        gen_binding(decl, lc_prefix, '', '')
-    elif isinstance(decl, labcomm.typedef):
-        # Expand in place
-        gen_sample(lc_prefix, decl.decl)
-    elif isinstance(decl, labcomm.array):
-         raise Exception("Array unhandled")
-    elif isinstance(decl, labcomm.struct):
-        print "struct(..."
-        for n, d in decl.field:
-            print "'%s, " % n,
-            gen_sample(lc_prefix, d)
-        print ")..."
-    elif isinstance(decl, labcomm.primitive):
-        print "%s(0), ..." % TRANSLATE[decl]
-    else:
-        raise Exception("Unhandled type. %s", decl)  
-
-"""
-robtarget = struct(...
-	'orientation', ...
-	struct(...
-	    'q1', double(0), ...
-	    'q2', double(0), ...
-	    'q3', double(0), ...
-	    'q4', double(0) ...
-	), ...
-	'translation', ...
-	struct(...
-	    'x', double(0), ...
-	    'y', double(0), ...
-	    'z', double(0) ...
-	), ...
-	'configuration', ...
-	struct(...
-	    'cf1', int16(0), ...
-	    'cf4', int16(0), ...
-	    'cf6', int16(0), ...
-	    'cfx', int16(0) ...
-	) ...
-);
-robtarget_types = coder.typeof(robtarget);
-
-act = coder.cstructname(robtarget_types, 'egm_pb2lc_robtarget');
-act.Fields.translation = coder.cstructname(act.Fields.translation, 'egm_pb2lc_cartesian');
-act.Fields.orientation = coder.cstructname(act.Fields.orientation, 'egm_pb2lc_quaternion');
-act.Fields.configuration = coder.cstructname(act.Fields.configuration, 'egm_pb2lc_confdata');
-"""
-
-def gen_matlab(lc):
-    lc_prefix = os.path.basename(lc).split('.')[0]
-    typedef, sample = compile_lc(lc)
-    for s in sample:
-        gen_sample(lc_prefix, s.signature)
-
-if __name__ == '__main__':
-    for lc in sys.argv[1:]:
-        gen_matlab(lc)