11#include "unionproto.pb.h"
27 if (iter.submsg_desc == messagetype)
45 fprintf(
stderr,
"Usage: %s (1|2|3)\n",
argv[0]);
60 else if (msgtype == 2)
63 MsgType2 msg = {
true};
66 else if (msgtype == 3)
69 MsgType3 msg = {3, 1415};
74 fprintf(
stderr,
"Unknown message type: %d\n", msgtype);
80 fprintf(
stderr,
"Encoding failed!\n");
bool encode_unionmessage(pb_ostream_t *stream, const pb_msgdesc_t *messagetype, void *message)
size_t fwrite(const void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream)
MOSAPI s32 atoi(const char *nptr)
bool pb_field_iter_next(pb_field_iter_t *iter)
bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message)
bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_iter_t *field)
bool pb_encode_submessage(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct)
pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize)