From 373eac7b4945eab38c31ab9faec5ff2f382b0717 Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Wed, 4 Mar 2015 13:31:30 +0100
Subject: [PATCH] Removed 2006 version

---
 .bzrignore                                    |   41 -
 Makefile                                      |    2 +-
 compiler/.gitignore                           |    2 +-
 compiler/2006/ArrayTypeRewrite.jrag           |   43 -
 compiler/2006/CS_CodeGen.jrag                 |  971 ----------
 compiler/2006/C_CodeGen.jrag                  | 1664 -----------------
 compiler/2006/DeclNames.jrag                  |   14 -
 compiler/2006/ErrorCheck.jrag                 |   31 -
 compiler/2006/FlatSignature.jrag              |  123 --
 compiler/2006/Java_CodeGen.jrag               | 1044 -----------
 compiler/2006/LabComm.ast                     |   39 -
 compiler/2006/LabComm.java                    |  404 ----
 compiler/2006/LabCommParser.parser            |  133 --
 compiler/2006/LabCommScanner.flex             |   87 -
 compiler/2006/LabCommTokens.jrag              |   21 -
 compiler/2006/NameAnalysis.jrag               |   67 -
 compiler/2006/PrettyPrint.jrag                |  117 --
 compiler/2006/Python_CodeGen.jrag             |  232 ---
 compiler/2006/RAPID_CodeGen.jrag              |  369 ----
 compiler/2006/Signature.jrag                  |  236 ---
 compiler/2006/TypeCheck.jrag                  |   36 -
 compiler/2006/TypeReferences.jrag             |   46 -
 compiler/2006/Version.jrag                    |   15 -
 compiler/LabComm.java                         |   36 -
 compiler/Makefile                             |    2 +-
 compiler/build.xml                            |   39 +-
 compiler/labcomm                              |    2 -
 compiler/labcomm2006                          |    2 -
 examples/duck_typing/Makefile                 |    2 +-
 examples/dynamic/dynamic.sh                   |   16 +-
 examples/dynamic/dynamic_type.sh              |   16 +-
 examples/dynamic/static.sh                    |   10 +-
 examples/dynamic/test.sh                      |    4 +-
 examples/dynamic/test_type.sh                 |    4 +-
 examples/jgrafchart/Makefile                  |    4 +-
 examples/simple/Decoder06.java                |   83 -
 examples/simple/Encoder06.java                |   62 -
 examples/simple/Makefile                      |    3 -
 examples/simple/compile.sh                    |   21 +-
 examples/simple/example_decoder06.c           |   84 -
 examples/simple/example_encoder06.c           |   85 -
 examples/simple/run.sh                        |   17 -
 examples/tcp/Makefile                         |    6 +-
 examples/twoway/Makefile                      |    2 +-
 examples/user_types/Makefile                  |    2 +-
 examples/wiki_example/run                     |    4 +-
 lib/c/2006/Makefile                           |  151 --
 lib/c/2006/labcomm2006.c                      |  267 ---
 lib/c/2006/labcomm2006.h                      |  148 --
 lib/c/2006/labcomm2006_decoder.c              |  422 -----
 .../2006/labcomm2006_default_error_handler.c  |   24 -
 .../2006/labcomm2006_default_error_handler.h  |   28 -
 lib/c/2006/labcomm2006_default_memory.c       |   49 -
 lib/c/2006/labcomm2006_default_memory.h       |   29 -
 lib/c/2006/labcomm2006_default_scheduler.c    |  109 --
 lib/c/2006/labcomm2006_default_scheduler.h    |   28 -
 .../2006/labcomm2006_dynamic_buffer_writer.c  |  155 --
 .../2006/labcomm2006_dynamic_buffer_writer.h  |   32 -
 lib/c/2006/labcomm2006_encoder.c              |  164 --
 lib/c/2006/labcomm2006_error.c                |   32 -
 lib/c/2006/labcomm2006_error.h                |   68 -
 lib/c/2006/labcomm2006_fd_reader.c            |  129 --
 lib/c/2006/labcomm2006_fd_reader.h            |   32 -
 lib/c/2006/labcomm2006_fd_writer.c            |  142 --
 lib/c/2006/labcomm2006_fd_writer.h            |   31 -
 lib/c/2006/labcomm2006_ioctl.h                |  101 -
 lib/c/2006/labcomm2006_memory.c               |   40 -
 lib/c/2006/labcomm2006_private.h              |  493 -----
 lib/c/2006/labcomm2006_pthread_scheduler.c    |  394 ----
 lib/c/2006/labcomm2006_pthread_scheduler.h    |   31 -
 lib/c/2006/labcomm2006_scheduler.c            |   85 -
 lib/c/2006/labcomm2006_scheduler.h            |   60 -
 lib/c/2006/labcomm2006_scheduler_private.h    |   60 -
 lib/c/2006/labcomm2006_time.c                 |   42 -
 lib/c/2006/labcomm_compat_arm_cortexm3.h      |    5 -
 lib/c/2006/labcomm_compat_osx.h               |   28 -
 lib/c/2006/labcomm_compat_vxworks.h           |   30 -
 lib/c/2006/test/.gitignore                    |    1 -
 lib/c/2006/test/another_encoding.lc           |    2 -
 lib/c/2006/test/cppmacros.h                   |    8 -
 lib/c/2006/test/generated_encoding.lc         |    7 -
 lib/c/2006/test/labcomm_mem_reader.c          |   80 -
 lib/c/2006/test/labcomm_mem_reader.h          |   19 -
 lib/c/2006/test/labcomm_mem_writer.c          |  146 --
 lib/c/2006/test/labcomm_mem_writer.h          |   25 -
 lib/c/2006/test/more_types.lc                 |    7 -
 lib/c/2006/test/test_labcomm.c                |  213 ---
 .../test/test_labcomm_basic_type_encoding.c   |  143 --
 lib/c/2006/test/test_labcomm_copy.c           |  249 ---
 lib/c/2006/test/test_labcomm_errors.c         |  173 --
 lib/c/2006/test/test_labcomm_errors.h         |    6 -
 .../test/test_labcomm_generated_encoding.c    |  219 ---
 .../test/test_labcomm_pthread_scheduler.c     |   82 -
 lib/c/2006/test/test_sample.lc                |    1 -
 lib/c/2006/test/test_signature_numbers.c      |   24 -
 lib/c/Makefile                                |    2 +-
 lib/java/.gitignore                           |    2 +-
 lib/java/Makefile                             |   17 +-
 .../lth/control/labcomm2006/ASTbuilder.java   |    4 -
 .../lth/control/labcomm2006/BuiltinType.java  |    5 -
 .../se/lth/control/labcomm2006/Constant.java  |   32 -
 .../se/lth/control/labcomm2006/Decoder.java   |   19 -
 .../control/labcomm2006/DecoderChannel.java   |  144 --
 .../control/labcomm2006/DecoderRegistry.java  |  144 --
 .../se/lth/control/labcomm2006/Encoder.java   |   20 -
 .../control/labcomm2006/EncoderChannel.java   |   94 -
 .../control/labcomm2006/EncoderRegistry.java  |   55 -
 .../se/lth/control/labcomm2006/Reader.java    |    7 -
 .../se/lth/control/labcomm2006/Sample.java    |    5 -
 .../control/labcomm2006/SampleDispatcher.java |   15 -
 .../control/labcomm2006/SampleHandler.java    |    4 -
 .../lth/control/labcomm2006/SampleType.java   |    5 -
 .../lth/control/labcomm2006/TypeBinding.java  |    3 -
 .../se/lth/control/labcomm2006/TypeDef.java   |    3 -
 .../control/labcomm2006/TypeDefParser.java    |    2 -
 .../se/lth/control/labcomm2006/Writer.java    |    9 -
 .../control/labcomm2006/WriterWrapper.java    |   17 -
 test/Makefile                                 |    4 +-
 118 files changed, 47 insertions(+), 11622 deletions(-)
 delete mode 100644 .bzrignore
 delete mode 100644 compiler/2006/ArrayTypeRewrite.jrag
 delete mode 100644 compiler/2006/CS_CodeGen.jrag
 delete mode 100644 compiler/2006/C_CodeGen.jrag
 delete mode 100644 compiler/2006/DeclNames.jrag
 delete mode 100644 compiler/2006/ErrorCheck.jrag
 delete mode 100644 compiler/2006/FlatSignature.jrag
 delete mode 100644 compiler/2006/Java_CodeGen.jrag
 delete mode 100644 compiler/2006/LabComm.ast
 delete mode 100644 compiler/2006/LabComm.java
 delete mode 100644 compiler/2006/LabCommParser.parser
 delete mode 100644 compiler/2006/LabCommScanner.flex
 delete mode 100644 compiler/2006/LabCommTokens.jrag
 delete mode 100644 compiler/2006/NameAnalysis.jrag
 delete mode 100644 compiler/2006/PrettyPrint.jrag
 delete mode 100644 compiler/2006/Python_CodeGen.jrag
 delete mode 100644 compiler/2006/RAPID_CodeGen.jrag
 delete mode 100644 compiler/2006/Signature.jrag
 delete mode 100644 compiler/2006/TypeCheck.jrag
 delete mode 100644 compiler/2006/TypeReferences.jrag
 delete mode 100644 compiler/2006/Version.jrag
 delete mode 100644 compiler/LabComm.java
 delete mode 100755 compiler/labcomm
 delete mode 100755 compiler/labcomm2006
 delete mode 100644 examples/simple/Decoder06.java
 delete mode 100644 examples/simple/Encoder06.java
 delete mode 100644 examples/simple/example_decoder06.c
 delete mode 100644 examples/simple/example_encoder06.c
 delete mode 100644 lib/c/2006/Makefile
 delete mode 100644 lib/c/2006/labcomm2006.c
 delete mode 100644 lib/c/2006/labcomm2006.h
 delete mode 100644 lib/c/2006/labcomm2006_decoder.c
 delete mode 100644 lib/c/2006/labcomm2006_default_error_handler.c
 delete mode 100644 lib/c/2006/labcomm2006_default_error_handler.h
 delete mode 100644 lib/c/2006/labcomm2006_default_memory.c
 delete mode 100644 lib/c/2006/labcomm2006_default_memory.h
 delete mode 100644 lib/c/2006/labcomm2006_default_scheduler.c
 delete mode 100644 lib/c/2006/labcomm2006_default_scheduler.h
 delete mode 100644 lib/c/2006/labcomm2006_dynamic_buffer_writer.c
 delete mode 100644 lib/c/2006/labcomm2006_dynamic_buffer_writer.h
 delete mode 100644 lib/c/2006/labcomm2006_encoder.c
 delete mode 100644 lib/c/2006/labcomm2006_error.c
 delete mode 100644 lib/c/2006/labcomm2006_error.h
 delete mode 100644 lib/c/2006/labcomm2006_fd_reader.c
 delete mode 100644 lib/c/2006/labcomm2006_fd_reader.h
 delete mode 100644 lib/c/2006/labcomm2006_fd_writer.c
 delete mode 100644 lib/c/2006/labcomm2006_fd_writer.h
 delete mode 100644 lib/c/2006/labcomm2006_ioctl.h
 delete mode 100644 lib/c/2006/labcomm2006_memory.c
 delete mode 100644 lib/c/2006/labcomm2006_private.h
 delete mode 100644 lib/c/2006/labcomm2006_pthread_scheduler.c
 delete mode 100644 lib/c/2006/labcomm2006_pthread_scheduler.h
 delete mode 100644 lib/c/2006/labcomm2006_scheduler.c
 delete mode 100644 lib/c/2006/labcomm2006_scheduler.h
 delete mode 100644 lib/c/2006/labcomm2006_scheduler_private.h
 delete mode 100644 lib/c/2006/labcomm2006_time.c
 delete mode 100644 lib/c/2006/labcomm_compat_arm_cortexm3.h
 delete mode 100644 lib/c/2006/labcomm_compat_osx.h
 delete mode 100644 lib/c/2006/labcomm_compat_vxworks.h
 delete mode 100644 lib/c/2006/test/.gitignore
 delete mode 100644 lib/c/2006/test/another_encoding.lc
 delete mode 100644 lib/c/2006/test/cppmacros.h
 delete mode 100644 lib/c/2006/test/generated_encoding.lc
 delete mode 100644 lib/c/2006/test/labcomm_mem_reader.c
 delete mode 100644 lib/c/2006/test/labcomm_mem_reader.h
 delete mode 100644 lib/c/2006/test/labcomm_mem_writer.c
 delete mode 100644 lib/c/2006/test/labcomm_mem_writer.h
 delete mode 100644 lib/c/2006/test/more_types.lc
 delete mode 100644 lib/c/2006/test/test_labcomm.c
 delete mode 100644 lib/c/2006/test/test_labcomm_basic_type_encoding.c
 delete mode 100644 lib/c/2006/test/test_labcomm_copy.c
 delete mode 100644 lib/c/2006/test/test_labcomm_errors.c
 delete mode 100644 lib/c/2006/test/test_labcomm_errors.h
 delete mode 100644 lib/c/2006/test/test_labcomm_generated_encoding.c
 delete mode 100644 lib/c/2006/test/test_labcomm_pthread_scheduler.c
 delete mode 100644 lib/c/2006/test/test_sample.lc
 delete mode 100644 lib/c/2006/test/test_signature_numbers.c
 delete mode 100644 lib/java/se/lth/control/labcomm2006/ASTbuilder.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/BuiltinType.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/Constant.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/Decoder.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/DecoderChannel.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/DecoderRegistry.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/Encoder.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/EncoderChannel.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/EncoderRegistry.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/Reader.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/Sample.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/SampleDispatcher.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/SampleHandler.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/SampleType.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/TypeBinding.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/TypeDef.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/TypeDefParser.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/Writer.java
 delete mode 100644 lib/java/se/lth/control/labcomm2006/WriterWrapper.java

diff --git a/.bzrignore b/.bzrignore
deleted file mode 100644
index 4604e2f..0000000
--- a/.bzrignore
+++ /dev/null
@@ -1,41 +0,0 @@
-AST
-AST/*
-LabComm.class
-labComm.jar
-lib/java/se/lth/control/labcomm/LabComm.class
-lib/java/se/lth/control/labcomm/LabCommDecoderChannel.class
-lib/java/se/lth/control/labcomm/LabCommDecoder.class
-lib/java/se/lth/control/labcomm/LabCommDecoderRegistry.class
-lib/java/se/lth/control/labcomm/LabCommDecoderRegistry$Entry.class
-lib/java/se/lth/control/labcomm/LabCommDispatcher.class
-lib/java/se/lth/control/labcomm/LabCommEncoderChannel.class
-lib/java/se/lth/control/labcomm/LabCommEncoder.class
-lib/java/se/lth/control/labcomm/LabCommEncoderRegistry.class
-lib/java/se/lth/control/labcomm/LabCommEncoderRegistry$Entry.class
-lib/java/se/lth/control/labcomm/LabCommHandler.class
-lib/java/se/lth/control/labcomm/LabCommReader.class
-lib/java/se/lth/control/labcomm/LabCommSample.class
-lib/java/se/lth/control/labcomm/LabCommType.class
-lib/java/se/lth/control/labcomm/LabCommWriter.class
-gen
-labcomm.dll
-labcomm.jar
-example.c
-example.h
-example.py
-examples/wiki_example/example.encoded
-example.encoded
-examples/simple/*.class
-examples/simple/encoded_data
-examples/simple/example_decoder
-examples/simple/example_encoder
-lib/c/test/test_labcomm_basic_type_encoding
-lib/c/test/test_labcomm_generated_encoding
-lib/java/se/lth/control/labcomm/WriterWrapper.class
-lib/c/liblabcomm.so.1
-lib/c/test/test_labcomm_pthread_scheduler
-lib/c/liblabcomm_plain_c.so.1
-lib/c/test/test_signature_plain_c
-test/test_signature_numbers
-lib/c/test/test_signature_numbers
-lib/c/test/test_labcomm
diff --git a/Makefile b/Makefile
index 77f3305..4879b7e 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/labcomm2014_compiler.jar
 export LABCOMM=java -jar $(LABCOMM_JAR) 
 
 .PHONY: all
diff --git a/compiler/.gitignore b/compiler/.gitignore
index fb3995c..4a5b2b0 100644
--- a/compiler/.gitignore
+++ b/compiler/.gitignore
@@ -1,4 +1,4 @@
 gen
 labcomm2006_compiler.jar
 labcomm2014_compiler.jar
-labcomm_compiler.jar
+labcomm2014_compiler.jar
diff --git a/compiler/2006/ArrayTypeRewrite.jrag b/compiler/2006/ArrayTypeRewrite.jrag
deleted file mode 100644
index 28e3c79..0000000
--- a/compiler/2006/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/2006/CS_CodeGen.jrag b/compiler/2006/CS_CodeGen.jrag
deleted file mode 100644
index e1da497..0000000
--- a/compiler/2006/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/2006/C_CodeGen.jrag b/compiler/2006/C_CodeGen.jrag
deleted file mode 100644
index 2fd45b1..0000000
--- a/compiler/2006/C_CodeGen.jrag
+++ /dev/null
@@ -1,1664 +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 __LABCOMM2006_" + env.lcName + "_H__"); 
-    env.println("#define __LABCOMM2006_" + env.lcName + "_H__");
-    env.println("");
-
-    // Include
-    env.println("#include \"labcomm"+env.verStr+".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 \"labcomm"+env.verStr+".h\"");
-    env.println("#include \"labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_signature " +
-                "*labcomm"+env.verStr+"_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 labcomm_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 labcomm"+env.verStr+"_decoder_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_decoder_ioctl_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_encoder_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm"+env.verStr+"_encoder *e);");
-    env.unindent();
-
-    env.println("int labcomm"+env.verStr+"_encode_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm"+env.verStr+"_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.indent();
-    env.println("struct labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_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("labcomm_internal_decoder_index_to_signature(" +
-                    "r->decoder, labcomm"+env.verStr+"_read_int(r));");
-      } break;
-      default: {
-        env.println("labcomm"+env.verStr+"_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 + " = labcomm"+env.verStr+"_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 = labcomm"+env.verStr+"_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("labcomm"+env.verStr+"_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("labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_decoder_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_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("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 labcomm" + env.verStr + "_copy_" +
-                env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm" + env.verStr + "_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 = labcomm%s_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);",
-	  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 = labcomm" + env_src.verStr +
-                  "_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 labcomm" + env.verStr + "_copy_free_" +
-                env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm" + env.verStr + "_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("labcomm" + env.verStr + "_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("labcomm" + env.verStr + "_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 labcomm"+env.verStr+"_decoder_ioctl_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm"+env.verStr+"_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 = labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_encode_" + env.prefix + getName() + "(");
-    env.println("struct labcomm"+env.verStr+"_encoder *e");
-    if(!isVoid() ) {
-        env.println(", "+env.prefix + getName() + " *v");
-    }
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println("return labcomm"+env.verStr+"_internal_encode(e, &signature_" + 
-		env.prefix + getName() + 
-		", (labcomm"+env.verStr+"_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("labcomm"+env.verStr+"_write_int(w, " + 
-                    "labcomm_internal_encoder_signature_to_index(w->encoder, " +
-                    env.qualid + "));");
-      } break;
-      default: {
-        env.println("labcomm"+env.verStr+"_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("labcomm"+env.verStr+"_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");
-  }
-  
-  public void TypeDecl.C_emitEncoderRegisterHandler(C_env env) {
-    // do nothing for type decls
-  }
-  
-  public void SampleDecl.C_emitEncoderRegisterHandler(C_env env) {
-    env.println("int labcomm"+env.verStr+"_encoder_register_" + 
-		env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm"+env.verStr+"_encoder *e");
-    env.unindent();
-    env.println(")");
-    env.println("{");
-    env.indent();
-    env.println("return labcomm"+env.verStr+"_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.unindent();
-    env.println(");");
-    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 labcomm"+env.verStr+"_encoder_ioctl_" + env.prefix + getName() + "(");
-    env.indent();
-    env.println("struct labcomm"+env.verStr+"_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 = labcomm"+env.verStr+"_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_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) {
-    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) {
-    throw new Error(this.getClass().getName() + 
-                    ".C_emitFlatSignature(C_env env)" + 
-                    " not declared");
-  }
-
-  public void Decl.C_emitFlatSignature(C_env env) {
-  }
-
-  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 labcomm"+env.verStr+"_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");
-    env.unindent();
-    env.println(" };");
-    env.println("const struct labcomm"+env.verStr+"_signature " +
-                "*labcomm"+env.verStr+"_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() + 
-		    ".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 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.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 labcomm"+env.verStr+"_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 labcomm"+env.verStr+"_sizeof_" + env.prefix + getName() +
-        "(" + env.prefix + getName() + " *v)");
-    env.println("{");
-    env.indent();
-    env.println("return labcomm"+env.verStr+"_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 += labcomm"+env.verStr+"_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 += labcomm"+env.verStr+"_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/2006/DeclNames.jrag b/compiler/2006/DeclNames.jrag
deleted file mode 100644
index 042739b..0000000
--- a/compiler/2006/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/2006/ErrorCheck.jrag b/compiler/2006/ErrorCheck.jrag
deleted file mode 100644
index caa8081..0000000
--- a/compiler/2006/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/2006/FlatSignature.jrag b/compiler/2006/FlatSignature.jrag
deleted file mode 100644
index 2a9ca4d..0000000
--- a/compiler/2006/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/2006/Java_CodeGen.jrag b/compiler/2006/Java_CodeGen.jrag
deleted file mode 100644
index 0a1ac1f..0000000
--- a/compiler/2006/Java_CodeGen.jrag
+++ /dev/null
@@ -1,1044 +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 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();
-
-
-    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()){
-    //  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()+">":""; 
-    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 hasStaticSignature() {");
-//    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();
-    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) 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+";");
-    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;
-    }
-    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;
-    }
-  }
-
-  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/2006/LabComm.ast b/compiler/2006/LabComm.ast
deleted file mode 100644
index 904cc17..0000000
--- a/compiler/2006/LabComm.ast
+++ /dev/null
@@ -1,39 +0,0 @@
-Program ::= Decl*;
-
-//TODO: Add signatures to the abstract grammar, so that
-//they can be extended and refined by more than one aspect.
-//sketch:
-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;
-
-
-//abstract Decl ::= Type <Name:String>;
-// the signature list be defined as  a non-terminal attribute:
-abstract Decl ::= Type <Name:String> /Signature/;
-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;
diff --git a/compiler/2006/LabComm.java b/compiler/2006/LabComm.java
deleted file mode 100644
index 04ade97..0000000
--- a/compiler/2006/LabComm.java
+++ /dev/null
@@ -1,404 +0,0 @@
-package se.lth.control.labcomm2006.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 2013)");
-    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 == 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) {
-    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 = 2006; // Version 2006 fixed
-    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/2006/LabCommParser.parser b/compiler/2006/LabCommParser.parser
deleted file mode 100644
index e1fb352..0000000
--- a/compiler/2006/LabCommParser.parser
+++ /dev/null
@@ -1,133 +0,0 @@
-%header {:
-package se.lth.control.labcomm2006.compiler;
-import se.lth.control.labcomm2006.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/2006/LabCommScanner.flex b/compiler/2006/LabCommScanner.flex
deleted file mode 100644
index 685f824..0000000
--- a/compiler/2006/LabCommScanner.flex
+++ /dev/null
@@ -1,87 +0,0 @@
-package se.lth.control.labcomm2006.compiler;
-
-import beaver.Symbol;
-import beaver.Scanner;
-import se.lth.control.labcomm2006.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/2006/LabCommTokens.jrag b/compiler/2006/LabCommTokens.jrag
deleted file mode 100644
index 557714b..0000000
--- a/compiler/2006/LabCommTokens.jrag
+++ /dev/null
@@ -1,21 +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  =  0x04;  // and type declarations, hierarchically
-
-  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/2006/NameAnalysis.jrag b/compiler/2006/NameAnalysis.jrag
deleted file mode 100644
index 92dbb41..0000000
--- a/compiler/2006/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/2006/PrettyPrint.jrag b/compiler/2006/PrettyPrint.jrag
deleted file mode 100644
index a7fa877..0000000
--- a/compiler/2006/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/2006/Python_CodeGen.jrag b/compiler/2006/Python_CodeGen.jrag
deleted file mode 100644
index 17203b8..0000000
--- a/compiler/2006/Python_CodeGen.jrag
+++ /dev/null
@@ -1,232 +0,0 @@
-aspect Python_CodeGenEnv {
-
-  // Environment wrapper for Python code generation
-  // handles qualid nesting, indentation, file writing and
-  // prefix propagation
-
-  public class Python_env {
-
-    final private class Python_printer {
-      
-      private boolean newline = true;
-      private PrintStream out;
-
-      public Python_printer(PrintStream out) {
-        this.out = out;
-      }
-
-      public void print(Python_env env, String s) {
-        if (newline) {
-          newline = false;
-          for (int i = 0 ; i < env.indent ; i++) {
-            out.print("    ");
-          }
-        }
-        out.print(s);
-      }
-
-      public void println(Python_env env, String s) {
-        print(env, s);
-        out.println();
-        newline = true;
-      }
-
-      public void println(Python_env env) {
-        out.println();
-        newline = true;
-      }
-
-    }
-
-    private int indent;
-    private Python_printer printer;
-
-    public Python_env(PrintStream out) {
-      this.indent = 0;
-      this.printer = new Python_printer(out);
-    }
-
-    public void indent() {
-      indent++;
-    }
-
-    public void unindent() {
-      indent--;
-    }
-
-    public void print(String s) {
-      printer.print(this, s);
-    }
-
-    public void println(String s) {
-      printer.println(this, s);
-    }
-
-    public void println() {
-      printer.println(this);
-    }
-
-  }
-
-}
-
-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);
-    Python_env env = new Python_env(out);
-    env.println("#!/usr/bin/python");
-    env.println("# Auto generated " + baseName);
-    env.println();
-    env.println("import labcomm");
-    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.indent();
-    for (int i = 0 ; i < getNumDecl() ; i++) {
-      getDecl(i).Python_genSampleListEntry(env);
-    }
-    env.unindent();
-    env.println("]");
-  }
-
-}
-
-aspect PythonTypes {
-  
-  public void Program.Python_genTypes(Python_env env) {
-    for (int i = 0 ; i < getNumDecl() ; i++) {
-      getDecl(i).Python_genSignature(env);
-    }
-  }
-
-  public void Decl.Python_genSignature(Python_env env) {
-    throw new Error(this.getClass().getName() + 
-                    ".Python_genSignature(Python_env env)" + 
-                    " not declared");
-  }
-
-  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) {
-    env.println("class " + getName() + "(object):");
-    env.indent();
-    env.println("signature = labcomm.sample('" + getName() + "', ");
-    env.indent();
-    getType().Python_genSignature(env);
-    env.unindent();
-    env.println(")");
-    env.unindent();
-    env.println();
-  }
-
-  public void UserType.Python_genSignature(Python_env env) {
-    lookupType(getName()).getType().Python_genSignature(env);
-  }
-
-  public void Type.Python_genSignature(Python_env env) {
-    throw new Error(this.getClass().getName() + 
-                    ".Python_genSignature(Python_env env)" + 
-                    " not declared");
-  }
-
-  public void PrimType.Python_genSignature(Python_env env) {
-    switch (getToken()) {
-      case LABCOMM_BOOLEAN: { env.print("labcomm.BOOLEAN()"); } break;
-      case LABCOMM_BYTE: { env.print("labcomm.BYTE()"); } break;
-      case LABCOMM_SHORT: { env.print("labcomm.SHORT()"); } break;
-      case LABCOMM_INT: { env.print("labcomm.INTEGER()"); } break;
-      case LABCOMM_LONG: { env.print("labcomm.LONG()"); } break;
-      case LABCOMM_FLOAT: { env.print("labcomm.FLOAT()"); } break;
-      case LABCOMM_DOUBLE: { env.print("labcomm.DOUBLE()"); } break;
-      case LABCOMM_STRING: { env.print("labcomm.STRING()"); } break;
-      case LABCOMM_SAMPLE: { env.print("labcomm.SAMPLE()"); } break;
-    }
-  }
-
-  public void ArrayType.Python_genSignature(Python_env env) {
-    env.print("labcomm.array([");
-    for (int i = 0 ; i < getNumExp() ; i++) {
-      if (i > 0) { env.print(", "); }
-      env.print(getExp(i).Python_getValue());
-    }
-    env.println("],");
-    env.indent();
-    getType().Python_genSignature(env);
-    env.print(")");
-    env.unindent();
-  }
-
-  public void StructType.Python_genSignature(Python_env env) {
-    env.println("labcomm.struct([");
-    env.indent();
-    for (int i = 0 ; i < getNumField() ; i++) {
-      if (i > 0) { env.println(","); }
-      getField(i).Python_genSignature(env);
-    }
-    env.print("])");
-    env.unindent();
-  }
-
-  public void VoidType.Python_genSignature(Python_env env) {
-    env.println("labcomm.struct([])");
-  }
-
-  public void Field.Python_genSignature(Python_env env) {
-    env.print("('" + getName() + "', ");
-    getType().Python_genSignature(env);
-    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),");
-  }
-
-  public String Exp.Python_getValue() {
-   throw new Error(this.getClass().getName() + 
-                    ".Python_getValue()" + 
-                    " not declared");
-  }
-
-  public String IntegerLiteral.Python_getValue() {
-    return getValue();
-  }
-
-  public String VariableSize.Python_getValue() {
-    return "0";
-  }
-
-}
-
diff --git a/compiler/2006/RAPID_CodeGen.jrag b/compiler/2006/RAPID_CodeGen.jrag
deleted file mode 100644
index b367ee5..0000000
--- a/compiler/2006/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/2006/Signature.jrag b/compiler/2006/Signature.jrag
deleted file mode 100644
index 5395095..0000000
--- a/compiler/2006/Signature.jrag
+++ /dev/null
@@ -1,236 +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) {
-     //System.out.println("************ TypeDecl.genSigLine("+decl+").... for "+getName());
-    if(decl){
-      getType().genSigLineForDecl(list, decl);
-    }else{
-      list.addTypeRef(this, "//TODO (from list.addTypeRef)");
-    }
-  }
-
-  public void SampleDecl.genSigLineForDecl(SignatureList list, boolean decl) {
-     //System.out.println("************ SampleDecl.genSigLine("+decl+").... for "+getName());
-    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);
-  }
-
-  public void UserType.genSigLineForDecl(SignatureList list, boolean decl) {
-    if(decl){
-     //System.out.println("************ UserType.genSigLine("+decl+").... for "+getName());
-      TypeDecl thet=lookupType(getName());
-      //System.out.println("************ thet: "+thet.getName() +":"+thet.getType());
-      thet.genSigLineForDecl(list, decl);
-    }else{
-     //System.out.println("************ UserType.genSigLine("+decl+").... for "+getName());
-      TypeDecl thet = lookupType(getName());
-     // System.out.println("************ thet: "+thet.getName() +":"+thet.getType());
-      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/2006/TypeCheck.jrag b/compiler/2006/TypeCheck.jrag
deleted file mode 100644
index a640ace..0000000
--- a/compiler/2006/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/2006/TypeReferences.jrag b/compiler/2006/TypeReferences.jrag
deleted file mode 100644
index 0a7cd9b..0000000
--- a/compiler/2006/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/2006/Version.jrag b/compiler/2006/Version.jrag
deleted file mode 100644
index f080578..0000000
--- a/compiler/2006/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 a6f4c6b..0000000
--- 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 f935342..66aaf9c 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 7d63d68..e3ba550 100644
--- a/compiler/build.xml
+++ b/compiler/build.xml
@@ -126,7 +126,6 @@
   <uptodate property="compile.u">
     <srcfiles dir='.'>
       <include name="*.java"/>
-      <include name="2006/*.java"/>
       <include name="2014/*.java"/>
       <include name="${outdir}/**/*.java"/>
     </srcfiles>
@@ -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 2014/*.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"/>
@@ -218,11 +194,6 @@
 </target>
 
 <target name="all">
-  <antcall target="do.version">
-    <param name="do" value="all.version"/>
-    <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"/>
@@ -231,19 +202,11 @@
   <antcall target="compile">
     <param name="outdir" value="gen"/>
   </antcall>
-  <antcall target="do.version">
-    <param name="do" value="jar.version"/>
-    <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 604b83a..0000000
--- a/compiler/labcomm
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-java -jar /lib/labcomm_compiler.jar "$@"
diff --git a/compiler/labcomm2006 b/compiler/labcomm2006
deleted file mode 100755
index 77c38e8..0000000
--- a/compiler/labcomm2006
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-java -jar /lib/labcomm2006_compiler.jar "$@"
diff --git a/examples/duck_typing/Makefile b/examples/duck_typing/Makefile
index 2587040..4846fa7 100644
--- a/examples/duck_typing/Makefile
+++ b/examples/duck_typing/Makefile
@@ -1,4 +1,4 @@
-LABCOMM_JAR=../../compiler/labcomm_compiler.jar
+LABCOMM_JAR=../../compiler/labcomm2014_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR) 
 
 all: gen/animal.py
diff --git a/examples/dynamic/dynamic.sh b/examples/dynamic/dynamic.sh
index 8700a19..d3f162a 100644
--- a/examples/dynamic/dynamic.sh
+++ b/examples/dynamic/dynamic.sh
@@ -1,24 +1,24 @@
 #dummy script to test the on-the-fly compilation
 
-java -jar ../../compiler/labcomm_compiler.jar --java=gen --javapackage=gen simple.lc
+java -jar ../../compiler/labcomm2014_compiler.jar --java=gen --javapackage=gen simple.lc
 
-javac -cp .:gen:../../lib/java/labcomm.jar gen/*.java
+javac -cp .:gen:../../lib/java/labcomm2014.jar gen/*.java
 
 # compile static encoder and decoder 
-javac -cp .:gen:../../lib/java/labcomm.jar test/StaticEncoder.java
-javac -cp .:gen:../../lib/java/labcomm.jar test/StaticDecoder.java 
+javac -cp .:gen:../../lib/java/labcomm2014.jar test/StaticEncoder.java
+javac -cp .:gen:../../lib/java/labcomm2014.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/labcomm2014_compiler.jar:../../lib/java/labcomm2014.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
 
 # run static encoder 
-java -cp .:gen:../../lib/java//labcomm.jar test.StaticEncoder encoded_data
+java -cp .:gen:../../lib/java//labcomm2014.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/labcomm2014_compiler.jar:../../lib/java/labcomm2014.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 
-java -cp .:gen:../../lib/java//labcomm.jar test.StaticDecoder dynamic_out
+java -cp .:gen:../../lib/java//labcomm2014.jar test.StaticDecoder dynamic_out
diff --git a/examples/dynamic/dynamic_type.sh b/examples/dynamic/dynamic_type.sh
index 0f7fcc1..c1dd07d 100644
--- a/examples/dynamic/dynamic_type.sh
+++ b/examples/dynamic/dynamic_type.sh
@@ -1,24 +1,24 @@
 #dummy script to test the on-the-fly compilation
 
-java -jar ../../compiler/labcomm_compiler.jar --java=gen --javapackage=gen simple.lc
+java -jar ../../compiler/labcomm2014_compiler.jar --java=gen --javapackage=gen simple.lc
 
-javac -cp .:gen:../../lib/java/labcomm.jar gen/*.java
+javac -cp .:gen:../../lib/java/labcomm2014.jar gen/*.java
 
 # compile static encoder and decoder 
-javac -cp .:gen:../../lib/java/labcomm.jar test/StaticEncoder.java
-javac -cp .:gen:../../lib/java/labcomm.jar test/StaticDecoder.java 
+javac -cp .:gen:../../lib/java/labcomm2014.jar test/StaticEncoder.java
+javac -cp .:gen:../../lib/java/labcomm2014.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/labcomm2014_compiler.jar:../../lib/java/labcomm2014.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
 
 # run static encoder 
-java -cp .:gen:../../lib/java//labcomm.jar test.StaticEncoder encoded_data
+java -cp .:gen:../../lib/java//labcomm2014.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_type.lc handlers_type.txt encoded_data dynamic_out
+java -cp .:../../compiler/labcomm2014_compiler.jar:../../lib/java/labcomm2014.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_type.lc handlers_type.txt encoded_data dynamic_out
 
 
 # run static decoder 
-java -cp .:gen:../../lib/java//labcomm.jar test.StaticDecoder dynamic_out
+java -cp .:gen:../../lib/java//labcomm2014.jar test.StaticDecoder dynamic_out
diff --git a/examples/dynamic/static.sh b/examples/dynamic/static.sh
index 361e5fe..ba554bc 100644
--- a/examples/dynamic/static.sh
+++ b/examples/dynamic/static.sh
@@ -2,12 +2,12 @@
 
 # run labcomm compilation
 
-java -jar ../../compiler/labcomm_compiler.jar --java=gen --javapackage=gen simple.lc
+java -jar ../../compiler/labcomm2014_compiler.jar --java=gen --javapackage=gen simple.lc
 
 # compile example programs
-javac -cp .:gen:../../lib/java/labcomm.jar test/StaticEncoder.java
-javac -cp .:gen:../../lib/java/labcomm.jar test/StaticDecoder.java
+javac -cp .:gen:../../lib/java/labcomm2014.jar test/StaticEncoder.java
+javac -cp .:gen:../../lib/java/labcomm2014.jar test/StaticDecoder.java
 
 # run example programs
-java -cp .:gen:../../lib/java//labcomm.jar test.StaticEncoder encoded_data
-java -cp .:gen:../../lib/java//labcomm.jar test.StaticDecoder encoded_data
+java -cp .:gen:../../lib/java//labcomm2014.jar test.StaticEncoder encoded_data
+java -cp .:gen:../../lib/java//labcomm2014.jar test.StaticDecoder encoded_data
diff --git a/examples/dynamic/test.sh b/examples/dynamic/test.sh
index f98bc37..15339f9 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/labcomm2014_compiler.jar:../../lib/java/labcomm2014.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/labcomm2014_compiler.jar:../../lib/java/labcomm2014.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 99b60ea..11d84d6 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/labcomm2014_compiler.jar:../../lib/java/labcomm2014.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/labcomm2014_compiler.jar:../../lib/java/labcomm2014.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 38da6a2..2ae9427 100644
--- a/examples/jgrafchart/Makefile
+++ b/examples/jgrafchart/Makefile
@@ -1,7 +1,7 @@
 LCDIR=../..
-LABCOMM_JAR=../../compiler/labcomm_compiler.jar
+LABCOMM_JAR=../../compiler/labcomm2014_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR) 
-CLASSPATH=.:${LCDIR}/lib/java/labcomm.jar
+CLASSPATH=.:${LCDIR}/lib/java/labcomm2014.jar
 JAVA_PKG=labcommTCPtest
 SAMPLENAME=foo
 LCLIBDIR=${LCDIR}/lib/c
diff --git a/examples/simple/Decoder06.java b/examples/simple/Decoder06.java
deleted file mode 100644
index 86ba718..0000000
--- a/examples/simple/Decoder06.java
+++ /dev/null
@@ -1,83 +0,0 @@
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-
-import se.lth.control.labcomm2006.DecoderChannel;
-
-public class Decoder06
-  implements theTwoInts.Handler, anotherTwoInts.Handler, IntString.Handler, TwoArrays.Handler, TwoFixedArrays.Handler
-
-{
-
-  DecoderChannel decoder;
-
-  public Decoder06(InputStream in) 
-    throws Exception 
-  {
-    decoder = new DecoderChannel(in);
-    theTwoInts.register(decoder, this);
-    anotherTwoInts.register(decoder, this);
-    IntString.register(decoder, this);
-    TwoArrays.register(decoder, this);
-    TwoFixedArrays.register(decoder, this);
-
-    try {
-      System.out.println("Running decoder.");
-      decoder.run();
-    } catch (java.io.EOFException e) {
-	System.out.println("Decoder reached end of file.");
-    }
-  }
-
-  public void printTwoInts(TwoInts d) throws java.io.IOException {
-    System.out.println("a="+d.a+", b="+d.b);
-  }
-
-  public void handle_theTwoInts(TwoInts d) throws java.io.IOException {
-    System.out.print("Got theTwoInts: ");
-    printTwoInts(d);
-  }
-
-  public void handle_anotherTwoInts(TwoInts d) throws java.io.IOException {
-    System.out.print("Got anotherheTwoInts: ");
-    printTwoInts(d);
-  }
-
-  public void handle_IntString(IntString d) throws java.io.IOException {
-    System.out.println("Got IntString, x="+d.x+", s="+d.s);
-  }
-
-  public void handle_TwoArrays(TwoArrays d) throws java.io.IOException {
-    System.out.println("Got TwoArrays:");
-    for(int i=0; i<d.fixed.length; i++) {
-	System.out.print(d.fixed[i]+" ");
-    }
-    System.out.println();
-    for(int i=0; i<d.variable[0].length; i++) {
-	System.out.print(d.variable[0][i]+" ");
-	System.out.print(d.variable[1][i]+" ");
-    }
-    System.out.println();
-  }
-
-  public void handle_TwoFixedArrays(TwoFixedArrays d) throws java.io.IOException {
-    System.out.println("Got TwoFixedArrays:");
-    for(int i=0; i<d.a.length; i++) {
-	System.out.print(d.a[i]+" ");
-    }
-    System.out.println();
-    for(int i=0; i<d.b[0].length; i++) {
-	System.out.print(d.b[0][i]+" ");
-	System.out.print(d.b[1][i]+" ");
-    }
-    System.out.println();
-  }
-
-
-  public static void main(String[] arg) throws Exception {
-    Decoder06 example = new Decoder06(
-      new FileInputStream(new File(arg[0]))
-    );
-  }
-}
-
diff --git a/examples/simple/Encoder06.java b/examples/simple/Encoder06.java
deleted file mode 100644
index 1da84c8..0000000
--- a/examples/simple/Encoder06.java
+++ /dev/null
@@ -1,62 +0,0 @@
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-
-import se.lth.control.labcomm2006.EncoderChannel;
-
-/**
- * Simple encoder 
- */
-public class Encoder06 
-{
-
-  EncoderChannel encoder;
-
-  public Encoder06(OutputStream out) 
-    throws Exception 
-  {
-    encoder = new EncoderChannel(out);
-    theTwoInts.register(encoder);
-    IntString.register(encoder);
-    TwoArrays.register(encoder);
-  }
-
-  public void doEncode() throws java.io.IOException {
-    TwoInts x = new TwoInts();
-    x.a = 17;
-    x.b = 42;
-
-    IntString y = new IntString();
-    y.x = 37;
-    y.s = "Testing, testing";
-
-    TwoArrays ta = new TwoArrays();
-    ta.fixed = new int[] {14, 25};
-//    ta.variable = new int[][] {{1,2},{0x11,0x12},{0x21,0x22},{0x31,0x32}};
-    ta.variable = new int[][] {{1,2, 3, 4},{0x21,0x22,0x23,0x24}};
-
-    System.out.println("Encoding theTwoInts, a="+x.a+", b="+x.b);
-    theTwoInts.encode(encoder, x);
-
-    System.out.println("Encoding IntString, x="+y.x+", s="+y.s);
-    IntString.encode(encoder, y);
-
-    System.out.println("Encoding TwoArrays");
-    for(int i = 0; i < ta.variable.length; i++) {
-	for(int j=0; j < ta.variable[0].length; j++)
-		System.out.println(ta.variable[i][j]);
-	System.out.println("---");
-    }
-    TwoArrays.encode(encoder, ta);
-  }
-
-
-  public static void main(String[] arg) throws Exception {
-    FileOutputStream fos = new FileOutputStream(arg[0]);
-    Encoder06 example = new Encoder06(fos);
-    example.doEncode();
-    fos.close();
-  }
-
-}
-
diff --git a/examples/simple/Makefile b/examples/simple/Makefile
index e12fb67..1cdf340 100644
--- a/examples/simple/Makefile
+++ b/examples/simple/Makefile
@@ -4,10 +4,7 @@ clean:
 
 distclean:
 	rm -rf gen
-	rm -rf gen06
 	rm -f *.class
 	rm -f example_encoder
-	rm -f example_encoder06
 	rm -f example_decoder
-	rm -f example_decoder06
 	rm -f encoded_data
diff --git a/examples/simple/compile.sh b/examples/simple/compile.sh
index 91c3b76..f9f0db6 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/labcomm2014_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
 
@@ -20,22 +20,3 @@ gcc -Wall -Werror -I . -I ../../lib/c/2014 -L../../lib/c \
     -o example_decoder example_decoder.c gen/simple.c \
     -llabcomm2014 
 
-# 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 
-
-javac -cp ../../lib/java/labcomm2006.jar:. gen06/*.java Encoder06.java Decoder06.java
-
-gcc -Wall -Werror -I.  -I../../lib/c/2006 -L../../lib/c \
-    -o example_encoder06 example_encoder06.c gen06/simple.c \
-    -llabcomm2006
-gcc -Wall -Werror -I . -I ../../lib/c/2006 -L../../lib/c \
-    -o example_decoder06 example_decoder06.c gen06/simple.c \
-    -llabcomm2006 
-
-#gcc -o example_encoder -I . -I ../../lib/c example_encoder.c gen/simple.c ../../lib/c/labcomm.c ../../lib/c/labcomm_fd_reader_writer.c
-
-#gcc -o example_decoder -I . -I ../../lib/c example_decoder.c gen/simple.c ../../lib/c/labcomm.c ../../lib/c/labcomm_fd_reader_writer.c
-
-
diff --git a/examples/simple/example_decoder06.c b/examples/simple/example_decoder06.c
deleted file mode 100644
index 4c48fea..0000000
--- a/examples/simple/example_decoder06.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <labcomm2006_fd_reader.h>
-#include <labcomm2006_default_error_handler.h>
-#include <labcomm2006_default_memory.h>
-#include <labcomm2006_default_scheduler.h>
-#include "gen06/simple.h"
-#include <stdio.h>
-
-static void handle_simple_theTwoInts(simple_TwoInts *v,void *context) {
-  printf("Got theTwoInts. a=%d, b=%d\n", v->a, v->b);
-}
-
-static void handle_simple_anotherTwoInts(simple_TwoInts *v,void *context) {
-  printf("Got anotherTwoInts. a=%d, b=%d\n", v->a, v->b);
-}
-
-static void handle_simple_IntString(simple_IntString *v,void *context) {
-  printf("Got IntString. x=%d, s=%s\n", v->x, v->s);
-}
-
-static void handle_simple_TwoArrays(simple_TwoArrays *d,void *context) {
-  printf("Got TwoArrays:");
-  int i,j;
-    for(i=0; i<2; i++) {
-        printf("%d ",d->fixed.a[i]);
-    }
-    printf("\n");
-    for(i=0; i<2; i++) {
-      for(j=0; j<d->variable.n_1; j++) {
-	printf("%d ",d->variable.a[i *d->variable.n_1 + j]);
-      }
-      printf("\n");
-    }
-    printf("\n");
-}
-
-static void handle_simple_TwoFixedArrays(simple_TwoFixedArrays *d,void *context) {
-  printf("Got TwoFixedArrays:");
-  int i,j;
-    for(i=0; i<2; i++) {
-        printf("%d ",d->a.a[i]);
-    }
-    printf("\n");
-    for(i=0; i<2; i++) {
-      for(j=0; j<3; j++) {
-	printf("%d ",d->b.a[i][j]);
-      }
-      printf("\n");
-    }
-}
-
-int main(int argc, char *argv[]) {
-  int fd;
-  struct labcomm2006_decoder *decoder;
-  void  *context = NULL;
-
-  char *filename = argv[1];
-  printf("C decoder reading from %s\n", filename);
-  fd = open(filename, O_RDONLY);
-  decoder = labcomm2006_decoder_new(labcomm2006_fd_reader_new(
-				labcomm2006_default_memory, fd, 1), 
-				labcomm2006_default_error_handler, 
-				labcomm2006_default_memory,
-				labcomm2006_default_scheduler);
-  if (!decoder) { 
-    printf("Failed to allocate decoder %s:%d\n", __FUNCTION__, __LINE__);
-    return 1;
-  }
-
-  labcomm2006_decoder_register_simple_theTwoInts(decoder, handle_simple_theTwoInts, context);
-  labcomm2006_decoder_register_simple_anotherTwoInts(decoder, handle_simple_anotherTwoInts, context);
-  labcomm2006_decoder_register_simple_IntString(decoder, handle_simple_IntString, context);
-  labcomm2006_decoder_register_simple_TwoArrays(decoder, handle_simple_TwoArrays, context);
-  labcomm2006_decoder_register_simple_TwoFixedArrays(decoder, handle_simple_TwoFixedArrays, context);
-
-  printf("Decoding:\n");
-  labcomm2006_decoder_run(decoder);
-  printf("--- End Of File ---:\n");
-  labcomm2006_decoder_free(decoder);
-
-  return 0;
-}
diff --git a/examples/simple/example_encoder06.c b/examples/simple/example_encoder06.c
deleted file mode 100644
index 32dbc1a..0000000
--- a/examples/simple/example_encoder06.c
+++ /dev/null
@@ -1,85 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <labcomm2006_fd_writer.h>
-#include <labcomm2006_default_error_handler.h>
-#include <labcomm2006_default_memory.h>
-#include <labcomm2006_default_scheduler.h>
-#include "gen06/simple.h"
-#include <stdio.h>
-
-int main(int argc, char *argv[]) {
-  int fd;
-  struct labcomm2006_encoder *encoder;
-
-  char *filename = argv[1];
-  printf("C encoder writing to %s\n", filename);
-  fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-  encoder = labcomm2006_encoder_new(labcomm2006_fd_writer_new(
-				labcomm2006_default_memory, fd, 1), 
-				labcomm2006_default_error_handler, 
-				labcomm2006_default_memory,
-				labcomm2006_default_scheduler);
-  labcomm2006_encoder_register_simple_theTwoInts(encoder);
-  labcomm2006_encoder_register_simple_anotherTwoInts(encoder);
-  labcomm2006_encoder_register_simple_IntString(encoder);
-  simple_IntString is;
-  is.x = 24;
-  is.s = "Hello, LabComm!";
-  printf("Encoding IntString, x=%d, s=%s\n", is.x, is.s);
-  labcomm2006_encode_simple_IntString(encoder, &is);
-
-  simple_theTwoInts ti;
-  ti.a = 13;
-  ti.b = 37;
-  printf("Encoding theTwoInts, a=%d, b=%d\n", ti.a, ti.b);
-  labcomm2006_encode_simple_theTwoInts(encoder, &ti);
-
-  simple_anotherTwoInts ati;
-  ati.a = 23;
-  ati.b = 47;
-  printf("Encoding anotherTwoInts, a=%d, b=%d\n", ati.a, ati.b);
-  labcomm2006_encode_simple_anotherTwoInts(encoder, &ati);
-
-  int foo[20];
-
-  labcomm2006_encoder_register_simple_TwoArrays(encoder);
-
-  simple_TwoArrays ta;
-  ta.fixed.a[0] = 17;
-  ta.fixed.a[1] = 42;
-  ta.variable.n_1 = 10;
-  ta.variable.a = foo;
-  
-  int k;
-  for(k=0; k<20; k++) {
-	foo[k] = k;
-  }
-
-  printf("Encoding TwoArrays...\n");
-  labcomm2006_encode_simple_TwoArrays(encoder, &ta);
-
-  ti.a = 23;
-  ti.b = 47;
-  printf("Encoding theTwoInts, a=%d, b=%d\n", ti.a, ti.b);
-  labcomm2006_encode_simple_theTwoInts(encoder, &ti);
-
-
-  simple_TwoFixedArrays tfa;
-
-  tfa.a.a[0] = 41;
-  tfa.a.a[1] = 42;
-
-  tfa.b.a[0][0] = 51;
-  tfa.b.a[0][1] = 52;
-  tfa.b.a[0][2] = 53;
-  tfa.b.a[1][0] = 61;
-  tfa.b.a[1][1] = 62;
-  tfa.b.a[1][2] = 63;
-
-  printf("Encoding TwoFixedArrays...\n");
-  labcomm2006_encoder_register_simple_TwoFixedArrays(encoder);
-  labcomm2006_encode_simple_TwoFixedArrays(encoder, &tfa);
-
-  return 0;
-}
diff --git a/examples/simple/run.sh b/examples/simple/run.sh
index 750d122..b0351d3 100644
--- a/examples/simple/run.sh
+++ b/examples/simple/run.sh
@@ -17,20 +17,3 @@ java -cp .:../../lib/java/labcomm2014.jar:gen Decoder encoded_data
 echo "running python decoder (from wiki_example):"
 PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm2014
 
-echo
-echo "*******************************************************"
-echo "***   Running C and Java example for version 2006   ***"
-echo "*******************************************************"
-echo
-
-java -cp .:../../lib/java/labcomm2006.jar:gen06 Encoder06 encoded_data06
-./example_decoder06 encoded_data06
-
-PYTHONPATH=../../lib/python:gen ./example_encoder.py encoded_data06 LabComm2006
-java -cp .:../../lib/java/labcomm2006.jar:gen06 Decoder06 encoded_data06
-
-./example_encoder06 encoded_data06
-java -cp .:../../lib/java/labcomm2006.jar:gen06 Decoder06 encoded_data06
-
-echo "running python decoder (from wiki_example):"
-PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data06 LabComm2006
diff --git a/examples/tcp/Makefile b/examples/tcp/Makefile
index ae9a5c4..578bb2f 100644
--- a/examples/tcp/Makefile
+++ b/examples/tcp/Makefile
@@ -1,7 +1,7 @@
 LCDIR=../..
-LABCOMM_JAR=../../compiler/labcomm_compiler.jar
+LABCOMM_JAR=../../compiler/labcomm2014_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR)
-LCLJAR=${LCDIR}/lib/java/labcomm.jar  # the LabComm library
+LCLJAR=${LCDIR}/lib/java/labcomm2014.jar  # the LabComm library
 JAVA_PKG=labcommTCPtest
 
 .PHONY : clean run runserver runOSserver runclient
@@ -21,7 +21,7 @@ ${LABCOMM_JAR} :
 	cd ${LCDIR} && make make-compiler
 
 ${LCLJAR} :
-	cd ${LCDIR}/lib/java && make labcomm.jar
+	cd ${LCDIR}/lib/java && make labcomm2014.jar
 
 ${JAVA_PKG}/gen/FooSample.java: test.lc ${LCCJAR}
 	${LABCOMM} --javapackage=${JAVA_PKG}.gen --java=${JAVA_PKG}/gen $<
diff --git a/examples/twoway/Makefile b/examples/twoway/Makefile
index cad00ed..4421404 100644
--- a/examples/twoway/Makefile
+++ b/examples/twoway/Makefile
@@ -1,7 +1,7 @@
 UNAME_S=$(shell uname -s)
 
 TARGETS=client server
-LABCOMM_JAR=../../compiler/labcomm_compiler.jar
+LABCOMM_JAR=../../compiler/labcomm2014_compiler.jar
 LABCOMM=java -jar $(LABCOMM_JAR) 
 
 CFLAGS=-O3 -g -Wall -Werror -I../../lib/c/2014 -I. -Wno-unused-function
diff --git a/examples/user_types/Makefile b/examples/user_types/Makefile
index 3edbeea..4c2c91b 100644
--- a/examples/user_types/Makefile
+++ b/examples/user_types/Makefile
@@ -47,7 +47,7 @@ ExampleDecoder.exe: ExampleDecoder.cs gen/test.cs labcomm2014.dll Makefile
 
 build : 
 	mkdir -p ${GENDIR}
-	java -jar ${LCDIR}/compiler/labcomm_compiler.jar --java=${GENDIR} --c=${GENDIR}/test.c --h=${GENDIR}/test.h  --python=${GENDIR}/test.py --cs=${GENDIR}/test.cs test.lc 
+	java -jar ${LCDIR}/compiler/labcomm2014_compiler.jar --java=${GENDIR} --c=${GENDIR}/test.c --h=${GENDIR}/test.h  --python=${GENDIR}/test.py --cs=${GENDIR}/test.cs test.lc 
 
 	javac -cp ${LCDIR}/lib/java/labcomm2014.jar:. ${GENDIR}/*.java Encoder.java Decoder.java
 	javac -cp ${LCDIR}/lib/java/labcomm2014.jar:${LCCJAR}:${GENDIR}:. TDDecoder.java
diff --git a/examples/wiki_example/run b/examples/wiki_example/run
index 276d46b..770c656 100755
--- a/examples/wiki_example/run
+++ b/examples/wiki_example/run
@@ -16,9 +16,9 @@ gcc -Wall -Werror -o example_encoder -I../../lib/c/2014 \
     example.c \
     ../../lib/c/liblabcomm2014.a || exit 1
 
-javac -cp ../../lib/java/labcomm.jar:. *.java || exit 1
+javac -cp ../../lib/java/labcomm2014.jar:. *.java || exit 1
 
 # Run through all executables (c->java->Python)
 ./example_encoder one two || exit 1
-java -cp ../../lib/java/labcomm.jar:. example_decoder_encoder example.encoded example.javaencoded || exit 1
+java -cp ../../lib/java/labcomm2014.jar:. example_decoder_encoder example.encoded example.javaencoded || exit 1
 PYTHONPATH=../../lib/python ./example_decoder.py example.javaencoded || exit 1
diff --git a/lib/c/2006/Makefile b/lib/c/2006/Makefile
deleted file mode 100644
index 6ad51a6..0000000
--- a/lib/c/2006/Makefile
+++ /dev/null
@@ -1,151 +0,0 @@
-## Macros
-VERSION=2006
-LIBVERSION=2006
-
-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)_fd_writer.o \
-     labcomm$(VERSION)_pthread_scheduler.o 
-
-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 $@ $^
-
-# 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) \
-		--ver=$(VERSION) \
-		--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/2006/labcomm2006.c b/lib/c/2006/labcomm2006.c
deleted file mode 100644
index badfe47..0000000
--- a/lib/c/2006/labcomm2006.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
-  labcomm.c -- runtime for handling encoding and decoding of
-               labcomm 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 "labcomm2006.h"
-#include "labcomm2006_private.h"
-#include "labcomm2006_ioctl.h"
-#include "labcomm2006_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 labcomm2006_reader_alloc(struct labcomm2006_reader *r, 
-                         struct labcomm2006_reader_action_context *action_context)
-{
-  UNWRAP(alloc, r, action_context);
-}
-
-int labcomm2006_reader_free(struct labcomm2006_reader *r, 
-                        struct labcomm2006_reader_action_context *action_context)
-{
-  UNWRAP(free, r, action_context);
-}
-
-int labcomm2006_reader_start(struct labcomm2006_reader *r, 
-                         struct labcomm2006_reader_action_context *action_context,
-			 int local_index, int remote_index,
-			  const struct labcomm2006_signature *signature,
-			 void *value)
-{
-  UNWRAP(start, r, action_context, local_index, remote_index, signature, value);
-}
-
-int labcomm2006_reader_end(struct labcomm2006_reader *r, 
-                       struct labcomm2006_reader_action_context *action_context)
-{
-  UNWRAP(end, r, action_context);
-}
-
-int labcomm2006_reader_fill(struct labcomm2006_reader *r, 
-                        struct labcomm2006_reader_action_context *action_context)
-{
-  UNWRAP(fill, r, action_context);
-}
-
-int labcomm2006_reader_ioctl(struct labcomm2006_reader *r, 
-                             struct labcomm2006_reader_action_context *action_context,
-                             int local_index, int remote_index,
-                             const struct labcomm2006_signature *signature, 
-                             uint32_t ioctl_action, va_list args)
-{
-  UNWRAP(ioctl, r, action_context, 
-	 local_index, remote_index, signature, ioctl_action, args);
-}
-
-int labcomm2006_writer_alloc(struct labcomm2006_writer *w, 
-                         struct labcomm2006_writer_action_context *action_context)
-{
-  UNWRAP(alloc, w, action_context);
-}
-
-int labcomm2006_writer_free(struct labcomm2006_writer *w, 
-                        struct labcomm2006_writer_action_context *action_context)
-{
-  UNWRAP(free, w, action_context);
-}
-
-int labcomm2006_writer_start(struct labcomm2006_writer *w, 
-                         struct labcomm2006_writer_action_context *action_context,
-                         int index, const struct labcomm2006_signature *signature,
-                         void *value)
-{
-  UNWRAP(start, w, action_context, index, signature, value);
-}
-
-int labcomm2006_writer_end(struct labcomm2006_writer *w, 
-                       struct labcomm2006_writer_action_context *action_context)
-{
-  UNWRAP(end, w, action_context);
-} 
-
-int labcomm2006_writer_flush(struct labcomm2006_writer *w, 
-                         struct labcomm2006_writer_action_context *action_context)
-{
-  UNWRAP(flush, w, action_context);
-} 
-
-int labcomm2006_writer_ioctl(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)
-{
-  UNWRAP(ioctl, w, action_context, index, signature, ioctl_action, args);
-} 
-
-#undef UNWRAP
-#undef UNWRAP_ac
-
-
-
-
-static const char *labcomm2006_error_string[] = { 
-#define LABCOMM2006_ERROR(name, description) description ,
-#include "labcomm2006_error.h"
-#undef LABCOMM2006_ERROR
-};
-static const int labcomm2006_error_string_count = (sizeof(labcomm2006_error_string) / 
-					       sizeof(labcomm2006_error_string[0]));
-
-
-const char *labcomm2006_error_get_str(enum labcomm2006_error error_id)
-{
-  const char *error_str = NULL;
-  // Check if this is a known error ID.
-  if (error_id < labcomm2006_error_string_count) {
-    error_str = labcomm2006_error_string[error_id];
-  }
-  return error_str;
-}
-
-#ifndef LABCOMM_NO_STDIO
-void labcomm2006_on_error_fprintf(enum labcomm2006_error error_id, size_t nbr_va_args, ...)
-{
-  const char *err_msg = labcomm2006_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 labcomm can't be compiled with stdio the user will have to make an own error callback functionif he/she needs error reporting.
-  #error Define LABCOMM2006_ON_ERROR_FPRINTF
-#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 *labcomm2006_signature_array_ref(struct labcomm2006_memory *memory,
-				  int *first, int *last, void **data,
-				  int size, int index)
-{
-  if (*first == 0 && *last == 0) {
-    *first = index;
-    *last = index + 1;
-    *data = labcomm2006_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 = labcomm2006_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);
-    labcomm2006_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 labcomm2006_set_local_index(struct labcomm2006_signature *signature)
-{
-  if (signature->index != 0) {
-    labcomm2006_error_fatal_global(LABCOMM2006_ERROR_SIGNATURE_ALREADY_SET,
-                                   "Signature already set: %s", signature->name);
-  }
-  signature->index = local_index;
-  local_index++;
-}
-
-int labcomm2006_get_local_index(const struct labcomm2006_signature *signature)
-{
-  if (signature->index == 0) {
-    labcomm2006_error_fatal_global(LABCOMM2006_ERROR_SIGNATURE_NOT_SET,
-                                   "Signature not set: %s", signature->name);
-  }
-  return signature->index;
-}
-
-int labcomm2006_internal_sizeof(const struct labcomm2006_signature *signature,
-                            void *v)
-{
-  int length = signature->encoded_size(v);
-  return (labcomm2006_size_packed32(signature->index) +
-          length);
-}
diff --git a/lib/c/2006/labcomm2006.h b/lib/c/2006/labcomm2006.h
deleted file mode 100644
index 9958b17..0000000
--- a/lib/c/2006/labcomm2006.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-  labcomm2006.h -- user interface for handling encoding and decoding of
-               labcomm 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 __LABCOMM2006_H__
-#define __LABCOMM2006_H__
-
-#include <stdarg.h>
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#else
-  #include <stdint.h>
-  #include <unistd.h>
-#endif
-
-#include "labcomm2006_error.h"
-#include "labcomm2006_scheduler.h"
-
-/* Forward declaration */
-struct labcomm2006_encoder;
-struct labcomm2006_decoder;
-
-/*
- * Signature entry
- */
-struct labcomm2006_signature {
-  char *name;
-  int (*encoded_size)(void *); /* void* refers to sample_data */
-  int size;
-  unsigned char *signature; 
-  int index;
-#ifdef LABCOMM_EXPERIMENTAL_CACHED_ENCODED_SIZE
-  int cached_encoded_size; // -1 if not initialized or type is variable size
-#endif
-};
-
-/*
- * 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 (*labcomm2006_error_handler_callback)(enum labcomm2006_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 labcomm2006_on_error_fprintf(enum labcomm2006_error error_id, size_t nbr_va_args, ...);
-
-/* Register a callback for the error handler for this encoder. */
-void labcomm2006_register_error_handler_encoder(struct labcomm2006_encoder *encoder, labcomm2006_error_handler_callback callback);
-
-/* Register a callback for the error handler for this decoder. */
-void labcomm2006_register_error_handler_decoder(struct labcomm2006_decoder *decoder, labcomm2006_error_handler_callback callback);
-
-/* Get a string describing the supplied standrad labcomm error. */
-const char *labcomm2006_error_get_str(enum labcomm2006_error error_id);
-
-typedef int (*labcomm2006_handle_new_datatype_callback)(
-  struct labcomm2006_decoder *decoder,
-  struct labcomm2006_signature *sig);
-
-void labcomm2006_decoder_register_new_datatype_handler(struct labcomm2006_decoder *d,
-		labcomm2006_handle_new_datatype_callback on_new_datatype);
-
-/*
- * 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 labcomm2006_memory;
-
-void *labcomm2006_memory_alloc(struct labcomm2006_memory *m, int lifetime, size_t size);
-void *labcomm2006_memory_realloc(struct labcomm2006_memory *m, int lifetime, 
-			     void *ptr, size_t size);
-void labcomm2006_memory_free(struct labcomm2006_memory *m, int lifetime, void *ptr);
-
-/*
- * Decoder
- */
-struct labcomm2006_reader;
-
-struct labcomm2006_decoder *labcomm2006_decoder_new(
-  struct labcomm2006_reader *reader,
-  struct labcomm2006_error_handler *error,
-  struct labcomm2006_memory *memory,
-  struct labcomm2006_scheduler *scheduler);
-void labcomm2006_decoder_free(
-  struct labcomm2006_decoder *decoder);
-int labcomm2006_decoder_decode_one(
-  struct labcomm2006_decoder *decoder);
-void labcomm2006_decoder_run(
-  struct labcomm2006_decoder *decoder);
-
-/* See labcomm2006_ioctl.h for predefined ioctl_action values */
-int labcomm2006_decoder_ioctl(struct labcomm2006_decoder *decoder, 
-			  uint32_t ioctl_action,
-			  ...);
-
-/*
- * Encoder
- */
-struct labcomm2006_writer;
-
-struct labcomm2006_encoder *labcomm2006_encoder_new(
-  struct labcomm2006_writer *writer,
-  struct labcomm2006_error_handler *error,
-  struct labcomm2006_memory *memory,
-  struct labcomm2006_scheduler *scheduler);
-void labcomm2006_encoder_free(
-  struct labcomm2006_encoder *encoder);
-
-/* See labcomm2006_ioctl.h for predefined ioctl_action values */
-int labcomm2006_encoder_ioctl(struct labcomm2006_encoder *encoder, 
-			  uint32_t ioctl_action,
-			  ...);
-
-#define LABCOMM_VOID ((void*)1)
-
-#endif
diff --git a/lib/c/2006/labcomm2006_decoder.c b/lib/c/2006/labcomm2006_decoder.c
deleted file mode 100644
index 2ae181d..0000000
--- a/lib/c/2006/labcomm2006_decoder.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
-  labcomm2006_decoder.c -- runtime for handling decoding of labcomm 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/>.
-*/
-#include <errno.h>
-#include "labcomm2006.h"
-#include "labcomm2006_private.h"
-#include "labcomm2006_ioctl.h"
-#include "labcomm2006_dynamic_buffer_writer.h"
-
-struct sample_entry {
-  int remote_index;
-  const struct labcomm2006_signature *signature;
-  labcomm2006_decoder_function decode;
-  labcomm2006_handler_function handler;
-  void *context;
-};
-
-struct labcomm2006_decoder {
-  struct labcomm2006_reader *reader;
-  int reader_allocated;
-  struct labcomm2006_error_handler *error;
-  struct labcomm2006_memory *memory;
-  struct labcomm2006_scheduler *scheduler;
-  labcomm2006_error_handler_callback on_error;
-  labcomm2006_handle_new_datatype_callback on_new_datatype;
-  LABCOMM_SIGNATURE_ARRAY_DEF(local, struct sample_entry);
-  LABCOMM_SIGNATURE_ARRAY_DEF(remote_to_local, int);
-};
-
-struct labcomm2006_decoder *labcomm2006_decoder_new(
-  struct labcomm2006_reader *reader,
-  struct labcomm2006_error_handler *error,
-  struct labcomm2006_memory *memory,
-  struct labcomm2006_scheduler *scheduler)
-{
-  struct labcomm2006_decoder *result;
-
-  result = labcomm2006_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->error = error;
-    result->memory = memory;
-    result->scheduler = scheduler;
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->local, struct sample_entry);
-    LABCOMM_SIGNATURE_ARRAY_INIT(result->remote_to_local, int);
-  }
-  return result;
-}
-
-void labcomm2006_decoder_free(struct labcomm2006_decoder* d)
-{
-  struct labcomm2006_memory *memory = d->memory;
-
-  labcomm2006_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);
-  labcomm2006_memory_free(memory, 0, d);
-}
-
-static int collect_flat_signature(
-  struct labcomm2006_decoder *decoder,
-  struct labcomm2006_writer *writer)
-{
-  int result, type;
-
-  type = labcomm2006_read_packed32(decoder->reader); 
-  result = decoder->reader->error;
-  if (result < 0) { goto out; }
-  if (type >= LABCOMM_USER) {
-    decoder->on_error(LABCOMM2006_ERROR_UNIMPLEMENTED_FUNC, 3,
-			"Implement %s ... (1) for type 0x%x\n", __FUNCTION__, type);
-  } else {
-    labcomm2006_write_packed32(writer, type); 
-    switch (type) {
-      case LABCOMM_ARRAY: {
-	int dimensions, i;
-
-	dimensions = labcomm2006_read_packed32(decoder->reader);
-	labcomm2006_write_packed32(writer, dimensions);
-	for (i = 0 ; i < dimensions ; i++) {
-	  int n = labcomm2006_read_packed32(decoder->reader);
-	  labcomm2006_write_packed32(writer, n);
-	}
-	result = collect_flat_signature(decoder, writer);
-	if (result < 0) { goto out; }
-      } break;
-      case LABCOMM_STRUCT: {
-	int fields, i;
-
-	fields = labcomm2006_read_packed32(decoder->reader); 
-	labcomm2006_write_packed32(writer, fields); 
-	for (i = 0 ; i < fields ; i++) {
-	  char *name = labcomm2006_read_string(decoder->reader);
-	  labcomm2006_write_string(writer, name);
-	  labcomm2006_memory_free(decoder->memory, 1, name);
-	  result = collect_flat_signature(decoder, writer);
-	  if (result < 0) { goto out; }
-	}
-      } break;
-      case LABCOMM_BOOLEAN:
-      case LABCOMM_BYTE:
-      case LABCOMM_SHORT:
-      case LABCOMM_INT:
-      case LABCOMM_LONG:
-      case LABCOMM_FLOAT:
-      case LABCOMM_DOUBLE:
-      case LABCOMM_STRING: {
-      } break;
-      default: {
-	result = -ENOSYS;
-        decoder->on_error(LABCOMM2006_ERROR_UNIMPLEMENTED_FUNC, 3,
-				"Implement %s (2) for type 0x%x...\n", __FUNCTION__, type);
-      } break;
-    }
-  }
-out:
-  return result;
-}
-
-static int writer_ioctl(struct labcomm2006_writer *writer,
-			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 = labcomm2006_writer_ioctl(writer, writer->action_context, 
-				0, NULL, action, va);
-  va_end(va);
-out:
-  return result;
-}
-
-static int decode_typedef_or_sample(struct labcomm2006_decoder *d, int kind)
-{
-  int result;
-
-  /* TODO: should the labcomm2006_dynamic_buffer_writer be 
-     a permanent part of labcomm2006_decoder? */
-  struct labcomm2006_writer_action_context action_context = {
-    .next = NULL,
-    .action = labcomm2006_dynamic_buffer_writer_action,
-    .context = NULL
-  };
-  struct labcomm2006_writer writer = {
-    .action_context = &action_context,
-    .memory = d->memory,
-    .data = NULL,
-    .data_size = 0,
-    .count = 0,
-    .pos = 0,
-    .error = 0,
-  };
-  struct labcomm2006_signature signature;
-  const struct labcomm2006_signature *local_signature;
-  int remote_index, local_index, err;
-  
-  local_signature = NULL;
-  local_index = 0;
-  labcomm2006_writer_alloc(&writer, writer.action_context);
-  labcomm2006_writer_start(&writer, writer.action_context, 0, NULL, NULL);
-  remote_index = labcomm2006_read_packed32(d->reader);
-  signature.name = labcomm2006_read_string(d->reader);
-  collect_flat_signature(d, &writer);
-  labcomm2006_writer_end(&writer, writer.action_context);
-  err = writer_ioctl(&writer, 
-		     LABCOMM_IOCTL_WRITER_GET_BYTES_WRITTEN,
-		     &signature.size);
-  if (err < 0) {
-    fprintf(stderr, "Failed to get size: %s\n", strerror(-err));
-    result = -ENOENT;
-    goto free_signature_name;
-  }
-  err = writer_ioctl(&writer, 
-		     LABCOMM_IOCTL_WRITER_GET_BYTE_POINTER,
-		     &signature.signature);
-  if (err < 0) {
-    fprintf(stderr, "Failed to get pointer: %s\n", strerror(-err));
-    result = -ENOENT;
-    goto free_signature_name;
-  }
-  {
-    int i;
-
-    labcomm2006_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;
-      }
-    }
-    labcomm2006_scheduler_data_unlock(d->scheduler);
-    if (local_signature) {
-      labcomm2006_reader_start(d->reader, d->reader->action_context,
-			   local_index, remote_index, local_signature,
-			   NULL);
-      labcomm2006_reader_end(d->reader, d->reader->action_context);
-    }
-  }
-#if 0
-  if (! entry) {
-    /* Unknown datatype, bail out */
-    d->on_new_datatype(d, &signature);
-    result = -ENOENT;
-  } else if (entry->index && entry->index != remote_index) {
-    d->on_error(LABCOMM2006_ERROR_DEC_INDEX_MISMATCH, 5, 
-		"%s(): index mismatch '%s' (id=0x%x != 0x%x)\n", 
-		__FUNCTION__, signature.name, entry->index, remote_index);
-    result = -ENOENT;
-#endif
-free_signature_name:
-  labcomm2006_memory_free(d->memory, 0, signature.name);
-  labcomm2006_writer_free(&writer, writer.action_context);
-  return result;
-}
-
-struct call_handler_context {
-  struct labcomm2006_reader *reader;
-  int local_index;
-  int remote_index;
-  const struct labcomm2006_signature *signature;
-  labcomm2006_handler_function handler;
-  void *context;
-};
-
-static void call_handler(void *value, void *context)
-{
-  struct call_handler_context *wrap = context;
-
-  if (wrap->reader->error >= 0) {
-    labcomm2006_reader_start(wrap->reader, wrap->reader->action_context,
-			 wrap->local_index, wrap->remote_index, wrap->signature,
-			 value);
-    wrap->handler(value, wrap->context);
-    labcomm2006_reader_end(wrap->reader, wrap->reader->action_context);
-  }
-}
-
-static void reader_alloc(struct labcomm2006_decoder *d)
-{
-  if (!d->reader_allocated) {
-    d->reader_allocated = 1;
-    labcomm2006_reader_alloc(d->reader, d->reader->action_context);
-  }
-}
-
-int labcomm2006_decoder_decode_one(struct labcomm2006_decoder *d)
-{
-  int result, remote_index;
-
-  reader_alloc(d);
-  remote_index = labcomm2006_read_packed32(d->reader);
-  if (d->reader->error < 0) {
-    result = d->reader->error;
-    goto out;
-  }
-  if (remote_index == LABCOMM_SAMPLE) {
-    result = decode_typedef_or_sample(d, remote_index); 
-  } else {
-    int *local_index;
-    struct call_handler_context wrap = {
-      .reader = d->reader,
-      .remote_index = remote_index,
-      .signature = NULL,
-      .handler = NULL,
-      .context = NULL,
-    };
-    labcomm2006_decoder_function do_decode = NULL;
-
-    labcomm2006_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;
-      result = *local_index;
-    }
-    labcomm2006_scheduler_data_unlock(d->scheduler);
-    if (do_decode) {
-      do_decode(d->reader, call_handler, &wrap);
-      if (d->reader->error < 0) {
-	result = d->reader->error;
-      }
-    } else {
-      result = -ENOENT;
-    }
-  }
-out:
-  return result;
-}
-
-void labcomm2006_decoder_run(struct labcomm2006_decoder *d)
-{
-  while (labcomm2006_decoder_decode_one(d) > 0) {
-  }
-}
-
-int labcomm2006_decoder_ioctl(struct labcomm2006_decoder *d, 
-			  uint32_t action,
-			  ...)
-{
-  int result;  
-  va_list va;
-    
-  va_start(va, action);
-  result = labcomm2006_reader_ioctl(d->reader, 
-				d->reader->action_context,
-				0, 0, NULL, action, va);
-  va_end(va);
-  return result;
-}
-
-int labcomm2006_internal_decoder_ioctl(struct labcomm2006_decoder *d, 
-				   const struct labcomm2006_signature *signature,
-				   uint32_t action, va_list va)
-{
-  int result;
-  int local_index, remote_index;
-
-  local_index = labcomm2006_get_local_index(signature);
-  labcomm2006_scheduler_data_lock(d->scheduler);
-  remote_index = LABCOMM_SIGNATURE_ARRAY_REF(d->memory,
-					     d->local,
-					     struct sample_entry,
-					     local_index)->remote_index;
-  labcomm2006_scheduler_data_unlock(d->scheduler);
-  result = labcomm2006_reader_ioctl(d->reader, d->reader->action_context,
-				local_index, remote_index, 
-				signature, action, va);
-  return result;
-}
-
-int labcomm2006_internal_decoder_register(
-  struct labcomm2006_decoder *d,
-  const struct labcomm2006_signature *signature,
-  labcomm2006_decoder_function decode, 
-  labcomm2006_handler_function handler,
-  void *context)
-{
-  int local_index;
-  struct sample_entry *entry;
- 
-  reader_alloc(d);
-  local_index = labcomm2006_get_local_index(signature);
-  if (local_index <= 0) { goto out; }
-  labcomm2006_reader_start(d->reader, d->reader->action_context,
-		       local_index, 0, signature,
-		       NULL);
-  labcomm2006_reader_end(d->reader, d->reader->action_context);
-
-  labcomm2006_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:
-  labcomm2006_scheduler_data_unlock(d->scheduler);
-out:
-  return local_index;
-}
-
diff --git a/lib/c/2006/labcomm2006_default_error_handler.c b/lib/c/2006/labcomm2006_default_error_handler.c
deleted file mode 100644
index ad8acd3..0000000
--- a/lib/c/2006/labcomm2006_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 "labcomm2006.h"
-
-struct labcomm2006_error_handler *labcomm2006_default_error_handler = NULL;
diff --git a/lib/c/2006/labcomm2006_default_error_handler.h b/lib/c/2006/labcomm2006_default_error_handler.h
deleted file mode 100644
index b00d988..0000000
--- a/lib/c/2006/labcomm2006_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 __LABCOMM2006_DEFAULT_ERROR_HANDLER_H__
-#define __LABCOMM2006_DEFAULT_ERROR_HANDLER_H__
-
-#include "labcomm2006.h"
-
-extern struct labcomm2006_error_handler *labcomm2006_default_error_handler;
-
-#endif
diff --git a/lib/c/2006/labcomm2006_default_memory.c b/lib/c/2006/labcomm2006_default_memory.c
deleted file mode 100644
index 85a9ee0..0000000
--- a/lib/c/2006/labcomm2006_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 "labcomm2006.h"
-#include "labcomm2006_private.h"
-
-void *default_alloc2006(struct labcomm2006_memory *m, int lifetime, size_t size)
-{
-  return malloc(size);
-}
-
-void *default_realloc2006(struct labcomm2006_memory *m, int lifetime, 
-		      void *ptr, size_t size)
-{
-  return realloc(ptr, size);
-}
-
-void default_free2006(struct labcomm2006_memory *m, int lifetime, void *ptr)
-{
-  free(ptr);
-}
-
-struct labcomm2006_memory memory2006 = {
-  .alloc = default_alloc2006,
-  .realloc = default_realloc2006,
-  .free = default_free2006,
-  .context = NULL
-};
-
-struct labcomm2006_memory *labcomm2006_default_memory = &memory2006;
diff --git a/lib/c/2006/labcomm2006_default_memory.h b/lib/c/2006/labcomm2006_default_memory.h
deleted file mode 100644
index ba36988..0000000
--- a/lib/c/2006/labcomm2006_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 __LABCOMM2006_DEFAULT_MEMORY_H__
-#define __LABCOMM2006_DEFAULT_MEMORY_H__
-
-#include <stdlib.h>
-#include "labcomm2006.h"
-
-extern struct labcomm2006_memory *labcomm2006_default_memory;
-
-#endif
diff --git a/lib/c/2006/labcomm2006_default_scheduler.c b/lib/c/2006/labcomm2006_default_scheduler.c
deleted file mode 100644
index 5db88cd..0000000
--- a/lib/c/2006/labcomm2006_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 "labcomm2006_default_scheduler.h"
-#include "labcomm2006_scheduler.h"
-#include "labcomm2006_scheduler_private.h"
-
-static int scheduler_free(struct labcomm2006_scheduler *s)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return 0;
-}
- 
-static int scheduler_writer_lock(struct labcomm2006_scheduler *s)
-{
-  return 0;
-}
- 
-static int scheduler_writer_unlock(struct labcomm2006_scheduler *s)
-{
-  return 0;
-}
-
-static int scheduler_data_lock(struct labcomm2006_scheduler *s)
-{
-  return 0;
-}
- 
-static int scheduler_data_unlock(struct labcomm2006_scheduler *s)
-{
-  return 0;
-}
-
-static struct labcomm2006_time *scheduler_now(struct labcomm2006_scheduler *s)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return NULL;
-}
- 
-static int scheduler_sleep(struct labcomm2006_scheduler *s,
-			   struct labcomm2006_time *t)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return 0;
-}
-
-static int scheduler_wakeup(struct labcomm2006_scheduler *s)
-{
-  fprintf(stderr, "%s:%d %s %s", __FILE__, __LINE__, __FUNCTION__,
-	  "not implemented");
-  exit(1);
-  return 0;
-}
-
-static int scheduler_enqueue(struct labcomm2006_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 labcomm2006_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 labcomm2006_scheduler scheduler = {
-  .action = &scheduler_action,
-  .context = NULL
-};
-
-struct labcomm2006_scheduler *labcomm2006_default_scheduler = &scheduler;
diff --git a/lib/c/2006/labcomm2006_default_scheduler.h b/lib/c/2006/labcomm2006_default_scheduler.h
deleted file mode 100644
index becd936..0000000
--- a/lib/c/2006/labcomm2006_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 __LABCOMM2006_DEFAULT_SCHEDULER_H__
-#define __LABCOMM2006_DEFAULT_SCHEDULER_H__
-
-#include "labcomm2006.h"
-
-extern struct labcomm2006_scheduler *labcomm2006_default_scheduler;
-
-#endif
diff --git a/lib/c/2006/labcomm2006_dynamic_buffer_writer.c b/lib/c/2006/labcomm2006_dynamic_buffer_writer.c
deleted file mode 100644
index d9e2bbe..0000000
--- a/lib/c/2006/labcomm2006_dynamic_buffer_writer.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-  labcomm2006_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 "labcomm2006.h"
-#include "labcomm2006_private.h"
-#include "labcomm2006_ioctl.h"
-#include "labcomm2006_dynamic_buffer_writer.h"
-
-static int dyn_alloc(struct labcomm2006_writer *w, 
-		     struct labcomm2006_writer_action_context *action_context)
-{
-  w->data_size = 1000;
-  w->count = w->data_size;
-  w->data = labcomm2006_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 labcomm2006_writer *w, 
-		    struct labcomm2006_writer_action_context *action_context)
-{
-  labcomm2006_memory_free(w->memory, 1, w->data);
-  w->data = 0;
-  w->data_size = 0;
-  w->count = 0;
-  w->pos = 0;
-  labcomm2006_memory_free(w->memory, 0, action_context->context);
-  return 0;
-}
-
-static int dyn_start(struct labcomm2006_writer *w, 
-		     struct labcomm2006_writer_action_context *action_context,
-		     int index,
-		     const struct labcomm2006_signature *signature,
-		     void *value)
-{
-  void *tmp;
-
-  w->data_size = 1000;
-  w->count = w->data_size;
-  tmp = labcomm2006_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 labcomm2006_writer *w, 
-		   struct labcomm2006_writer_action_context *action_context)
-{
-  return 0;
-}
-
-static int dyn_flush(struct labcomm2006_writer *w, 
-		     struct labcomm2006_writer_action_context *action_context)
-{
-  void *tmp;
-
-  w->data_size += 1000;
-  w->count = w->data_size;
-  tmp = labcomm2006_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 labcomm2006_writer *w, 
-		     struct labcomm2006_writer_action_context *action_context, 
-		     int signature_index,
-		     const struct labcomm2006_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 labcomm2006_writer_action action = {
-  .alloc = dyn_alloc,
-  .free = dyn_free,
-  .start = dyn_start,
-  .end = dyn_end,
-  .flush = dyn_flush,
-  .ioctl = dyn_ioctl
-};
-const struct labcomm2006_writer_action *labcomm2006_dynamic_buffer_writer_action = 
-  &action;
-
-struct labcomm2006_writer *labcomm2006_dynamic_buffer_writer_new(
-  struct labcomm2006_memory *memory)
-{
-  struct result {
-    struct labcomm2006_writer writer;
-    struct labcomm2006_writer_action_context action_context;
-  } *result;
-
-  result = labcomm2006_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/2006/labcomm2006_dynamic_buffer_writer.h b/lib/c/2006/labcomm2006_dynamic_buffer_writer.h
deleted file mode 100644
index 3611640..0000000
--- a/lib/c/2006/labcomm2006_dynamic_buffer_writer.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  labcomm2006_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 __LABCOMM2006_DYNAMIC_BUFFER_READER_WRITER_H__
-#define __LABCOMM2006_DYNAMIC_BUFFER_READER_WRITER_H__
-
-#include "labcomm2006.h"
-
-extern const struct labcomm2006_writer_action *labcomm2006_dynamic_buffer_writer_action;
-
-struct labcomm2006_writer *labcomm2006_dynamic_buffer_writer_new(
-  struct labcomm2006_memory *memory);
-
-#endif
diff --git a/lib/c/2006/labcomm2006_encoder.c b/lib/c/2006/labcomm2006_encoder.c
deleted file mode 100644
index 4eb8eca..0000000
--- a/lib/c/2006/labcomm2006_encoder.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-  labcomm2006_encoder.c -- handling encoding of labcomm 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/>.
-*/
-#include <errno.h>
-#include "labcomm2006.h"
-#include "labcomm2006_private.h"
-#include "labcomm2006_ioctl.h"
-
-struct labcomm2006_encoder {
-  struct labcomm2006_writer *writer;
-  struct labcomm2006_error_handler *error;
-  struct labcomm2006_memory *memory;
-  struct labcomm2006_scheduler *scheduler;
-  LABCOMM_SIGNATURE_ARRAY_DEF(registered, int);
-};
-
-struct labcomm2006_encoder *labcomm2006_encoder_new(
-  struct labcomm2006_writer *writer,
-  struct labcomm2006_error_handler *error,
-  struct labcomm2006_memory *memory,
-  struct labcomm2006_scheduler *scheduler)
-{
-  struct labcomm2006_encoder *result;
-
-  result = labcomm2006_memory_alloc(memory, 0, sizeof(*result));
-  if (result) {
-    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);
-    labcomm2006_writer_alloc(result->writer,
-			 result->writer->action_context);
-  }
-  return result;
-}
-
-void labcomm2006_encoder_free(struct labcomm2006_encoder* e)
-{
-  struct labcomm2006_memory *memory = e->memory;
-
-  labcomm2006_writer_free(e->writer, e->writer->action_context);
-  LABCOMM_SIGNATURE_ARRAY_FREE(e->memory, e->registered, int);
-  labcomm2006_memory_free(memory, 0, e);
-}
-
-int labcomm2006_internal_encoder_register(
-  struct labcomm2006_encoder *e,
-  const struct labcomm2006_signature *signature,
-  labcomm2006_encoder_function encode)
-{
-  int result = -EINVAL;
-  int index, *done, err, i;
-
-  index = labcomm2006_get_local_index(signature);
-  labcomm2006_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 = labcomm2006_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; }
-  labcomm2006_write_packed32(e->writer, LABCOMM_SAMPLE);
-  labcomm2006_write_packed32(e->writer, index);
-  labcomm2006_write_string(e->writer, signature->name);
-  for (i = 0 ; i < signature->size ; i++) {
-    if (e->writer->pos >= e->writer->count) {
-      labcomm2006_writer_flush(e->writer, e->writer->action_context);
-    }
-    e->writer->data[e->writer->pos] = signature->signature[i];
-    e->writer->pos++;
-  }
-  labcomm2006_writer_end(e->writer, e->writer->action_context);
-  result = e->writer->error;
-out:
-  labcomm2006_scheduler_writer_unlock(e->scheduler);
-  return result;
-}
-
-int labcomm2006_internal_encode(
-  struct labcomm2006_encoder *e,
-  const struct labcomm2006_signature *signature,
-  labcomm2006_encoder_function encode,
-  void *value)
-{
-  int result;
-  int index;
-
-  index = labcomm2006_get_local_index(signature);
-  labcomm2006_scheduler_writer_lock(e->scheduler);
-  result = labcomm2006_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 = labcomm2006_write_packed32(e->writer, index);
-  if (result != 0) { goto out; }
-  result = encode(e->writer, value);
-out:
-  labcomm2006_writer_end(e->writer, e->writer->action_context);
-no_end:
-  labcomm2006_scheduler_writer_unlock(e->scheduler);
-  return result;
-}
-
-int labcomm2006_encoder_ioctl(struct labcomm2006_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 = labcomm2006_writer_ioctl(encoder->writer, 
-			       encoder->writer->action_context,
-			       0, NULL, action, va);
-  va_end(va);
-
-out:
-  return result;
-}
-
-int labcomm2006_internal_encoder_ioctl(struct labcomm2006_encoder *encoder, 
-                                       const struct labcomm2006_signature *signature,
-                                       uint32_t action, va_list va)
-{
-  int result = -ENOTSUP;
-  int index;
-
-  index = labcomm2006_get_local_index(signature);
-  result = labcomm2006_writer_ioctl(encoder->writer, 
-				encoder->writer->action_context, 
-				index, signature, action, va);
-  return result;
-}
diff --git a/lib/c/2006/labcomm2006_error.c b/lib/c/2006/labcomm2006_error.c
deleted file mode 100644
index 079c812..0000000
--- a/lib/c/2006/labcomm2006_error.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  labcomm2006_error.c -- labcomm 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 "labcomm2006_error.h"
- 
-void labcomm2006_error_fatal_global(enum labcomm2006_error error,
-				char *format,
-				...)
-{
-  fprintf(stderr, "Fatal error %d\n", error);
-  exit(1);
-}
diff --git a/lib/c/2006/labcomm2006_error.h b/lib/c/2006/labcomm2006_error.h
deleted file mode 100644
index 526545e..0000000
--- a/lib/c/2006/labcomm2006_error.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-  labcomm2006_error.h -- labcomm 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 __LABCOMM2006_ERROR_H__
-#define __LABCOMM2006_ERROR_H__
-
-enum labcomm2006_error {
-#define LABCOMM2006_ERROR(name, description) name ,
-#include "labcomm2006_error.h"
-#undef LABCOMM2006_ERROR
-};
-
-struct labcomm2006_error_handler;
-
-void labcomm2006_error_warning(struct labcomm2006_error_handler *e,
-			   enum labcomm2006_error,
-			   char *format,
-			   ...);
-			 
-void labcomm2006_error_fatal_global(enum labcomm2006_error error,
-				char *format,
-				...);
-			 
-#endif
-
-#ifdef LABCOMM2006_ERROR
-
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_SIGNATURE_ALREADY_SET,
-                  "Signature has already been set")
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_SIGNATURE_NOT_SET,
-                  "Signature has not been set")
-
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_ENC_NO_REG_SIGNATURE,
-                  "Encoder has no registration for this signature")
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_ENC_BUF_FULL,
-                  "The labcomm buffer is full")
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_DEC_UNKNOWN_DATATYPE,
-                  "Decoder: Unknown datatype")
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_DEC_INDEX_MISMATCH,
-                  "Decoder: index mismatch")
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_DEC_TYPE_NOT_FOUND,
-                  "Decoder: type not found")
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_UNIMPLEMENTED_FUNC,
-                  "This function is not yet implemented")
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_MEMORY,
-                  "Could not allocate memory")
-LABCOMM2006_ERROR(LABCOMM2006_ERROR_USER_DEF,
-                  "User defined error")
-
-#endif
diff --git a/lib/c/2006/labcomm2006_fd_reader.c b/lib/c/2006/labcomm2006_fd_reader.c
deleted file mode 100644
index 4269563..0000000
--- a/lib/c/2006/labcomm2006_fd_reader.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-  labcomm2006_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 "labcomm2006_private.h"
-#include "labcomm2006_fd_reader.h"
-
-#define BUFFER_SIZE 2048
-
-struct labcomm2006_fd_reader {
-  struct labcomm2006_reader reader;
-  struct labcomm2006_reader_action_context action_context;
-  int fd;
-  int close_fd_on_free;
-};
-
-static int fd_alloc(struct labcomm2006_reader *r,
-		    struct labcomm2006_reader_action_context *action_context)
-{
-  int result = 0;
-  
-  r->count = 0;
-  r->pos = 0;
-  r->data = labcomm2006_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 labcomm2006_reader *r, 
-		   struct labcomm2006_reader_action_context *action_context)
-{
-  struct labcomm2006_fd_reader *fd_reader = action_context->context;
-  struct labcomm2006_memory *memory = r->memory;
-
-  labcomm2006_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);
-  }
-  labcomm2006_memory_free(memory, 0, fd_reader);
-
-  return 0;
-}
-
-static int fd_fill(struct labcomm2006_reader *r, 
-		   struct labcomm2006_reader_action_context *action_context)
-{
-  int result = 0;
-  struct labcomm2006_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 labcomm2006_reader_action action = {
-  .alloc = fd_alloc,
-  .free = fd_free,
-  .start = NULL,
-  .fill = fd_fill,
-  .end = NULL,
-  .ioctl = NULL
-};
-
-struct labcomm2006_reader *labcomm2006_fd_reader_new(struct labcomm2006_memory *memory,
-					     int fd, int close_fd_on_free)
-{
-  struct labcomm2006_fd_reader *result;
-
-  result = labcomm2006_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/2006/labcomm2006_fd_reader.h b/lib/c/2006/labcomm2006_fd_reader.h
deleted file mode 100644
index 408bf9f..0000000
--- a/lib/c/2006/labcomm2006_fd_reader.h
+++ /dev/null
@@ -1,32 +0,0 @@
-
-/*
-  labcomm2006_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 __LABCOMM2006_FD_READER_H__
-#define __LABCOMM2006_FD_READER_H__
-
-#include "labcomm2006.h"
-
-struct labcomm2006_reader *labcomm2006_fd_reader_new(struct labcomm2006_memory *memory,
-					     int fd, int close_fd_on_free);
-
-#endif
-
diff --git a/lib/c/2006/labcomm2006_fd_writer.c b/lib/c/2006/labcomm2006_fd_writer.c
deleted file mode 100644
index a763db6..0000000
--- a/lib/c/2006/labcomm2006_fd_writer.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
-  labcomm2006_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 "labcomm2006_private.h"
-#include "labcomm2006_fd_writer.h"
-
-#define BUFFER_SIZE 2048
-
-struct labcomm2006_fd_writer {
-  struct labcomm2006_writer writer;
-  struct labcomm2006_writer_action_context action_context;
-  int fd;
-  int close_fd_on_free;
-};
-
-static int fd_flush(struct labcomm2006_writer *w, 
-		    struct labcomm2006_writer_action_context *action_context);
-
-static int fd_alloc(struct labcomm2006_writer *w, 
-		    struct labcomm2006_writer_action_context *action_context)
-{
-    w->data = labcomm2006_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 labcomm2006_writer *w, 
-		   struct labcomm2006_writer_action_context *action_context)
-{
-  struct labcomm2006_fd_writer *fd_writer = action_context->context;
-  struct labcomm2006_memory *memory = w->memory;
-
-  labcomm2006_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);
-  }
-  labcomm2006_memory_free(memory, 0, fd_writer);
-  return 0;
-}
-
-static int fd_start(struct labcomm2006_writer *w, 
-		    struct labcomm2006_writer_action_context *action_context,
-		    int index,
-		    const struct labcomm2006_signature *signature,
-		    void *value)
-{
-  w->pos = 0;
-  
-  return w->error;
-}
-
-static int fd_flush(struct labcomm2006_writer *w, 
-		    struct labcomm2006_writer_action_context *action_context)
-{
-  struct labcomm2006_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 labcomm2006_writer_action action = {
-  .alloc = fd_alloc,
-  .free = fd_free,
-  .start = fd_start,
-  .end = fd_flush,
-  .flush = fd_flush,
-  .ioctl = NULL
-};
-
-struct labcomm2006_writer *labcomm2006_fd_writer_new(struct labcomm2006_memory *memory,
-					     int fd, int close_fd_on_free)
-{
-  struct labcomm2006_fd_writer *result;
-
-  result = labcomm2006_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/2006/labcomm2006_fd_writer.h b/lib/c/2006/labcomm2006_fd_writer.h
deleted file mode 100644
index 8df9d08..0000000
--- a/lib/c/2006/labcomm2006_fd_writer.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-  labcomm2006_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 __LABCOMM2006_FD_WRITER_H__
-#define __LABCOMM2006_FD_WRITER_H__
-
-#include "labcomm2006.h"
-
-struct labcomm2006_writer *labcomm2006_fd_writer_new(struct labcomm2006_memory *memory,
-					     int fd, int close_on_free);
-
-#endif
-
diff --git a/lib/c/2006/labcomm2006_ioctl.h b/lib/c/2006/labcomm2006_ioctl.h
deleted file mode 100644
index 3fabcd2..0000000
--- a/lib/c/2006/labcomm2006_ioctl.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-  labcomm2006_ioctl.h -- labcomm 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 __LABCOMM2006_IOCTL_H__
-#define __LABCOMM2006_IOCTL_H__
-
-#include "labcomm2006.h"
-
-/*
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | |   |                         |               |               |  
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *  | |   |                         |               |
- *  | |   |                         |               +- number    (8)
- *  | |   |                         +----------------- type      (8)
- *  | |   +------------------------------------------- size      (13)
- *  | +----------------------------------------------- direction (2)
- *  +------------------------------------------------- signature (1)
- *  
- * type 0-31     are reserved for labcomm 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/2006/labcomm2006_memory.c b/lib/c/2006/labcomm2006_memory.c
deleted file mode 100644
index 67b51e3..0000000
--- a/lib/c/2006/labcomm2006_memory.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-  labcomm2006_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 "labcomm2006_private.h"
-
-void *labcomm2006_memory_alloc(struct labcomm2006_memory *m, int lifetime, 
-			   size_t size) 
-{
-  return m->alloc(m, lifetime, size);
-}
-
-void *labcomm2006_memory_realloc(struct labcomm2006_memory *m, int lifetime, 
-			     void *ptr, size_t size) 
-{
-  return m->realloc(m, lifetime, ptr, size);
-}
-
-void labcomm2006_memory_free(struct labcomm2006_memory *m, int lifetime, 
-			 void *ptr)
-{
-  m->free(m, lifetime, ptr);
-}
diff --git a/lib/c/2006/labcomm2006_private.h b/lib/c/2006/labcomm2006_private.h
deleted file mode 100644
index c3bd51d..0000000
--- a/lib/c/2006/labcomm2006_private.h
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
-  labcomm2006_private.h -- semi private declarations for handling encoding and 
-                       decoding of labcomm 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 __LABCOMM2006_PRIVATE_H__
-#define __LABCOMM2006_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 "labcomm2006.h"
-
-/*
- * Predeclared aggregate type indices
- */
-#define LABCOMM_SAMPLE   0x02
-#define LABCOMM_ARRAY    0x10
-#define LABCOMM_STRUCT   0x11
-#define LABCOMM_USER     0x40   /* ..0xffffffff */
-
-/*
- * 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
-
-/*
- * Macro to automagically call constructors in modules compiled 
- * with the labcomm 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 labcomm2006_memory {
-  void *(*alloc)(struct labcomm2006_memory *m, int lifetime, size_t size);
-  void *(*realloc)(struct labcomm2006_memory *m, int lifetime, 
-		   void *ptr, size_t size);
-  void (*free)(struct labcomm2006_memory *m, int lifetime, void *ptr);
-  void *context;
-};
-
-/*
- * Semi private decoder declarations
- */
-typedef void (*labcomm2006_handler_function)(void *value, void *context);
-
-typedef void (*labcomm2006_decoder_function)(
-  struct labcomm2006_reader *r,
-  labcomm2006_handler_function handler,
-  void *context);
-
-struct labcomm2006_reader_action_context;
-
-struct labcomm2006_reader_action {
-  /* 'alloc' is called at the first invocation of 'labcomm2006_decoder_decode_one' 
-     on the decoder containing the reader.
-
-     Returned value:
-       >  0    Number of bytes allocated for buffering
-       <= 0    Error
-  */
-  int (*alloc)(struct labcomm2006_reader *r, 
-	       struct labcomm2006_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 labcomm2006_reader *r, 
-	      struct labcomm2006_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 labcomm2006_reader *r, 
-	       struct labcomm2006_reader_action_context *action_context,
-	       int local_index, int remote_index,
-	       const struct labcomm2006_signature *signature,
-	       void *value);
-  int (*end)(struct labcomm2006_reader *r, 
-	     struct labcomm2006_reader_action_context *action_context);
-  int (*fill)(struct labcomm2006_reader *r, 
-	      struct labcomm2006_reader_action_context *action_context);
-  int (*ioctl)(struct labcomm2006_reader *r, 
-	       struct labcomm2006_reader_action_context *action_context,
-	       int local_index, int remote_index,
-	       const struct labcomm2006_signature *signature, 
-	       uint32_t ioctl_action, va_list args);
-};
-
-struct labcomm2006_reader_action_context {
-  struct labcomm2006_reader_action_context *next;
-  const struct labcomm2006_reader_action *action;
-  void *context;  
-};
-
-struct labcomm2006_reader {
-  struct labcomm2006_reader_action_context *action_context;
-  struct labcomm2006_memory *memory;
-  /* The following fields are initialized by labcomm2006_decoder_new */
-  struct labcomm2006_decoder *decoder;
-  unsigned char *data;
-  int data_size;
-  int count;
-  int pos;
-  int error;
-};
-
-int labcomm2006_reader_alloc(struct labcomm2006_reader *r, 
-                             struct labcomm2006_reader_action_context *action_context);
-int labcomm2006_reader_free(struct labcomm2006_reader *r, 
-                            struct labcomm2006_reader_action_context *action_context);
-int labcomm2006_reader_start(struct labcomm2006_reader *r, 
-                             struct labcomm2006_reader_action_context *action_context,
-                             int local_index, int remote_index,
-                             const struct labcomm2006_signature *signature,
-                             void *value);
-int labcomm2006_reader_end(struct labcomm2006_reader *r, 
-                           struct labcomm2006_reader_action_context *action_context);
-int labcomm2006_reader_fill(struct labcomm2006_reader *r, 
-                            struct labcomm2006_reader_action_context *action_context);
-int labcomm2006_reader_ioctl(struct labcomm2006_reader *r, 
-                             struct labcomm2006_reader_action_context *action_context,
-                             int local_index, int remote_index,
-                             const struct labcomm2006_signature *signature, 
-                             uint32_t ioctl_action, va_list args);
-
-/*
- * Non typesafe registration function to be called from
- * generated labcomm2006_decoder_register_* functions.
- */
-int labcomm2006_internal_decoder_register(
-  struct labcomm2006_decoder *d, 
-  const struct labcomm2006_signature *s, 
-  labcomm2006_decoder_function decoder,
-  labcomm2006_handler_function handler,
-  void *context);
-
-int labcomm2006_internal_decoder_ioctl(struct labcomm2006_decoder *decoder, 
-                                       const struct labcomm2006_signature *signature,
-                                       uint32_t ioctl_action, va_list args);
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define LABCOMM_DECODE(name, type)					\
-  static inline type labcomm2006_read_##name(struct labcomm2006_reader *r) {	\
-    type result; int i;							\
-    for (i = sizeof(type) - 1 ; i >= 0 ; i--) {				\
-      if (r->pos >= r->count) {						\
-	labcomm2006_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 labcomm2006_read_##name(struct labcomm2006_reader *r) {	\
-    type result; int i;							\
-    for (i = 0 ; i < sizeof(type) ; i++) {				\
-      if (r->pos >= r->count) {						\
-	labcomm2006_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)
-
-// compatibility with 2014 version
-#define labcomm2006_read_packed32 labcomm2006_read_int
-
-static inline char *labcomm2006_read_string(struct labcomm2006_reader *r)
-{
-  char *result = NULL;
-  int length, pos; 
-  
-  length = labcomm2006_read_packed32(r);
-  result = labcomm2006_memory_alloc(r->memory, 1, length + 1);
-  if (!result) {
-    labcomm2006_on_error_fprintf(LABCOMM2006_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) {	
-      labcomm2006_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 (*labcomm2006_encoder_function)(struct labcomm2006_writer *,
-                                            void *value);
-struct labcomm2006_writer_action_context;
-
-struct labcomm2006_writer_action {
-  int (*alloc)(struct labcomm2006_writer *w, 
-	       struct labcomm2006_writer_action_context *action_context);
-  int (*free)(struct labcomm2006_writer *w, 
-	      struct labcomm2006_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 labcomm2006_writer *w, 
-	       struct labcomm2006_writer_action_context *action_context,
-	       int index, const struct labcomm2006_signature *signature,
-	       void *value);
-  int (*end)(struct labcomm2006_writer *w, 
-	     struct labcomm2006_writer_action_context *action_context);
-  int (*flush)(struct labcomm2006_writer *w, 
-	       struct labcomm2006_writer_action_context *action_context); 
-  int (*ioctl)(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 labcomm2006_writer_action_context {
-  struct labcomm2006_writer_action_context *next;
-  const struct labcomm2006_writer_action *action;
-  void *context;  
-};
-
-struct labcomm2006_writer {
-  struct labcomm2006_writer_action_context *action_context;
-  struct labcomm2006_memory *memory;
-  /* The following fields are initialized by labcomm2006_encoder_new */
-  struct labcomm2006_encoder *encoder;
-  unsigned char *data;
-  int data_size;
-  int count;
-  int pos;
-  int error;
-};
-
-int labcomm2006_writer_alloc(struct labcomm2006_writer *w, 
-			 struct labcomm2006_writer_action_context *action_context);
-int labcomm2006_writer_free(struct labcomm2006_writer *w, 
-			struct labcomm2006_writer_action_context *action_context);
-int labcomm2006_writer_start(struct labcomm2006_writer *w, 
-			 struct labcomm2006_writer_action_context *action_context,
-			 int index, const struct labcomm2006_signature *signature,
-			 void *value);
-int labcomm2006_writer_end(struct labcomm2006_writer *w, 
-		       struct labcomm2006_writer_action_context *action_context);
-int labcomm2006_writer_flush(struct labcomm2006_writer *w, 
-			 struct labcomm2006_writer_action_context *action_context); 
-int labcomm2006_writer_ioctl(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);
-
-int labcomm2006_internal_encoder_register(
-  struct labcomm2006_encoder *encoder, 
-  const struct labcomm2006_signature *signature, 
-  labcomm2006_encoder_function encode);
-
-int labcomm2006_internal_encode(
-  struct labcomm2006_encoder *encoder, 
-  const struct labcomm2006_signature *signature, 
-  labcomm2006_encoder_function encode,
-  void *value);
-
-int labcomm2006_internal_encoder_ioctl(struct labcomm2006_encoder *encoder, 
-                                       const struct labcomm2006_signature *signature,
-                                       uint32_t ioctl_action, va_list args);
-
-int labcomm2006_internal_sizeof(const struct labcomm2006_signature *signature,
-                                void *v);
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define LABCOMM_ENCODE(name, type)					\
-  static inline int labcomm2006_write_##name(struct labcomm2006_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 = labcomm2006_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 labcomm2006_write_##name(struct labcomm2006_writer *w, type data) { \
-    int i;								\
-    for (i = 0 ; i < sizeof(type) ; i++) {				\
-      if (w->pos >= w->count) {						\
-        int err;							\
-	err = labcomm2006_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)
-
-#define labcomm2006_write_packed32 labcomm2006_write_int
-
-#if 0
-static inline int labcomm2006_write_packed32(struct labcomm2006_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 = labcomm2006_writer_flush(w, w->action_context);	
-      if (err != 0) { return err; }
-    }
-    w->data[w->pos++] = tmp[i] | (i?0x80:0x00);
-  }
-  return 0;
-}
-#endif
-
-static inline int labcomm2006_write_string(struct labcomm2006_writer *w, char *s)
-{
-  int length, i, err; 
-
-  length = strlen((char*)s);
-  err = labcomm2006_write_packed32(w, length);
-  if (err != 0) { return err; }
-  for (i = 0 ; i < length ; i++) {
-    if (w->pos >= w->count) {	
-      int err;
-      err = labcomm2006_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 is 4 as we use int*/
-static inline int labcomm2006_size_packed32(unsigned int data)
-{
-  return 4;
-}
-
-/*
- * 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) { labcomm2006_memory_free(memory, 0, name.data); }	\
-  name.data = (kind *)NULL; /* typechecking */
-
-void *labcomm2006_signature_array_ref(struct labcomm2006_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 *)(labcomm2006_signature_array_ref(memory,				\
-					&name.first, &name.last,	\
-					(void **)&name.data,		\
-					sizeof(kind), index)))
-
-#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 labcomm2006_set_local_index(struct labcomm2006_signature *signature);
-
-/* Get the local index for a signature */
-int labcomm2006_get_local_index(const struct labcomm2006_signature *s);
-
-#endif
diff --git a/lib/c/2006/labcomm2006_pthread_scheduler.c b/lib/c/2006/labcomm2006_pthread_scheduler.c
deleted file mode 100644
index e69ca14..0000000
--- a/lib/c/2006/labcomm2006_pthread_scheduler.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
-  labcomm2006_pthread_scheduler.c -- labcomm 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 "labcomm2006.h"
-#include "labcomm2006_scheduler.h"
-#include "labcomm2006_scheduler_private.h"
-#include "labcomm2006_pthread_scheduler.h"
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#endif 
-
-struct pthread_time {
-  struct labcomm2006_time time;
-  struct labcomm2006_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 labcomm2006_scheduler scheduler;
-  struct labcomm2006_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 labcomm2006_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 labcomm2006_time *time_new(struct labcomm2006_memory *memory)
-{
-  struct pthread_time *time;
-
-  time = labcomm2006_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 labcomm2006_time *t)
-{
-  struct pthread_time *time = t->context;
-  struct labcomm2006_memory *memory = time->memory;
-  
-  labcomm2006_memory_free(memory, 0, time);
-  
-  return 0;
-}
- 
-static int time_add_usec(struct labcomm2006_time *t, uint32_t usec)
-{
-  struct pthread_time *time = t->context;
-
-  timespec_add_usec(&time->abstime, usec);
-
-  return 0;
-}
-
-static struct labcomm2006_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;
-  labcomm2006_scheduler_data_unlock(&scheduler->scheduler);
-  element->action(element->context);
-  labcomm2006_memory_free(scheduler->memory, 1, element);
-  labcomm2006_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 labcomm2006_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-  struct labcomm2006_memory *memory = scheduler->memory;
-  
-  labcomm2006_memory_free(memory, 0, scheduler);
-
-  return 0;
-}
- 
-static int scheduler_writer_lock(struct labcomm2006_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  labcomm2006_scheduler_data_lock(&scheduler->scheduler);
-  run_deferred(scheduler);  /* Run deferred tasks before taking lock */
-  labcomm2006_scheduler_data_unlock(&scheduler->scheduler);
-  if (pthread_mutex_lock(&scheduler->writer_mutex) != 0) {
-    return -errno;
-  }
-  return 0;
-}
- 
-static int scheduler_writer_unlock(struct labcomm2006_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  if (pthread_mutex_unlock(&scheduler->writer_mutex) != 0) {
-    return -errno;
-  }
-  labcomm2006_scheduler_data_lock(&scheduler->scheduler);
-  run_deferred(scheduler);  /* Run deferred tasks after releasing lock */
-  labcomm2006_scheduler_data_unlock(&scheduler->scheduler);
-  
-  return 0;
-}
-
-static int scheduler_data_lock(struct labcomm2006_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 labcomm2006_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 labcomm2006_time *scheduler_now(struct labcomm2006_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  return time_new(scheduler->memory);
-}
- 
-static int scheduler_sleep(struct labcomm2006_scheduler *s,
-			   struct labcomm2006_time *t)
-{
-  struct pthread_scheduler *scheduler = s->context;
-  struct pthread_time *time = t?t->context:NULL;
-
-  labcomm2006_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);
-    }
-  }
-  labcomm2006_scheduler_data_unlock(&scheduler->scheduler);
-  
-  return 0;
-}
-
-static int scheduler_wakeup(struct labcomm2006_scheduler *s)
-{
-  struct pthread_scheduler *scheduler = s->context;
-
-  labcomm2006_scheduler_data_lock(&scheduler->scheduler);
-  scheduler->wakeup = 1;
-  pthread_cond_signal(&scheduler->data_cond);
-  labcomm2006_scheduler_data_unlock(&scheduler->scheduler);
-  return 0;
-}
-
-static int scheduler_enqueue(struct labcomm2006_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 = labcomm2006_memory_alloc(scheduler->memory, 1, sizeof(*element));
-  if (element == NULL) {
-    result = -ENOMEM;
-    goto out;
-  }
-  
-  element->action = deferred;
-  element->context = context;
-  labcomm2006_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);
-  labcomm2006_scheduler_data_unlock(&scheduler->scheduler);
-
-out:
-  return result;
-}
-
-static const struct labcomm2006_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 labcomm2006_scheduler *labcomm2006_pthread_scheduler_new(
-  struct labcomm2006_memory *memory)
-{
-  struct labcomm2006_scheduler *result = NULL;
-  struct pthread_scheduler *scheduler;
-
-  scheduler = labcomm2006_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:
-  labcomm2006_memory_free(memory, 0, scheduler);
-out:
-  return result;
-  
-}
-
diff --git a/lib/c/2006/labcomm2006_pthread_scheduler.h b/lib/c/2006/labcomm2006_pthread_scheduler.h
deleted file mode 100644
index ab22b21..0000000
--- a/lib/c/2006/labcomm2006_pthread_scheduler.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-  labcomm2006_pthread_scheduler.h -- labcomm 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 __LABCOMM2006_PTHREAD_SCHEDULER_H__
-#define __LABCOMM2006_PTHREAD_SCHEDULER_H__
-
-#include "labcomm2006.h"
-
-struct labcomm2006_scheduler *labcomm2006_pthread_scheduler_new(
-  struct labcomm2006_memory *memory);
-
-#endif
-
diff --git a/lib/c/2006/labcomm2006_scheduler.c b/lib/c/2006/labcomm2006_scheduler.c
deleted file mode 100644
index bf2b04f..0000000
--- a/lib/c/2006/labcomm2006_scheduler.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-  labcomm2006_scheduler.c -- labcomm 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 "labcomm2006_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 labcomm2006_scheduler_free(struct labcomm2006_scheduler *s)
-{
-  SCHEDULER(free, s);
-}
-
-int labcomm2006_scheduler_writer_lock(struct labcomm2006_scheduler *s)
-{
-  SCHEDULER(writer_lock, s);
-}
-
-int labcomm2006_scheduler_writer_unlock(struct labcomm2006_scheduler *s)
-{
-  SCHEDULER(writer_unlock, s);
-}
-
-int labcomm2006_scheduler_data_lock(struct labcomm2006_scheduler *s)
-{
-  SCHEDULER(data_lock, s);
-}
-
-int labcomm2006_scheduler_data_unlock(struct labcomm2006_scheduler *s)
-{
-  SCHEDULER(data_unlock, s);
-}
-
-struct labcomm2006_time *labcomm2006_scheduler_now(struct labcomm2006_scheduler *s)
-{
-  if (s && s->action->now) {
-    return s->action->now(s); 
-  } 
-  return NULL;
-}
-
-int labcomm2006_scheduler_sleep(struct labcomm2006_scheduler *s,
-			    struct labcomm2006_time *wakeup)
-{
-  SCHEDULER(sleep, s, wakeup);
-}
-
-int labcomm2006_scheduler_wakeup(struct labcomm2006_scheduler *s)
-{
-  SCHEDULER(wakeup, s);
-}
-
-int labcomm2006_scheduler_enqueue(struct labcomm2006_scheduler *s,
-			      uint32_t delay,
-			      void (*func)(void *context),
-			      void *context)
-{
-  SCHEDULER(enqueue, s, delay, func, context);
-}
-
-
diff --git a/lib/c/2006/labcomm2006_scheduler.h b/lib/c/2006/labcomm2006_scheduler.h
deleted file mode 100644
index 0c332c1..0000000
--- a/lib/c/2006/labcomm2006_scheduler.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-  labcomm2006_scheduler.h -- labcomm 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 __LABCOMM2006_SCHEDULER_H__
-#define __LABCOMM2006_SCHEDULER_H__
-
-#ifdef LABCOMM_COMPAT
-  #include LABCOMM_COMPAT
-#else
-  #include <unistd.h>
-  #include <stdint.h>
-#endif
-
-struct labcomm2006_time;
-
-int labcomm2006_time_free(struct labcomm2006_time *t);
-int labcomm2006_time_add_usec(struct labcomm2006_time *t, uint32_t usec);
-
-struct labcomm2006_scheduler;
-
-int labcomm2006_scheduler_free(struct labcomm2006_scheduler *s);
-
-/* Lock and event handling */
-int labcomm2006_scheduler_writer_lock(struct labcomm2006_scheduler *s);
-int labcomm2006_scheduler_writer_unlock(struct labcomm2006_scheduler *s);
-int labcomm2006_scheduler_data_lock(struct labcomm2006_scheduler *s);
-int labcomm2006_scheduler_data_unlock(struct labcomm2006_scheduler *s);
-
-/* Time handling */
-struct labcomm2006_time *labcomm2006_scheduler_now(struct labcomm2006_scheduler *s);
-int labcomm2006_scheduler_sleep(struct labcomm2006_scheduler *s,
-			    struct labcomm2006_time *wakeup);
-int labcomm2006_scheduler_wakeup(struct labcomm2006_scheduler *s);
-
-/* Deferred action handling */
-int labcomm2006_scheduler_enqueue(struct labcomm2006_scheduler *s,
-			      uint32_t delay,
-			      void (*deferred)(void *context),
-			      void *context);
-
-#endif
-
diff --git a/lib/c/2006/labcomm2006_scheduler_private.h b/lib/c/2006/labcomm2006_scheduler_private.h
deleted file mode 100644
index f6f9555..0000000
--- a/lib/c/2006/labcomm2006_scheduler_private.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-  labcomm2006_scheduler.h -- labcomm 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 __LABCOMM2006_SCHEDULER_PRIVATE_H__
-#define __LABCOMM2006_SCHEDULER_PRIVATE_H__
-
-#ifdef LABCOMM_COMPAT
- #include LABCOMM_COMPAT
-#else
- #include <unistd.h>
-#endif
-
-#include "labcomm2006_scheduler.h"
-
-struct labcomm2006_time {
-  const struct labcomm2006_time_action {
-    int (*free)(struct labcomm2006_time *t);
-    int (*add_usec)(struct labcomm2006_time *t, uint32_t usec);
-  } *action;
-  void *context;
-};
-
-struct labcomm2006_scheduler {
-  const struct labcomm2006_scheduler_action {
-    int (*free)(struct labcomm2006_scheduler *s);
-    int (*writer_lock)(struct labcomm2006_scheduler *s);
-    int (*writer_unlock)(struct labcomm2006_scheduler *s);
-    int (*data_lock)(struct labcomm2006_scheduler *s);
-    int (*data_unlock)(struct labcomm2006_scheduler *s);
-    struct labcomm2006_time *(*now)(struct labcomm2006_scheduler *s);
-    int (*sleep)(struct labcomm2006_scheduler *s,
-		 struct labcomm2006_time *wakeup);
-    int (*wakeup)(struct labcomm2006_scheduler *s);
-    int (*enqueue)(struct labcomm2006_scheduler *s,
-		   uint32_t delay,
-		   void (*deferred)(void *context),
-		   void *context);
-  } *action;
-  void *context;
-};
-
-#endif
diff --git a/lib/c/2006/labcomm2006_time.c b/lib/c/2006/labcomm2006_time.c
deleted file mode 100644
index 24fc3c4..0000000
--- a/lib/c/2006/labcomm2006_time.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-  labcomm2006_time.c -- labcomm 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 "labcomm2006_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 labcomm2006_time_free(struct labcomm2006_time *s)
-{
-  TIME(free, s);
-}
-
-int labcomm2006_time_add_usec(struct labcomm2006_time *s, uint32_t usec)
-{
-  TIME(add_usec, s, usec);
-}
-
diff --git a/lib/c/2006/labcomm_compat_arm_cortexm3.h b/lib/c/2006/labcomm_compat_arm_cortexm3.h
deleted file mode 100644
index 512ad36..0000000
--- a/lib/c/2006/labcomm_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/2006/labcomm_compat_osx.h b/lib/c/2006/labcomm_compat_osx.h
deleted file mode 100644
index 1219f3f..0000000
--- a/lib/c/2006/labcomm_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/2006/labcomm_compat_vxworks.h b/lib/c/2006/labcomm_compat_vxworks.h
deleted file mode 100644
index 2918567..0000000
--- a/lib/c/2006/labcomm_compat_vxworks.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __LABCOMM2006_COMPAT_VXWORKS_H__
-#define __LABCOMM2006_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/2006/test/.gitignore b/lib/c/2006/test/.gitignore
deleted file mode 100644
index 4f62b84..0000000
--- a/lib/c/2006/test/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-gen
diff --git a/lib/c/2006/test/another_encoding.lc b/lib/c/2006/test/another_encoding.lc
deleted file mode 100644
index 2c545af..0000000
--- a/lib/c/2006/test/another_encoding.lc
+++ /dev/null
@@ -1,2 +0,0 @@
-sample void V;
-sample byte B;
diff --git a/lib/c/2006/test/cppmacros.h b/lib/c/2006/test/cppmacros.h
deleted file mode 100644
index a3e446b..0000000
--- a/lib/c/2006/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/2006/test/generated_encoding.lc b/lib/c/2006/test/generated_encoding.lc
deleted file mode 100644
index f1f4b9b..0000000
--- a/lib/c/2006/test/generated_encoding.lc
+++ /dev/null
@@ -1,7 +0,0 @@
-sample void V;
-sample byte B;
-sample struct {
-  int i;
-} S1;
-sample int I[_];
-sample struct { int i; } P[_];
diff --git a/lib/c/2006/test/labcomm_mem_reader.c b/lib/c/2006/test/labcomm_mem_reader.c
deleted file mode 100644
index e111433..0000000
--- a/lib/c/2006/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/2006/test/labcomm_mem_reader.h b/lib/c/2006/test/labcomm_mem_reader.h
deleted file mode 100644
index 55b8ea9..0000000
--- a/lib/c/2006/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/2006/test/labcomm_mem_writer.c b/lib/c/2006/test/labcomm_mem_writer.c
deleted file mode 100644
index 4370361..0000000
--- a/lib/c/2006/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/2006/test/labcomm_mem_writer.h b/lib/c/2006/test/labcomm_mem_writer.h
deleted file mode 100644
index 7506342..0000000
--- a/lib/c/2006/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/2006/test/more_types.lc b/lib/c/2006/test/more_types.lc
deleted file mode 100644
index 91fb935..0000000
--- a/lib/c/2006/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/2006/test/test_labcomm.c b/lib/c/2006/test/test_labcomm.c
deleted file mode 100644
index 64a6c9e..0000000
--- a/lib/c/2006/test/test_labcomm.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-  test_labcomm.c -- Various labcomm 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 "labcomm2006_private.h"
-#include "labcomm2006_default_error_handler.h"
-#include "labcomm2006_default_memory.h"
-#include "labcomm2006_default_scheduler.h"
-#include "test/gen/test_sample.h"
-
-static unsigned char buffer[512];
-
-static int writer_alloc(struct labcomm2006_writer *w, 
-			struct labcomm2006_writer_action_context *action_context)
-{
-  w->data = buffer;
-  w->data_size = sizeof(buffer);
-  w->count = sizeof(buffer);
-  
-  return 0;
-}
-static int writer_start(struct labcomm2006_writer *w, 
-                        struct labcomm2006_writer_action_context *action_context,
-                        int index, const struct labcomm2006_signature *signature,
-                        void *value)
-{
-  return 0;
-}
-const struct labcomm2006_writer_action writer_action = {
-  .alloc = writer_alloc,
-  .start = writer_start,
-};
-static struct labcomm2006_writer_action_context writer_action_context = {
-  .next = NULL,
-  .action = &writer_action,
-  .context = NULL
-}; 
-static struct labcomm2006_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 labcomm2006_reader *r, 
-			struct labcomm2006_reader_action_context *action_context)
-{
-  r->data = buffer;
-  r->data_size = sizeof(buffer);
-  r->count = 0;
-  r->memory = labcomm2006_default_memory;
-  
-  return 0;
-}
-static int reader_fill(struct labcomm2006_reader *r, 
-		       struct labcomm2006_reader_action_context *action_context)
-{
-  r->error = -ENOMEM;
-  return r->error;
-}
-const struct labcomm2006_reader_action reader_action = {
-  .alloc = reader_alloc,
-  .fill = reader_fill,
-};
-static struct labcomm2006_reader_action_context reader_action_context = {
-  .next = NULL,
-  .action = &reader_action,
-  .context = NULL
-}; 
-static struct labcomm2006_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 labcomm2006_decoder *decoder)
-{
-  int result;
-
-  for (reader.count = 0 ; reader.count < writer.pos ; reader.count++) {
-    reader.error = 0;
-    reader.pos = 0;
-    result = labcomm2006_decoder_decode_one(decoder); 
-    if (result >= 0 ) {
-      fprintf(stderr, "Got result from buffer with bogus length (%d)\n",
-	      result);
-      exit(1);
-    }
-  }
-  reader.error = 0;
-  reader.pos = 0;
-  reader.count = writer.pos;
-  result = labcomm2006_decoder_decode_one(decoder);
-  if (result < 0) {
-    int i;
-
-    fprintf(stderr, "Got result from buffer with correct length (%d, %d)\n",
-	    result, writer.pos);
-    for (i = 0 ; i < writer.pos ; i++) {
-      fprintf(stderr, "%02x ", buffer[i]);
-    }
-    exit(1);
-  }
-  return result;
-}
-
-static void test_encode_decode(struct labcomm2006_encoder *encoder,
-			       struct labcomm2006_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;
-  labcomm2006_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 != labcomm2006_sizeof_test_sample_test_var(&encoder_var)) {
-    fprintf(stderr, "Incorrect sizeof %u * 2 * %u (%d != %d)\n",
-	    n_0, n_2, 
-	    writer.pos, labcomm2006_sizeof_test_sample_test_var(&encoder_var));
-    exit(1);
-  }
-  if (writer.pos != expected) {
-    fprintf(stderr, "Unexpected size %u * %u (%d != %d)\n",
-	    n_0, n_2, 
-	    writer.pos, expected);
-    exit(1);
-  }
-}
-
-int main(void)
-{
-  int err, i;
-  struct labcomm2006_encoder *encoder = labcomm2006_encoder_new(
-    &writer, 
-    labcomm2006_default_error_handler,
-    labcomm2006_default_memory,
-    labcomm2006_default_scheduler);
-  struct labcomm2006_decoder *decoder = labcomm2006_decoder_new(
-    &reader,
-    labcomm2006_default_error_handler,
-    labcomm2006_default_memory,
-    labcomm2006_default_scheduler);
-  labcomm2006_decoder_register_test_sample_test_var(decoder,
-						handle_test_var, 
-						NULL);
-  labcomm2006_encoder_register_test_sample_test_var(encoder);
-  err = test_decode_one(decoder);
-  fprintf(stderr, "decode of register -> index %d\n", err);
-  test_encode_decode(encoder, decoder, 20, 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, 44, 2, 2);
-  test_encode_decode(encoder, decoder, 12, 0, 0);
-  for (i = 1 ; i <= 4 ; i++) {
-    test_encode_decode(encoder, decoder, 12, 0, (1<<(7*i))-1);
-    test_encode_decode(encoder, decoder, 12, 0, (1<<(7*i)));
-  }
-  test_encode_decode(encoder, decoder, 12, 0, 4294967295);
-  return 0;
-}
diff --git a/lib/c/2006/test/test_labcomm_basic_type_encoding.c b/lib/c/2006/test/test_labcomm_basic_type_encoding.c
deleted file mode 100644
index f6582e2..0000000
--- a/lib/c/2006/test/test_labcomm_basic_type_encoding.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-  test_labcomm_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 "labcomm2006_private.h"
-
-static int line;
-
-static unsigned char buffer[128];
-
-static struct labcomm2006_writer writer =  {
-  .action_context = NULL,
-  .data = buffer,
-  .data_size = sizeof(buffer),
-  .count = sizeof(buffer),
-  .pos = 0,
-  .error = 0,
-};
-
-static struct labcomm2006_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;							\
-    labcomm2006_write_##ltype(&writer, value);				\
-    writer_assert(#ltype, expect_count, (uint8_t*)expect_bytes);	\
-    reader.count = writer.pos;						\
-    reader.pos = 0;							\
-    decoded = labcomm2006_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", 0x00000000, 4, "\x00\x00\x00\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x0000007f, 4, "\x00\x00\x00\x7f");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x00000080, 4, "\x00\x00\x00\x80");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x00003fff, 4, "\x00\x00\x3f\xff");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x00004000, 4, "\x00\x00\x40\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x001fffff, 4, "\x00\x1f\xff\xff");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x00200000, 4, "\x00\x20\x00\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x0fffffff, 4, "\x0f\xff\xff\xff");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0x10000000, 4, "\x10\x00\x00\x00");
-  TEST_WRITE_READ(packed32, packed32, "%d", 0xffffffff, 4, "\xff\xff\xff\xff");
-  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/2006/test/test_labcomm_copy.c b/lib/c/2006/test/test_labcomm_copy.c
deleted file mode 100644
index aa7723c..0000000
--- a/lib/c/2006/test/test_labcomm_copy.c
+++ /dev/null
@@ -1,249 +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 "labcomm2006.h"
-#include "labcomm2006_private.h"
-#include "labcomm2006_default_error_handler.h"
-#include "labcomm2006_default_memory.h"
-#include "labcomm2006_default_scheduler.h"
-#include "labcomm2006_fd_writer.h"
-#include "labcomm2006_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)
-{
-  labcomm2006_copy_generated_encoding_S1(labcomm2006_default_memory, context, v);
-}
-
-static void handle_b(generated_encoding_B *v, void *context)
-{
-  labcomm2006_copy_generated_encoding_B(labcomm2006_default_memory, context, v);
-}
-
-static void handle_i(generated_encoding_I *v, void *context)
-{
-  labcomm2006_copy_generated_encoding_I(labcomm2006_default_memory, context, v);
-}
-
-static void handle_p(generated_encoding_P *v, void *context)
-{
-  labcomm2006_copy_generated_encoding_P(labcomm2006_default_memory, context, v);
-}
-
-static void handle_test_var(test_sample_test_var *v, void *context)
-{
-  labcomm2006_copy_test_sample_test_var(labcomm2006_default_memory, context, v);
-}
-
-static void handle_a(more_types_A *v, void *context)
-{
-  labcomm2006_copy_more_types_A(labcomm2006_default_memory, context, v);
-}
-
-static void handle_s(more_types_S *v, void *context)
-{
-  labcomm2006_copy_more_types_S(labcomm2006_default_memory, context, v);
-}
-
-static void handle_ns(more_types_NS *v, void *context)
-{
-  labcomm2006_copy_more_types_NS(labcomm2006_default_memory, context, v);
-}
-
-static void handle_as(more_types_AS *v, void *context)
-{
-  labcomm2006_copy_more_types_AS(labcomm2006_default_memory, context, v);
-}
-
-int main(int argc, char **argv)
-{
-  struct labcomm2006_encoder *encoder;
-  struct labcomm2006_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;
-
-  fd = open(DATA_FILE, O_RDWR | O_CREAT | O_TRUNC, 0644);
-  if (fd == -1)
-    err(1, "open()");
-  encoder =
-    labcomm2006_encoder_new(labcomm2006_fd_writer_new(labcomm2006_default_memory, fd, 0),
-			labcomm2006_default_error_handler,
-			labcomm2006_default_memory,
-			labcomm2006_default_scheduler);
-
-  labcomm2006_encoder_register_generated_encoding_S1(encoder);
-  s1.i = 1;
-  labcomm2006_encode_generated_encoding_S1(encoder, &s1);
-
-  labcomm2006_encoder_register_generated_encoding_B(encoder);
-  b = 2;
-  labcomm2006_encode_generated_encoding_B(encoder, &b);
-
-  labcomm2006_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;
-  labcomm2006_encode_generated_encoding_I(encoder, &I);
-
-  labcomm2006_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;
-  labcomm2006_encode_generated_encoding_P(encoder, &p);
-
-  labcomm2006_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;
-      }
-  labcomm2006_encode_test_sample_test_var(encoder, &test_var);
-
-  labcomm2006_encoder_register_more_types_A(encoder);
-  for (int i = 0; i < sizeof(a.a) / sizeof(a.a[0]); i++)
-    a.a[i] = i;
-  labcomm2006_encode_more_types_A(encoder, &a);
-
-  labcomm2006_encoder_register_more_types_S(encoder);
-  s = "this is a string";
-  labcomm2006_encode_more_types_S(encoder, &s);
-
-  labcomm2006_encoder_register_more_types_NS(encoder);
-  ns.s1 = "this is a string";
-  ns.s2 = "this is a another string";
-  labcomm2006_encode_more_types_NS(encoder, &ns);
-
-  labcomm2006_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";
-  labcomm2006_encode_more_types_AS(encoder, &as);
-
-  labcomm2006_encoder_free(encoder);
-  encoder = NULL;
-  lseek(fd, 0, SEEK_SET);
-  decoder =
-    labcomm2006_decoder_new(labcomm2006_fd_reader_new(labcomm2006_default_memory, fd, 0),
-			labcomm2006_default_error_handler,
-			labcomm2006_default_memory,
-			labcomm2006_default_scheduler);
-
-  labcomm2006_decoder_register_generated_encoding_S1(decoder, handle_s1, &cache_s1);
-  labcomm2006_decoder_register_generated_encoding_B(decoder, handle_b, &cache_b);
-  labcomm2006_decoder_register_generated_encoding_I(decoder, handle_i, &cache_I);
-  labcomm2006_decoder_register_generated_encoding_P(decoder, handle_p, &cache_p);
-  labcomm2006_decoder_register_test_sample_test_var(decoder, handle_test_var,
-						&cache_test_var);
-  labcomm2006_decoder_register_more_types_A(decoder, handle_a, &cache_a);
-  labcomm2006_decoder_register_more_types_S(decoder, handle_s, &cache_s);
-  labcomm2006_decoder_register_more_types_NS(decoder, handle_ns, &cache_ns);
-  labcomm2006_decoder_register_more_types_AS(decoder, handle_as, &cache_as);
-
-  while (labcomm2006_decoder_decode_one(decoder) > 0) ;
-
-  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");
-
-  labcomm2006_decoder_free(decoder);
-  close(fd);
-  unlink(DATA_FILE);
-
-  labcomm2006_copy_free_generated_encoding_S1(labcomm2006_default_memory, &cache_s1);
-  puts("S1 deallocated ok");
-  labcomm2006_copy_free_generated_encoding_B(labcomm2006_default_memory, &cache_b);
-  puts("B deallocated ok");
-  labcomm2006_copy_free_generated_encoding_I(labcomm2006_default_memory, &cache_I);
-  puts("I deallocated ok");
-  labcomm2006_copy_free_generated_encoding_P(labcomm2006_default_memory, &cache_p);
-  puts("P deallocated ok");
-  labcomm2006_copy_free_test_sample_test_var(labcomm2006_default_memory, &cache_test_var);
-  puts("test_var deallocated ok");
-  labcomm2006_copy_free_more_types_A(labcomm2006_default_memory, &cache_a);
-  puts("A deallocated ok");
-  labcomm2006_copy_free_more_types_S(labcomm2006_default_memory, &cache_s);
-  puts("S deallocated ok");
-  labcomm2006_copy_free_more_types_NS(labcomm2006_default_memory, &cache_ns);
-  puts("NS deallocated ok");
-  labcomm2006_copy_free_more_types_AS(labcomm2006_default_memory, &cache_as);
-  puts("AS deallocated ok");
-}
diff --git a/lib/c/2006/test/test_labcomm_errors.c b/lib/c/2006/test/test_labcomm_errors.c
deleted file mode 100644
index 7808504..0000000
--- a/lib/c/2006/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/2006/test/test_labcomm_errors.h b/lib/c/2006/test/test_labcomm_errors.h
deleted file mode 100644
index 8cc3918..0000000
--- a/lib/c/2006/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/2006/test/test_labcomm_generated_encoding.c b/lib/c/2006/test/test_labcomm_generated_encoding.c
deleted file mode 100644
index ad116a8..0000000
--- a/lib/c/2006/test/test_labcomm_generated_encoding.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-  test_labcomm_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 "labcomm2006_private.h"
-#include "labcomm2006_default_error_handler.h"
-#include "labcomm2006_default_memory.h"
-#include "labcomm2006_pthread_scheduler.h"
-#include "test/gen/generated_encoding.h"
-
-#define IOCTL_WRITER_ASSERT_BYTES 4096
-#define IOCTL_WRITER_RESET 4097
-
-static unsigned char buffer[128];
-struct labcomm2006_writer *writer;
-
-static int buf_writer_alloc(
-  struct labcomm2006_writer *w, 
-  struct labcomm2006_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 labcomm2006_writer *w, 
-  struct labcomm2006_writer_action_context *action_context)
-{
-  return 0;
-}
-
-static int buf_writer_start(
-  struct labcomm2006_writer *w,
-  struct labcomm2006_writer_action_context *action_context,
-  int index,
-  const struct labcomm2006_signature *signature,
-  void *value)
-{
-  return 0;
-}
-
-static int buf_writer_end(
-  struct labcomm2006_writer *w, 
-  struct labcomm2006_writer_action_context *action_context)
-{
-  return 0;
-}
-
-static int buf_writer_flush(
-  struct labcomm2006_writer *w, 
-  struct labcomm2006_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 labcomm2006_writer *w, 
-  struct labcomm2006_writer_action_context *action_context,
-  int signature_index, const struct labcomm2006_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;
-
-      if (w->pos != count) {
-	fprintf(stderr, "Invalid length encoded %d != %d (%s:%d)\n", 
-		w->pos, count, __FILE__, line);
-	mismatch = 1;
-      } 
-      for (mismatch = 0, i = 0 ; i < count ; i++) {
-	if (expected[i] >= 0 && 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(".. ");
-	  } 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 labcomm2006_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 labcomm2006_writer_action_context action_context = {
-  .next = NULL,
-  .action = &writer_action,
-  .context = NULL
-}; 
-static struct labcomm2006_writer buffer_writer = {
-  .action_context = &action_context,
-  .data = buffer,
-  .data_size = sizeof(buffer),
-  .count = sizeof(buffer),
-  .pos = 0,
-  .error = 0,
-};
-
-void dump_encoder(struct labcomm2006_encoder *encoder)
-{
-  int i;
-  
-  for (i = 0 ; i < writer->pos ; i++) {
-    printf("%2.2x ", writer->data[i]);
-  }
-  printf("\n");
-}
-
-#define EXPECT(...)							\
-  {									\
-    int expected[] = __VA_ARGS__;					\
-    labcomm2006_encoder_ioctl(encoder, IOCTL_WRITER_ASSERT_BYTES,       \
-			  __LINE__,					\
-			  sizeof(expected)/sizeof(expected[0]),		\
-			  expected);					\
-  }
-
-int main(void)
-{
-  generated_encoding_B B = 1;
-
-  struct labcomm2006_encoder *encoder = labcomm2006_encoder_new(
-    &buffer_writer, 
-    labcomm2006_default_error_handler,
-    labcomm2006_default_memory,
-    labcomm2006_pthread_scheduler_new(labcomm2006_default_memory));
-
-  labcomm2006_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  /* Register twice to make sure that only one registration gets encoded */
-  labcomm2006_encoder_register_generated_encoding_V(encoder);
-  labcomm2006_encoder_register_generated_encoding_V(encoder);
-  EXPECT({ 0x00, 0x00, 0x00, 0x02,
-           0x00, 0x00, 0x00, -1, 
-           0x00, 0x00, 0x00, 0x01, 'V', 
-           0x00, 0x00, 0x00, 0x11, 
-           0x00, 0x00, 0x00, 0x00 });
-
-  labcomm2006_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  /* Register twice to make sure that only one registration gets encoded */
-  labcomm2006_encoder_register_generated_encoding_B(encoder);
-  labcomm2006_encoder_register_generated_encoding_B(encoder);
-  EXPECT({ 0x00, 0x00, 0x00, 0x02, 
-           0x00, 0x00, 0x00, -1, 
-           0x00, 0x00, 0x00, 0x01, 'B', 
-           0x00, 0x00, 0x00, 0x21});
-
-  labcomm2006_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  // was: labcomm2006_encode_generated_encoding_V(encoder, &V);
-  labcomm2006_encode_generated_encoding_V(encoder);
-  EXPECT({0x00, 0x00, 0x00, -1 });
-
-  labcomm2006_encoder_ioctl(encoder, IOCTL_WRITER_RESET);
-  labcomm2006_encode_generated_encoding_B(encoder, &B);
-  EXPECT({ 0x00, 0x00, 0x00, -1, 1});
-
-  return 0;
-}
-
diff --git a/lib/c/2006/test/test_labcomm_pthread_scheduler.c b/lib/c/2006/test/test_labcomm_pthread_scheduler.c
deleted file mode 100644
index c89dca5..0000000
--- a/lib/c/2006/test/test_labcomm_pthread_scheduler.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-  test_labcomm_pthread_scheduler.c -- test labcomm 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 "labcomm2006_default_memory.h"
-#include "labcomm2006_scheduler.h"
-#include "labcomm2006_pthread_scheduler.h"
-
-#define TICK 100000
-struct func_arg {
-  struct labcomm2006_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) {
-    labcomm2006_scheduler_wakeup(func_arg->scheduler);
-  }
-}
-
-void enqueue(struct labcomm2006_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;
-    labcomm2006_scheduler_enqueue(scheduler, i*TICK, func, tmp);
-  }
-}
-
-int main(int argc, char *argv[])
-{
-  struct labcomm2006_scheduler *scheduler;
-  struct labcomm2006_time *time;
-
-  scheduler = labcomm2006_pthread_scheduler_new(labcomm2006_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;
-    labcomm2006_scheduler_enqueue(scheduler, 6*TICK, func, tmp);
-  }
-  time = labcomm2006_scheduler_now(scheduler);
-  labcomm2006_time_add_usec(time, 12*TICK);
-  labcomm2006_scheduler_sleep(scheduler, NULL);
-  labcomm2006_scheduler_sleep(scheduler, time);
-
-  return 0;
-}
diff --git a/lib/c/2006/test/test_sample.lc b/lib/c/2006/test/test_sample.lc
deleted file mode 100644
index 302c615..0000000
--- a/lib/c/2006/test/test_sample.lc
+++ /dev/null
@@ -1 +0,0 @@
-sample int test_var[_,2,_];
diff --git a/lib/c/2006/test/test_signature_numbers.c b/lib/c/2006/test/test_signature_numbers.c
deleted file mode 100644
index 9d79b4a..0000000
--- a/lib/c/2006/test/test_signature_numbers.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include "labcomm2006_private.h"
-#include "test/gen/another_encoding.h"
-#include "test/gen/generated_encoding.h"
-
-static void info(char *name, char *full_name, 
-		 const struct labcomm2006_signature *signature) {
-  printf("%s %s %p -> %d\n", name,  full_name, signature, 
-	 labcomm2006_get_local_index(signature));
-  if (labcomm2006_get_local_index(signature) < 0x40) {
-    exit(1);
-  }
-};
-
-int main(int argc, char *argv[])
-{
-#define FUNC(name, full_name) \
-  info( #name, #full_name, labcomm2006_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 5d36fef..819a8c4 100644
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -1,4 +1,4 @@
-VERSIONS=2006 2014
+VERSIONS=2014
 
 all:
 
diff --git a/lib/java/.gitignore b/lib/java/.gitignore
index 6273ee5..ad47e97 100644
--- a/lib/java/.gitignore
+++ b/lib/java/.gitignore
@@ -1,5 +1,5 @@
 gen
-labcomm.jar
+labcomm2014.jar
 labcomm2006.jar
 labcomm2014.jar
 
diff --git a/lib/java/Makefile b/lib/java/Makefile
index ec46407..c9fd3f9 100644
--- a/lib/java/Makefile
+++ b/lib/java/Makefile
@@ -19,27 +19,16 @@ MODULES=Constant \
 	WriterWrapper
 
 .PHONY: all
-all: labcomm.jar labcomm2014.jar labcomm2006.jar
-
-labcomm.jar: gen/JAVAC
-	echo $@
-	cd gen ; jar cf ../$@ \
-		se/lth/control/labcomm2014/*.class \
-		se/lth/control/labcomm2006/*.class
+all: labcomm2014.jar
 
 labcomm2014.jar: gen/JAVAC
 	echo $@
 	cd gen ; jar cf ../$@ se/lth/control/labcomm2014/*.class
 
-labcomm2006.jar: gen/JAVAC
-	echo $@
-	cd gen ; jar cf ../$@ se/lth/control/labcomm2006/*.class
-
 gen:
 	mkdir gen
 
-gen/JAVAC: $(MODULES:%=se/lth/control/labcomm2006/%.java) \
-	   $(MODULES:%=se/lth/control/labcomm2014/%.java) \
+gen/JAVAC: $(MODULES:%=se/lth/control/labcomm2014/%.java) \
 	   Makefile | gen
 	javac -cp ../../compiler/labcomm2014_compiler.jar -d gen \
             $(filter %.java, $^)
@@ -55,4 +44,4 @@ clean:
 
 .PHONY: distclean
 distclean: clean
-	rm -rf labcomm.jar labcomm2006.jar labcomm2014.jar
+	rm -rf labcomm2014.jar
diff --git a/lib/java/se/lth/control/labcomm2006/ASTbuilder.java b/lib/java/se/lth/control/labcomm2006/ASTbuilder.java
deleted file mode 100644
index a65e887..0000000
--- a/lib/java/se/lth/control/labcomm2006/ASTbuilder.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package se.lth.control.labcomm2006;
-
-public class ASTbuilder {
-}
diff --git a/lib/java/se/lth/control/labcomm2006/BuiltinType.java b/lib/java/se/lth/control/labcomm2006/BuiltinType.java
deleted file mode 100644
index ffcdc87..0000000
--- a/lib/java/se/lth/control/labcomm2006/BuiltinType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package se.lth.control.labcomm2006;
-
-public interface BuiltinType extends SampleType{
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/Constant.java b/lib/java/se/lth/control/labcomm2006/Constant.java
deleted file mode 100644
index 5c14ae5..0000000
--- a/lib/java/se/lth/control/labcomm2006/Constant.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package se.lth.control.labcomm2006;
-
-public class Constant {
-
-  public static final String VERSION = "LabComm2006";
-
-  /*
-   * Predeclared aggregate type indices
-   */
-  public static final int TYPEDEF          = 0x01;
-  public static final int SAMPLE           = 0x02;
-  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;
-
-  /*
-   * Start of user declared types
-   */
-  public static final int FIRST_USER_INDEX = 0x80;
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/Decoder.java b/lib/java/se/lth/control/labcomm2006/Decoder.java
deleted file mode 100644
index 0b442cb..0000000
--- a/lib/java/se/lth/control/labcomm2006/Decoder.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package se.lth.control.labcomm2006;
-
-import java.io.IOException;
-
-public interface Decoder {
-  
-  public void register(SampleDispatcher dispatcher, 
-		       SampleHandler handler) 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;
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/DecoderChannel.java b/lib/java/se/lth/control/labcomm2006/DecoderChannel.java
deleted file mode 100644
index 34acf50..0000000
--- a/lib/java/se/lth/control/labcomm2006/DecoderChannel.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package se.lth.control.labcomm2006;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-
-public class DecoderChannel implements Decoder {
-
-  private DataInputStream in;
-  private DecoderRegistry registry;
-
-  public DecoderChannel(InputStream in) throws IOException {
-    this.in = new DataInputStream(in);
-    registry = new DecoderRegistry();
-  }
-
-  public void runOne() throws Exception {
-    boolean done = false;
-    while (!done) {
-      int tag = decodePacked32();
-      switch (tag) {
-	case Constant.SAMPLE: {
-	  int index = decodePacked32();
-	  String name = decodeString();
-	  ByteArrayOutputStream signature = new ByteArrayOutputStream();
-	  collectFlatSignature(new EncoderChannel(signature));
-	  registry.add(index, name, signature.toByteArray());
-	} break;
-	default: {
-	  DecoderRegistry.Entry e = 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() +"'");
-	  }
-	  d.decodeAndHandle(this, h);
-	  done = true;
-	}
-      }
-    }
-  }
-
-  public void run() throws Exception {
-    while (true) {
-      runOne();
-    }
-  }
-
-  private void collectFlatSignature(Encoder out) throws IOException {
-    int type = decodePacked32();
-    out.encodePacked32(type);
-    switch (type) {
-      case Constant.ARRAY: {
-	int dimensions = decodePacked32();
-	out.encodePacked32(dimensions);
-	for (int i = 0 ; i < dimensions ; i++) {
-	  out.encodePacked32(decodePacked32());
-	}
-	collectFlatSignature(out);
-      } break;
-      case Constant.STRUCT: {
-	int fields = decodePacked32();
-	out.encodePacked32(fields);
-	for (int i = 0 ; i < fields ; i++) {
-	  out.encodeString(decodeString());
-	  collectFlatSignature(out);
-	}
-      } 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);
-      }
-    }
-    out.end(null);
-  }
-
-  public void register(SampleDispatcher dispatcher, 
-                       SampleHandler handler) throws IOException {
-    registry.add(dispatcher, handler);
-  }
-
-  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);
-  }
-
-  /**
-     method for API harmonization with labcomm2014.
-     Labcomm2006 encodes lengths etc as 32 bit ints.
-  */
-  public int decodePacked32() throws IOException {
-    return in.readInt();
-  }
-}
-
diff --git a/lib/java/se/lth/control/labcomm2006/DecoderRegistry.java b/lib/java/se/lth/control/labcomm2006/DecoderRegistry.java
deleted file mode 100644
index 8bce34d..0000000
--- a/lib/java/se/lth/control/labcomm2006/DecoderRegistry.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package se.lth.control.labcomm2006;
-
-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;
-    }
-
-    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{
-    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/labcomm2006/Encoder.java b/lib/java/se/lth/control/labcomm2006/Encoder.java
deleted file mode 100644
index eaf54b2..0000000
--- a/lib/java/se/lth/control/labcomm2006/Encoder.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package se.lth.control.labcomm2006;
-
-import java.io.IOException;
-
-public interface Encoder {
-
-  public void register(SampleDispatcher dispatcher) throws IOException;
-  public void begin(Class<? extends Sample> c) throws IOException;
-  public void end(Class<? extends Sample> 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;
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/EncoderChannel.java b/lib/java/se/lth/control/labcomm2006/EncoderChannel.java
deleted file mode 100644
index b164754..0000000
--- a/lib/java/se/lth/control/labcomm2006/EncoderChannel.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package se.lth.control.labcomm2006;
-
-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;
-  private DataOutputStream data;
-  private EncoderRegistry registry;
-
-  public EncoderChannel(Writer writer) throws IOException {
-    this.writer = writer;
-    bytes = new ByteArrayOutputStream();
-    data = new DataOutputStream(bytes);
-    registry = new EncoderRegistry();
-  }
-
-  public EncoderChannel(OutputStream writer) throws IOException {
-    this(new WriterWrapper(writer));
-  }
-
-  public void register(SampleDispatcher dispatcher) throws IOException {
-    int index = registry.add(dispatcher);
-    encodePacked32(Constant.SAMPLE);
-    encodePacked32(index);
-    encodeString(dispatcher.getName());
-    byte[] signature = dispatcher.getSignature();
-    for (int i = 0 ; i < signature.length ; i++) {
-      encodeByte(signature[i]);
-    }
-    end(null);
-  }
-
-  public void begin(Class<? extends Sample> c) throws IOException {
-    encodePacked32(registry.getTag(c));
-  }
-
-  public void end(Class<? extends Sample> c) throws IOException {
-    data.flush();
-    //XXX when writer was a stream, it was probably a bit more GC efficient:
-    //bytes.writeTo(writer);
-    writer.write(bytes.toByteArray());
-    bytes.reset();
-  }
-
-  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 {
-    data.writeShort(0); // HACK...
-    data.writeUTF(value);
-  }
-
-  /**
-     method for API harmonization with labcomm2014.
-     Labcomm2006 encodes lengths etc as 32 bit ints.
-  */
-  public void encodePacked32(long value) throws IOException {
-    if(value > Integer.MAX_VALUE) {
-      throw new IllegalArgumentException("Value too large, must fit in 32 bits");
-    }
-    encodeInt((int) value);
-  }
-}
-
diff --git a/lib/java/se/lth/control/labcomm2006/EncoderRegistry.java b/lib/java/se/lth/control/labcomm2006/EncoderRegistry.java
deleted file mode 100644
index 70f6eb7..0000000
--- a/lib/java/se/lth/control/labcomm2006/EncoderRegistry.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package se.lth.control.labcomm2006;
-
-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(Class<? extends Sample> sample) throws IOException {
-    Entry e = byClass.get(sample);
-    if (e == null) {
-      throw new IOException("'" + 
-			    sample.getSimpleName() + 
-			    "' is not registered");
-    }
-    return e.index;
-  }
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/Reader.java b/lib/java/se/lth/control/labcomm2006/Reader.java
deleted file mode 100644
index 62cdacf..0000000
--- a/lib/java/se/lth/control/labcomm2006/Reader.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package se.lth.control.labcomm2006;
-
-public interface Reader {
-
-  public void handle(byte[] data, int begin, int end);
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/Sample.java b/lib/java/se/lth/control/labcomm2006/Sample.java
deleted file mode 100644
index a20b06a..0000000
--- a/lib/java/se/lth/control/labcomm2006/Sample.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package se.lth.control.labcomm2006;
-
-public interface Sample {
-
-}
\ No newline at end of file
diff --git a/lib/java/se/lth/control/labcomm2006/SampleDispatcher.java b/lib/java/se/lth/control/labcomm2006/SampleDispatcher.java
deleted file mode 100644
index f3acd50..0000000
--- a/lib/java/se/lth/control/labcomm2006/SampleDispatcher.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package se.lth.control.labcomm2006;
-
-public interface SampleDispatcher {
-    
-  public Class getSampleClass();
-    
-  public String getName();
-
-  public byte[] getSignature();
-
-  public void decodeAndHandle(Decoder decoder,
-			      SampleHandler handler) throws Exception;
-
-}
-
diff --git a/lib/java/se/lth/control/labcomm2006/SampleHandler.java b/lib/java/se/lth/control/labcomm2006/SampleHandler.java
deleted file mode 100644
index 046e3b4..0000000
--- a/lib/java/se/lth/control/labcomm2006/SampleHandler.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package se.lth.control.labcomm2006;
-
-public interface SampleHandler {
-}
diff --git a/lib/java/se/lth/control/labcomm2006/SampleType.java b/lib/java/se/lth/control/labcomm2006/SampleType.java
deleted file mode 100644
index 932d0d9..0000000
--- a/lib/java/se/lth/control/labcomm2006/SampleType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package se.lth.control.labcomm2006;
-
-public interface SampleType {
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/TypeBinding.java b/lib/java/se/lth/control/labcomm2006/TypeBinding.java
deleted file mode 100644
index 0a15ac9..0000000
--- a/lib/java/se/lth/control/labcomm2006/TypeBinding.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class TypeBinding {
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/TypeDef.java b/lib/java/se/lth/control/labcomm2006/TypeDef.java
deleted file mode 100644
index 32997dd..0000000
--- a/lib/java/se/lth/control/labcomm2006/TypeDef.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class TypeDef {
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/TypeDefParser.java b/lib/java/se/lth/control/labcomm2006/TypeDefParser.java
deleted file mode 100644
index 2890eee..0000000
--- a/lib/java/se/lth/control/labcomm2006/TypeDefParser.java
+++ /dev/null
@@ -1,2 +0,0 @@
-public class TypeDefParser {
-}
diff --git a/lib/java/se/lth/control/labcomm2006/Writer.java b/lib/java/se/lth/control/labcomm2006/Writer.java
deleted file mode 100644
index e02b77d..0000000
--- a/lib/java/se/lth/control/labcomm2006/Writer.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package se.lth.control.labcomm2006;
-
-import java.io.IOException;
-
-public interface Writer {
-
-  public void write(byte[] data) throws IOException;
-
-}
diff --git a/lib/java/se/lth/control/labcomm2006/WriterWrapper.java b/lib/java/se/lth/control/labcomm2006/WriterWrapper.java
deleted file mode 100644
index b25c0d8..0000000
--- a/lib/java/se/lth/control/labcomm2006/WriterWrapper.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package se.lth.control.labcomm2006;
-
-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/test/Makefile b/test/Makefile
index 57e8684..a6f85c9 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -25,7 +25,7 @@ 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 \
+		--test java \\-cp gen/$*:../lib/java/labcomm2014.jar java_relay \
 			    /dev/stdin /dev/stdout
 
 # test cases for compiler error checking
@@ -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/labcomm2014.jar:gen/$*/java_code $<
-- 
GitLab