Commit 5b97cd63 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Renamed C# to labcomm2014

parent 70df32f9
......@@ -210,7 +210,7 @@ aspect CS_CodeGen {
env.indent();
}
env.println("using System;");
env.println("using se.lth.control.labcomm;");
env.println("using se.lth.control.labcomm2014;");
for (int i = 0; i < getNumDecl(); i++) {
Decl d = getDecl(i);
try {
......
using se.lth.control.labcomm;
using se.lth.control.labcomm2014;
using System;
using System.Collections.Generic;
using System.Linq;
......
gen
labcomm.dll
labcomm2014.dll
ExampleDecoder.exe
ExampleEncoder.exe
encoded_data_c
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using se.lth.control.labcomm;
namespace user_types
{
class Decoder : twoLines.Handler,
twoInts.Handler,
theFirstInt.Handler,
theSecondInt.Handler,
doavoid.Handler,
intAndRef.Handler
{
DecoderChannel dec;
public Decoder(Stream stream)
{
dec = new DecoderChannel(stream);
twoLines.register(dec, this);
twoInts.register(dec, this);
theFirstInt.register(dec, this);
theSecondInt.register(dec, this);
doavoid.register(dec, this);
intAndRef.register(dec, this);
doavoid.registerSampleRef(dec);
try
{
Console.WriteLine("Running decoder.");
dec.run();
}
catch (EndOfStreamException)
{
Console.WriteLine("EOF reached");
}
}
private string genPoint(point p)
{
return "(" + p.x.val + ", " + p.y.val + ")";
}
private String genLine(line l)
{
return "Line from " + genPoint(l.start) + " to " + genPoint(l.end);
}
public void handle(twoLines d)
{
Console.WriteLine("Got twoLines: ");
Console.WriteLine("Line l1: "+genLine(d.l1));
Console.WriteLine("Line l2: " + genLine(d.l2));
}
public void handle(twoInts d)
{
Console.WriteLine("Got twoInts: ");
Console.WriteLine("a: "+d.a);
Console.WriteLine("b: "+d.b);
}
void theFirstInt.Handler.handle(int d)
{
Console.WriteLine("Got theFirstInt: "+d);
}
void theSecondInt.Handler.handle(int d)
{
Console.WriteLine("Got theSecondInt: "+d);
}
void doavoid.Handler.handle()
{
Console.WriteLine("Got a void.");
}
void intAndRef.Handler.handle(intAndRef d)
{
Console.WriteLine("Got intAndRef: "+d.x+" : "+d.reference);
}
static void Main(string[] args)
{
new Decoder(new FileStream(args[0], FileMode.Open));
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using se.lth.control.labcomm2014;
namespace user_types
{
class Decoder : twoLines.Handler,
twoInts.Handler,
theFirstInt.Handler,
theSecondInt.Handler,
doavoid.Handler,
intAndRef.Handler
{
DecoderChannel dec;
public Decoder(Stream stream)
{
dec = new DecoderChannel(stream);
twoLines.register(dec, this);
twoInts.register(dec, this);
theFirstInt.register(dec, this);
theSecondInt.register(dec, this);
doavoid.register(dec, this);
intAndRef.register(dec, this);
doavoid.registerSampleRef(dec);
try
{
Console.WriteLine("Running decoder.");
dec.run();
}
catch (EndOfStreamException)
{
Console.WriteLine("EOF reached");
}
}
private string genPoint(point p)
{
return "(" + p.x.val + ", " + p.y.val + ")";
}
private String genLine(line l)
{
return "Line from " + genPoint(l.start) + " to " + genPoint(l.end);
}
public void handle(twoLines d)
{
Console.WriteLine("Got twoLines: ");
Console.WriteLine("Line l1: "+genLine(d.l1));
Console.WriteLine("Line l2: " + genLine(d.l2));
}
public void handle(twoInts d)
{
Console.WriteLine("Got twoInts: ");
Console.WriteLine("a: "+d.a);
Console.WriteLine("b: "+d.b);
}
void theFirstInt.Handler.handle(int d)
{
Console.WriteLine("Got theFirstInt: "+d);
}
void theSecondInt.Handler.handle(int d)
{
Console.WriteLine("Got theSecondInt: "+d);
}
void doavoid.Handler.handle()
{
Console.WriteLine("Got a void.");
}
void intAndRef.Handler.handle(intAndRef d)
{
Console.WriteLine("Got intAndRef: "+d.x+" : "+d.reference);
}
static void Main(string[] args)
{
new Decoder(new FileStream(args[0], FileMode.Open));
}
}
}
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using se.lth.control.labcomm;
namespace user_types
{
public class Encoder
{
private EncoderChannel enc;
public Encoder(Stream stream)
{
enc = new EncoderChannel(stream);
twoLines.register(enc);
}
public void doEncode()
{
twoLines x = new twoLines();
line l1 = new line();
point p11 = new point();
coord c11x = new coord();
coord c11y = new coord();
c11x.val = 11;
c11y.val = 99;
p11.x = c11x;
p11.y = c11y;
l1.start = p11;
point p12 = new point();
coord c12x = new coord();
coord c12y = new coord();
c12x.val = 22;
c12y.val = 88;
p12.x = c12x;
p12.y = c12y;
l1.end = p12;
line l2 = new line();
point p21 = new point();
coord c21x = new coord();
coord c21y = new coord();
c21x.val = 17;
c21y.val = 42;
p21.x = c21x;
p21.y = c21y;
l2.start = p21;
point p22 = new point();
coord c22x = new coord();
coord c22y = new coord();
c22x.val = 13;
c22y.val = 37;
p22.x = c22x;
p22.y = c22y;
l2.end = p22;
foo f = new foo();
f.a = 10;
f.b = 20;
f.c = false;
x.l1 = l1;
x.l2 = l2;
x.f = f;
Console.WriteLine("Encoding theTwoLines");
twoLines.encode(enc, x);
}
static void Main(string[] args)
{
FileStream stream = new FileStream(args[0],FileMode.Create);
Encoder example = new Encoder(stream);
example.doEncode();
stream.Close();
}
}
}
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using se.lth.control.labcomm2014;
namespace user_types
{
public class Encoder
{
private EncoderChannel enc;
public Encoder(Stream stream)
{
enc = new EncoderChannel(stream);
twoLines.register(enc);
}
public void doEncode()
{
twoLines x = new twoLines();
line l1 = new line();
point p11 = new point();
coord c11x = new coord();
coord c11y = new coord();
c11x.val = 11;
c11y.val = 99;
p11.x = c11x;
p11.y = c11y;
l1.start = p11;
point p12 = new point();
coord c12x = new coord();
coord c12y = new coord();
c12x.val = 22;
c12y.val = 88;
p12.x = c12x;
p12.y = c12y;
l1.end = p12;
line l2 = new line();
point p21 = new point();
coord c21x = new coord();
coord c21y = new coord();
c21x.val = 17;
c21y.val = 42;
p21.x = c21x;
p21.y = c21y;
l2.start = p21;
point p22 = new point();
coord c22x = new coord();
coord c22y = new coord();
c22x.val = 13;
c22y.val = 37;
p22.x = c22x;
p22.y = c22y;
l2.end = p22;
foo f = new foo();
f.a = 10;
f.b = 20;
f.c = false;
x.l1 = l1;
x.l2 = l2;
x.f = f;
Console.WriteLine("Encoding theTwoLines");
twoLines.encode(enc, x);
}
static void Main(string[] args)
{
FileStream stream = new FileStream(args[0],FileMode.Create);
Encoder example = new Encoder(stream);
example.doEncode();
stream.Close();
}
}
}
......@@ -34,15 +34,15 @@ ${LCLJAR} :
cleanbuild: clean build
labcomm.dll:
ln -sf ../../lib/csharp/labcomm.dll $@
labcomm2014.dll:
ln -sf ../../lib/csharp/labcomm2014.dll $@
ExampleEncoder.exe: ExampleEncoder.cs gen/test.cs labcomm.dll Makefile
mcs -out:$@ $(filter %.cs, $^) -lib:../../lib/csharp/ -r:labcomm
ExampleEncoder.exe: ExampleEncoder.cs gen/test.cs labcomm2014.dll Makefile
mcs -out:$@ $(filter %.cs, $^) -lib:../../lib/csharp/ -r:labcomm2014
chmod a+x $@
ExampleDecoder.exe: ExampleDecoder.cs gen/test.cs labcomm.dll Makefile
mcs -out:$@ $(filter %.cs, $^) -lib:../../lib/csharp/ -r:labcomm
ExampleDecoder.exe: ExampleDecoder.cs gen/test.cs labcomm2014.dll Makefile
mcs -out:$@ $(filter %.cs, $^) -lib:../../lib/csharp/ -r:labcomm2014
chmod a+x $@
build :
......
......@@ -11,9 +11,9 @@ MODULES=Constant\
SampleType
.PHONY: all
all: labcomm.dll
all: labcomm2014.dll
labcomm.dll: $(MODULES:%=se/lth/control/labcomm/%.cs) Makefile
labcomm2014.dll: $(MODULES:%=se/lth/control/labcomm2014/%.cs) Makefile
mcs -out:$@ -target:library $(filter %.cs, $^)
.PHONY: test
......@@ -24,4 +24,4 @@ clean:
.PHONY: distclean
distclean:
rm -f labcomm.dll
rm -f labcomm2014.dll
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
public class Constant {
......
using System;
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
public interface Decoder {
......
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
using System;
using System.IO;
......
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
using System;
using System.Collections.Generic;
......
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
using System;
......
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
using System;
using System.IO;
......
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
using System;
using System.Collections.Generic;
......
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
public interface Sample {
......
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
using System;
......
namespace se.lth.control.labcomm {
namespace se.lth.control.labcomm2014 {
public interface SampleHandler {
}
......
TESTS=basic simple nested ref
LABCOMM_JAR=../compiler/labcomm_compiler.jar
LABCOMM_JAR=../compiler/labcomm2014_compiler.jar
LABCOMM=java -jar $(LABCOMM_JAR)
include ../lib/c/os_compat.mk
......@@ -78,13 +78,13 @@ gen/%/cs_relay.cs: gen/%/typeinfo relay_gen_cs.py Makefile
./relay_gen_cs.py $< > $@
.PRECIOUS: gen/%/labcomm.dll
gen/%/labcomm.dll:
ln -s ../../../lib/csharp/labcomm.dll $@
gen/%/labcomm2014.dll:
ln -s ../../../lib/csharp/labcomm2014.dll $@
.PRECIOUS: gen/%/cs_relay.exe
gen/%/cs_relay.exe: gen/%/cs_relay.cs gen/%/cs_code.cs \
gen/%/labcomm.dll Makefile
mcs -out:$@ $(filter %.cs, $^) -lib:../lib/csharp/ -r:labcomm
gen/%/labcomm2014.dll Makefile
mcs -out:$@ $(filter %.cs, $^) -lib:../lib/csharp/ -r:labcomm2014
# Java relay test rules
.PRECIOUS: gen/%/java_code
......
......@@ -30,7 +30,7 @@ if __name__ == '__main__':
result.extend(split_match('^[^|]*\|(.*)$', """
|using System;
|using System.IO;
|using se.lth.control.labcomm;
|using se.lth.control.labcomm2014;
|
|public class cs_relay :
"""))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment