Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
LabComm
Commits
5b97cd63
Commit
5b97cd63
authored
Mar 03, 2015
by
Anders Blomdell
Browse files
Renamed C# to labcomm2014
parent
70df32f9
Changes
21
Hide whitespace changes
Inline
Side-by-side
compiler/2014/CS_CodeGen.jrag
View file @
5b97cd63
...
...
@@ -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.labcomm
2014
;");
for (int i = 0; i < getNumDecl(); i++) {
Decl d = getDecl(i);
try {
...
...
examples/robot/Program.cs
View file @
5b97cd63
using
se.lth.control.labcomm
;
using
se.lth.control.labcomm
2014
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
examples/user_types/.gitignore
View file @
5b97cd63
gen
labcomm.dll
labcomm
2014
.dll
ExampleDecoder.exe
ExampleEncoder.exe
encoded_data_c
...
...
examples/user_types/ExampleDecoder.cs
View file @
5b97cd63
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.IO
;
using
se.lth.control.labcomm
;
namespace
user_types
{
class
Decoder
:
twoLines
.
Handler
,
twoInts
.
Handler
,
theFirstInt
.
Handler
,
theSecondInt
.
Handler
,
doavoid
.
Handler
,
intAndRef
.
Handler
{
DecoderChannel
dec
;
public
Decoder
(
Stream
stream
)
{
dec
=
new
DecoderChannel
(
stream
);
twoLines
.
register
(
dec
,
this
);
twoInts
.
register
(
dec
,
this
);
theFirstInt
.
register
(
dec
,
this
);
theSecondInt
.
register
(
dec
,
this
);
doavoid
.
register
(
dec
,
this
);
intAndRef
.
register
(
dec
,
this
);
doavoid
.
registerSampleRef
(
dec
);
try
{
Console
.
WriteLine
(
"Running decoder."
);
dec
.
run
();
}
catch
(
EndOfStreamException
)
{
Console
.
WriteLine
(
"EOF reached"
);
}
}
private
string
genPoint
(
point
p
)
{
return
"("
+
p
.
x
.
val
+
", "
+
p
.
y
.
val
+
")"
;
}
private
String
genLine
(
line
l
)
{
return
"Line from "
+
genPoint
(
l
.
start
)
+
" to "
+
genPoint
(
l
.
end
);
}
public
void
handle
(
twoLines
d
)
{
Console
.
WriteLine
(
"Got twoLines: "
);
Console
.
WriteLine
(
"Line l1: "
+
genLine
(
d
.
l1
));
Console
.
WriteLine
(
"Line l2: "
+
genLine
(
d
.
l2
));
}
public
void
handle
(
twoInts
d
)
{
Console
.
WriteLine
(
"Got twoInts: "
);
Console
.
WriteLine
(
"a: "
+
d
.
a
);
Console
.
WriteLine
(
"b: "
+
d
.
b
);
}
void
theFirstInt
.
Handler
.
handle
(
int
d
)
{
Console
.
WriteLine
(
"Got theFirstInt: "
+
d
);
}
void
theSecondInt
.
Handler
.
handle
(
int
d
)
{
Console
.
WriteLine
(
"Got theSecondInt: "
+
d
);
}
void
doavoid
.
Handler
.
handle
()
{
Console
.
WriteLine
(
"Got a void."
);
}
void
intAndRef
.
Handler
.
handle
(
intAndRef
d
)
{
Console
.
WriteLine
(
"Got intAndRef: "
+
d
.
x
+
" : "
+
d
.
reference
);
}
static
void
Main
(
string
[]
args
)
{
new
Decoder
(
new
FileStream
(
args
[
0
],
FileMode
.
Open
));
}
}
}
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.IO
;
using
se.lth.control.labcomm
2014
;
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
));
}
}
}
examples/user_types/ExampleEncoder.cs
View file @
5b97cd63
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.labcomm
2014
;
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
();
}
}
}
examples/user_types/Makefile
View file @
5b97cd63
...
...
@@ -34,15 +34,15 @@ ${LCLJAR} :
cleanbuild
:
clean build
labcomm.dll
:
ln
-sf
../../lib/csharp/labcomm.dll
$@
labcomm
2014
.dll
:
ln
-sf
../../lib/csharp/labcomm
2014
.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 labcomm
2014
.dll Makefile
mcs
-out
:
$@
$(
filter
%.cs,
$^
)
-lib
:../../lib/csharp/
-r
:labcomm
2014
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 labcomm
2014
.dll Makefile
mcs
-out
:
$@
$(
filter
%.cs,
$^
)
-lib
:../../lib/csharp/
-r
:labcomm
2014
chmod
a+x
$@
build
:
...
...
lib/csharp/.gitignore
View file @
5b97cd63
labcomm.dll
labcomm
2014
.dll
lib/csharp/Makefile
View file @
5b97cd63
...
...
@@ -11,9 +11,9 @@ MODULES=Constant\
SampleType
.PHONY
:
all
all
:
labcomm.dll
all
:
labcomm
2014
.dll
labcomm.dll
:
$(MODULES:%=se/lth/control/labcomm/%.cs) Makefile
labcomm
2014
.dll
:
$(MODULES:%=se/lth/control/labcomm
2014
/%.cs) Makefile
mcs
-out
:
$@
-target
:library
$(
filter
%.cs,
$^
)
.PHONY
:
test
...
...
@@ -24,4 +24,4 @@ clean:
.PHONY
:
distclean
distclean
:
rm
-f
labcomm.dll
rm
-f
labcomm
2014
.dll
lib/csharp/se/lth/control/labcomm/Constant.cs
→
lib/csharp/se/lth/control/labcomm
2014
/Constant.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
public
class
Constant
{
...
...
lib/csharp/se/lth/control/labcomm/Decoder.cs
→
lib/csharp/se/lth/control/labcomm
2014
/Decoder.cs
View file @
5b97cd63
using
System
;
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
public
interface
Decoder
{
...
...
lib/csharp/se/lth/control/labcomm/DecoderChannel.cs
→
lib/csharp/se/lth/control/labcomm
2014
/DecoderChannel.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
using
System
;
using
System.IO
;
...
...
lib/csharp/se/lth/control/labcomm/DecoderRegistry.cs
→
lib/csharp/se/lth/control/labcomm
2014
/DecoderRegistry.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
using
System
;
using
System.Collections.Generic
;
...
...
lib/csharp/se/lth/control/labcomm/Encoder.cs
→
lib/csharp/se/lth/control/labcomm
2014
/Encoder.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
using
System
;
...
...
lib/csharp/se/lth/control/labcomm/EncoderChannel.cs
→
lib/csharp/se/lth/control/labcomm
2014
/EncoderChannel.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
using
System
;
using
System.IO
;
...
...
lib/csharp/se/lth/control/labcomm/EncoderRegistry.cs
→
lib/csharp/se/lth/control/labcomm
2014
/EncoderRegistry.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
using
System
;
using
System.Collections.Generic
;
...
...
lib/csharp/se/lth/control/labcomm/Sample.cs
→
lib/csharp/se/lth/control/labcomm
2014
/Sample.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
public
interface
Sample
{
...
...
lib/csharp/se/lth/control/labcomm/SampleDispatcher.cs
→
lib/csharp/se/lth/control/labcomm
2014
/SampleDispatcher.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
using
System
;
...
...
lib/csharp/se/lth/control/labcomm/SampleHandler.cs
→
lib/csharp/se/lth/control/labcomm
2014
/SampleHandler.cs
View file @
5b97cd63
namespace
se.lth.control.labcomm
{
namespace
se.lth.control.labcomm
2014
{
public
interface
SampleHandler
{
}
...
...
lib/csharp/se/lth/control/labcomm/SampleType.cs
→
lib/csharp/se/lth/control/labcomm
2014
/SampleType.cs
View file @
5b97cd63
File moved
test/Makefile
View file @
5b97cd63
TESTS
=
basic simple nested ref
LABCOMM_JAR
=
../compiler/labcomm_compiler.jar
LABCOMM_JAR
=
../compiler/labcomm
2014
_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/%/labcomm
2014
.dll
:
ln
-s
../../../lib/csharp/labcomm
2014
.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/%/labcomm
2014
.dll Makefile
mcs
-out
:
$@
$(
filter
%.cs,
$^
)
-lib
:../lib/csharp/
-r
:labcomm
2014
# Java relay test rules
.PRECIOUS
:
gen/%/java_code
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment