diff --git a/examples/user_types/Decoder.java b/examples/user_types/Decoder.java index 1cff15b9e2f4877ccd2594a7764ed0eb050c8511..9d15143946894d37afc12bf8124913846d44bb2a 100644 --- a/examples/user_types/Decoder.java +++ b/examples/user_types/Decoder.java @@ -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); diff --git a/examples/user_types/Encoder.java b/examples/user_types/Encoder.java index 335bc4f48e85182fe23421e4cab771f541f68bc6..ac8add67670eac6560fc282c8177b87e2c5941a6 100644 --- a/examples/user_types/Encoder.java +++ b/examples/user_types/Encoder.java @@ -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); diff --git a/examples/user_types/ExampleDecoder.cs b/examples/user_types/ExampleDecoder.cs index 7f22a9e3d9e29515e9add248122cce10109004ca..ec0f096ae1c7e03a47eea6115940e8fac5826426 100644 --- a/examples/user_types/ExampleDecoder.cs +++ b/examples/user_types/ExampleDecoder.cs @@ -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)); diff --git a/examples/user_types/TDDecoder.java b/examples/user_types/TDDecoder.java index 2f1e4f74476df937df42cd43007cb35cbf39eb1f..a68984292b9931266fb17ee2355cdcbe82536250 100644 --- a/examples/user_types/TDDecoder.java +++ b/examples/user_types/TDDecoder.java @@ -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)); diff --git a/examples/user_types/example_decoder.c b/examples/user_types/example_decoder.c index 2386564477774fdc7401a88f43dd9ec0d63e299f..27281587c6de88019e758555606ae099794db1c3 100644 --- a/examples/user_types/example_decoder.c +++ b/examples/user_types/example_decoder.c @@ -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); diff --git a/examples/user_types/test.lc b/examples/user_types/test.lc index b232512685d3dd130a5c3eb36168f0cc7655d11f..f882abb7874413ef12d9dcadb7493895cf86f8d1 100644 --- a/examples/user_types/test.lc +++ b/examples/user_types/test.lc @@ -4,6 +4,9 @@ typedef struct { typedef int anInt; +typedef void avoid; +sample avoid doavoid; + typedef struct { coord x; coord y;