Skip to main content
Sign in
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
0 results Searching
Select Git revision
Loading items
Show changes

Commits on Source 265

165 additional commits have been omitted to prevent performance issues.
342 files
+ 14158
13320
Compare changes
  • Side-by-side
  • Inline

Files

.bzrignore

deleted100644 → 0
+0 −41
Original line number Diff line number Diff line
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
+1 −29
Original line number Diff line number Diff line
*~
*.class
*.o
lib/c/liblabcomm.a
lib/c/liblabcomm.so
lib/c/liblabcomm.so.1
lib/c/liblabcomm2006.so.1
lib/c/liblabcomm2006.so
lib/c/liblabcomm2006.a
lib/c/liblabcomm2014.so.1
lib/c/liblabcomm2014.so
lib/c/liblabcomm2014.a
lib/c/test/test_labcomm
lib/c/test/test_labcomm_basic_type_encoding
lib/c/test/test_labcomm_copy
lib/c/test/test_labcomm_generated_encoding
lib/c/test/test_labcomm_pthread_scheduler
lib/c/test/test_signature_numbers
compiler/AST/
compiler/labcomm_compiler.jar
encoded_data
encoded_data06
gen
gen06
*.pyc
examples/twoway/gen/
lib/csharp/labcomm.dll
lib/java/gen/
lib/java/labcomm*.jar
examples/simple/example_decoder
examples/simple/example_decoder06
examples/simple/example_encoder
examples/simple/example_encoder06
examples/dynamic/gen

LICENSE.rationale

0 → 100644
+73 −0
Original line number Diff line number Diff line
Rationale for the licensing choosen for LabComm
===============================================

Primary goal:   the owners of systems with LabComm communication in it, 
                should have the liberty to replace the LabComm parts with 
                any software they see fit.

Secondary goal: it should be possible to release propreitary software
                with LabComm.


Wanted software architecture
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

+------------------------------------------------------------+
| Propreitary software (any license)                         |
+------------------------------------------------------------+
| Labcomm glue (LGPL)                                        |
+--------------+-----+--------------+                        |
|  Generated   |     |  Generated   |                        |
|   encoder/   |     |   encoder/   |                        |
|   decoder    | * * |   decoder    |                        |
| (  GPLv3 +   |     | (  GPLv3 +   |        +---------------+
|  permission) |     |  permission) |        |  Non-system   |
+--------------+-----+--------------+--+     |    library    |
| LabComm library (GPLv3 + permission) |     | (any license) | 
+--------------------------------------+-----+----------+----+
| System library (any license)                          |    |
+-------------------------------------------------------+    |
| OS (any license)                                           |
+------------------------------------------------------------+

License considerations
^^^^^^^^^^^^^^^^^^^^^^

We need to allow linking to the LabComm library from the LGPL glue
(see http://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs).

We can not set a license on generated code
(http://www.gnu.org/licenses/gpl-faq.html#GPLOutput), 
but when used with the LabComm library we can force it 
to be licensed under GPLv3.


Suggested license for all library files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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/>.

Additional permission under GNU GPL version 3 section 7

If you modify this Program, or any covered work, by directly linking 
any functionality of it, with the the exception of calls denoting the 
boundary of encoded samples and calls encoding primitive datatypes,
with any software licensed under the GNU Lesser General Public License, 
the licensors of this Program grant you additional permission to convey 
the resulting work. 
+25 −25
Original line number Diff line number Diff line
SUBDIRS=compiler lib test examples
export LABCOMM_JAR=$(shell pwd)/compiler/labcomm_compiler.jar
SUBDIRS=compiler lib test examples packaging
export LABCOMM_JAR=$(shell pwd)/compiler/labcomm2014_compiler.jar
export LABCOMM=java -jar $(LABCOMM_JAR) 
export VALGRIND=valgrind --leak-check=full --error-exitcode=1

all: $(SUBDIRS:%=make-%)
UNAME_S=$(shell uname -s)

.PHONY: make-compiler
make-compiler:
	cd compiler ; ant jar
.PHONY: all
all: $(SUBDIRS:%=all-%)

.PHONY: make-%
make-%:
	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* -e 
.PHONY: all-%
all-%:
ifeq ($(UNAME_S),Darwin)
	DYLD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $*
else
	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $*
endif

.PHONY: test
test: $(SUBDIRS:%=test-%)

.PHONY: test-compiler
test-compiler:
	$(MAKE) -C test compiler_errors

.PHONY: test-%
test-%:
	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* -e test
ifeq ($(UNAME_S),Darwin)
	DYLD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* test
else
	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* test
endif

.PHONY: clean
clean: $(SUBDIRS:%=clean-%)

.PHONY: clean-compiler
clean-compiler:
	cd compiler ; ant clean

.PHONY: clean-%
clean-%:
	$(MAKE) -C $* -e clean
	$(MAKE) -C $* clean

.PHONY: distclean
distclean: $(SUBDIRS:%=distclean-%)

.PHONY: distclean-compiler
distclean-compiler:
	cd compiler ; ant clean
distclean: clean $(SUBDIRS:%=distclean-%)

.PHONY: distclean-%
distclean-%:
	$(MAKE) -C $* -e distclean
	$(MAKE) -C $* distclean

.PHONY: srpm
srpm:
	make -C packaging $@

compiler/.gitignore

0 → 100644
+4 −0
Original line number Diff line number Diff line
gen
labcomm2006_compiler.jar
labcomm2014_compiler.jar
labcomm2014_compiler.jar
+0 −43
Original line number Diff line number Diff line
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());
      }
    }
  }

}

compiler/2006/CS_CodeGen.jrag

deleted100644 → 0
+0 −971

File deleted.

Preview size limit exceeded, changes collapsed.

compiler/2006/C_CodeGen.jrag

deleted100644 → 0
+0 −1694

File deleted.

Preview size limit exceeded, changes collapsed.

compiler/2006/DeclNames.jrag

deleted100644 → 0
+0 −14
Original line number Diff line number Diff line
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();
}

compiler/2006/ErrorCheck.jrag

deleted100644 → 0
+0 −31
Original line number Diff line number Diff line
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);
	    }
	}

}

compiler/2006/FlatSignature.jrag

deleted100644 → 0
+0 −123
Original line number Diff line number Diff line
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 "_";
  }

}

compiler/2006/Java_CodeGen.jrag

deleted100644 → 0
+0 −1056

File deleted.

Preview size limit exceeded, changes collapsed.

compiler/2006/LabComm.ast

deleted100644 → 0
+0 −39
Original line number Diff line number Diff line
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;
Loading