Commit 37fb1da8 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

added void type to examples/user_types

parent 541bc230
......@@ -15,7 +15,8 @@ public class Decoder
TypeDefParser.TypeDefListener,
twoInts.Handler,
theFirstInt.Handler,
theSecondInt.Handler
theSecondInt.Handler,
doavoid.Handler
{
private DecoderChannel decoder;
......@@ -25,6 +26,7 @@ public class Decoder
throws Exception
{
decoder = new DecoderChannel(in);
doavoid.register(decoder, this);
twoInts.register(decoder, this);
twoLines.register(decoder, this);
theFirstInt.register(decoder, this);
......@@ -73,6 +75,10 @@ public class Decoder
//} catch(IOException ex) { ex.printStackTrace();}
}
public void handle_doavoid() throws java.io.IOException {
System.out.println("Got a void.");
}
public void handle_twoInts(twoInts d) throws java.io.IOException {
System.out.print("Got twoInts: ");
System.out.println(d.a +", "+d.b);
......
......@@ -16,6 +16,7 @@ public class Encoder
throws Exception
{
encoder = new EncoderChannel(out);
doavoid.register(encoder);
twoInts.register(encoder);
twoLines.register(encoder);
theFirstInt.register(encoder);
......@@ -27,6 +28,9 @@ public class Encoder
ti.a = 12;
ti.b = 21;
System.out.println("Encoding doavoid");
doavoid.encode(encoder);
System.out.println("Encoding twoInts");
twoInts.encode(encoder, ti);
......
......@@ -10,7 +10,8 @@ namespace user_types
class Decoder : twoLines.Handler,
twoInts.Handler,
theFirstInt.Handler,
theSecondInt.Handler
theSecondInt.Handler,
doavoid.Handler
{
DecoderChannel dec;
......@@ -21,6 +22,7 @@ namespace user_types
twoInts.register(dec, this);
theFirstInt.register(dec, this);
theSecondInt.register(dec, this);
doavoid.register(dec, this);
try
{
Console.WriteLine("Running decoder.");
......@@ -64,6 +66,11 @@ namespace user_types
Console.WriteLine("Got theSecondInt: "+d);
}
void doavoid.Handler.handle()
{
Console.WriteLine("Got a void.");
}
static void Main(string[] args)
{
new Decoder(new FileStream(args[0], FileMode.Open));
......
......@@ -25,7 +25,8 @@ public class TDDecoder
TypeDefParser.TypeDefListener,
twoInts.Handler,
theFirstInt.Handler,
theSecondInt.Handler
theSecondInt.Handler,
doavoid.Handler
{
private DecoderChannel decoder;
......@@ -39,6 +40,7 @@ public class TDDecoder
twoLines.register(decoder, this);
theFirstInt.register(decoder, this);
theSecondInt.register(decoder, this);
doavoid.register(decoder, this);
this.tdp = TypeDefParser.registerTypeDefParser(decoder);
// TypeDef.register(decoder, this);
// TypeBinding.register(decoder, this);
......@@ -119,6 +121,10 @@ public class TDDecoder
System.out.println("Got theSecondInt: "+d);
}
public void handle_doavoid() throws java.io.IOException {
System.out.println("Got a void.");
}
public void handle_twoLines(twoLines d) throws java.io.IOException {
System.out.print("Got twoLines: ");
System.out.println("Line l1: "+genLine(d.l1));
......
......@@ -8,6 +8,10 @@
#include "gen/test.h"
#include <stdio.h>
static void handle_test_doavoid(test_doavoid *v,void *context) {
printf("Got a void.\n");
}
static void handle_test_twoInts(test_twoInts *v,void *context) {
printf("Got twoInts. (%d,%d) \n", v->a, v->b);
}
......@@ -53,6 +57,7 @@ int main(int argc, char *argv[]) {
return 1;
}
labcomm_decoder_register_test_doavoid(decoder, handle_test_doavoid, context);
labcomm_decoder_register_test_twoInts(decoder, handle_test_twoInts, context);
labcomm_decoder_register_test_theFirstInt(decoder, handle_test_theFirstInt, context);
labcomm_decoder_register_test_theSecondInt(decoder, handle_test_theSecondInt, context);
......
......@@ -4,6 +4,9 @@ typedef struct {
typedef int anInt;
typedef void avoid;
sample avoid doavoid;
typedef struct {
coord x;
coord y;
......
Supports Markdown
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