1.1 --- a/templates.h Sat Dec 10 01:28:22 2022 +0100
1.2 +++ b/templates.h Tue Dec 13 17:04:42 2022 +0100
1.3 @@ -87,16 +87,6 @@
1.4
1.5
1.6
1.7 -/* Compound interface dispatcher templates. */
1.8 -
1.9 -#define compound_dispatch_prologue \
1.10 -"#include \"%s_server.h\"\n"
1.11 -
1.12 -#define compound_dispatch_function_prologue \
1.13 -" long err;\n\n" \
1.14 -" switch (l4_msgtag_label(msg->tag))\n" \
1.15 -" {\n"
1.16 -
1.17 /* Compound interface definitions. */
1.18
1.19 #define compound_interface_include \
1.20 @@ -128,8 +118,32 @@
1.21 #define dispatch_function_signature \
1.22 "\nvoid dispatch_%s(ipc_message_t *msg, %s *_self)"
1.23
1.24 +#define dispatch_function_prologue \
1.25 +" long err;\n\n"
1.26 +
1.27 +#define dispatch_function_test_protocol \
1.28 +" if (l4_msgtag_label(msg->tag) != %s)\n" \
1.29 +" {\n" \
1.30 +" ipc_message_send_error(msg, -L4_EBADPROTO);\n" \
1.31 +" return;\n" \
1.32 +" }\n"
1.33 +
1.34 +#define dispatch_function_label_dispatcher \
1.35 +" switch (l4_msgtag_label(msg->tag))\n" \
1.36 +" {\n"
1.37 +
1.38 +#define dispatch_function_word_dispatcher \
1.39 +" switch (ipc_message_get_word(msg, 0))\n" \
1.40 +" {\n"
1.41 +
1.42 /* Dispatch templates. */
1.43
1.44 +#define dispatch_function_case_prologue \
1.45 +" case %s:\n"
1.46 +
1.47 +#define dispatch_function_case_epilogue \
1.48 +" break;\n\n"
1.49 +
1.50 #define dispatch_function_interface_case \
1.51 " case %s:\n" \
1.52 " dispatch_%s(msg, %s);\n" \