1.1 --- a/program.c Thu Apr 23 00:03:59 2020 +0200
1.2 +++ b/program.c Thu Apr 23 23:12:19 2020 +0200
1.3 @@ -199,7 +199,7 @@
1.4
1.5 void write_compound_output(struct interface *iface)
1.6 {
1.7 - char *protocol;
1.8 + char *protocol, *ref;
1.9 int input_items;
1.10
1.11 if (compound_dispatch_fp != NULL)
1.12 @@ -210,8 +210,14 @@
1.13 the same protocol applies to an entire interface. */
1.14
1.15 if (protocol != NULL)
1.16 + {
1.17 + ref = get_object_conversion(iface, 1);
1.18 +
1.19 fprintf(compound_dispatch_fp, dispatch_function_interface_case,
1.20 - protocol, iface->name);
1.21 + protocol, iface->name, ref);
1.22 +
1.23 + free(ref);
1.24 + }
1.25
1.26 /* Or dispatch to each operation defined at this level. */
1.27
1.28 @@ -289,9 +295,19 @@
1.29 if (conf.language == CPP_LANGUAGE)
1.30 fputs(compound_interface_epilogue_cpp, compound_interface_fp);
1.31 else
1.32 + {
1.33 fprintf(compound_interface_fp, compound_interface_epilogue_c,
1.34 conf.compound_name);
1.35
1.36 + /* Include reference and object types. */
1.37 +
1.38 + fprintf(compound_interface_fp, ref_type_definition_c, L4_CAP_TYPE,
1.39 + conf.compound_name);
1.40 +
1.41 + fprintf(compound_interface_fp, object_type_definition_c,
1.42 + conf.compound_name, conf.compound_name, conf.compound_name);
1.43 + }
1.44 +
1.45 fclose(compound_interface_fp);
1.46 }
1.47
2.1 --- a/templates.h Thu Apr 23 00:03:59 2020 +0200
2.2 +++ b/templates.h Thu Apr 23 23:12:19 2020 +0200
2.3 @@ -123,7 +123,7 @@
2.4 "#pragma once\n\n"
2.5
2.6 #define compound_interface_conversion \
2.7 -"\n#define convert_to_%s(_self) (&((%s) {.ref=(ref_%s) *_self, .iface=_self->iface->to_%s}))\n"
2.8 +"\n#define convert_to_%s(_self) (&((%s) {.ref={.ptr=_self->ref.ptr}, .iface=_self->iface->to_%s}))\n"
2.9
2.10 /* Dispatch functions. */
2.11
2.12 @@ -289,7 +289,7 @@
2.13
2.14 #define dispatch_function_interface_case \
2.15 " case %s:\n" \
2.16 -" dispatch_%s(msg, _self);\n" \
2.17 +" dispatch_%s(msg, %s);\n" \
2.18 " break;\n\n"
2.19
2.20 #define dispatch_function_wrapper_case \