diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-01-14 17:30:49 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-01-14 17:30:49 +0200 |
commit | d32d3226580baf52f60fb7dee3921d8cc9aab67c (patch) | |
tree | a2da002b9aa8db7a67b49ee266fab7619ed769fd /generator/nanopb_generator.py | |
parent | b9baec6b4c3a04136ea0430109bc7bc1eda12685 (diff) |
Add field type FT_IGNORE to generator.
This allows ignoring fields that are unnecessary or too large for an
embedded system using nanopb, while allowing them to remain in the .proto
for other platforms.
Update issue 51
Status: FixedInGit
Diffstat (limited to 'generator/nanopb_generator.py')
-rw-r--r-- | generator/nanopb_generator.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index a583b3f6..9e85a11d 100644 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -306,7 +306,13 @@ class Field: class Message: def __init__(self, names, desc, message_options): self.name = names - self.fields = [Field(self.name, f, get_nanopb_suboptions(f, message_options)) for f in desc.field] + self.fields = [] + + for f in desc.field: + field_options = get_nanopb_suboptions(f, message_options) + if field_options.type != nanopb_pb2.FT_IGNORE: + self.fields.append(Field(self.name, f, field_options)) + self.packed = message_options.packed_struct self.ordered_fields = self.fields[:] self.ordered_fields.sort() |