Open GoogleCodeExporter opened 9 years ago
Original comment by Petteri.Aimonen
on 21 Mar 2015 at 3:23
I like it! What I'll do is:
try this on two proto files, run nanopb_generator on them, and hand-modify the
output along these lines
then cook up a third .c file which includes the npb.h files and exports the
struct as I need it, and see to
layer my mapping lookup API ontop.
will publish results as a git repo so the diffs are at hand easily.
Thanks!
- Michael
Original comment by haberl...@gmail.com
on 21 Mar 2015 at 6:41
what exactly did you mean by size - the generated '<msgname>_size' #define like
this comment?
/* Maximum encoded size of messages (where known) */
or the size of the fields array?
Original comment by haberl...@gmail.com
on 21 Mar 2015 at 9:59
oh I see, the size of the generated struct. DIsregard.
Original comment by haberl...@gmail.com
on 21 Mar 2015 at 10:00
works! see https://github.com/mhaberler/nanopb/commits/msgid-option
Original comment by haberl...@gmail.com
on 21 Mar 2015 at 10:08
my last wish on the issue: find a way to expand these fields in the PB_MSG macro
would it cause major breakage if you always emitted the #define as per below,
but say as -1 if the size is not known?
/* Maximum encoded size of messages (where known) */
#define SecondMessage_size 2
#define ThirdMessage_size 2
I dont see a way to expand this in PB_MSG if the symbol isnt defined at all, do
you?
Original comment by haberl...@gmail.com
on 21 Mar 2015 at 10:32
Hmm, I don't see a way either. Defining unknown messages sizes as -1 should be
safe enough, as constructs like "uint8_t buffer[FooMsg_size];" should warn for
that.
Took a quick look at the changes, seems good.
Original comment by Petteri.Aimonen
on 22 Mar 2015 at 9:03
Original issue reported on code.google.com by
Petteri.Aimonen
on 21 Mar 2015 at 3:20