'''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.'''
-nanopb_version = "nanopb-0.2.1-dev"
+nanopb_version = "nanopb-0.2.1"
try:
import google.protobuf.descriptor_pb2 as descriptor
return cmp(self.tag, other.tag)
def __str__(self):
- if self.rules == 'OPTIONAL':
+ if self.rules == 'OPTIONAL' and self.allocation == 'STATIC':
result = ' bool has_' + self.name + ';\n'
elif self.rules == 'REPEATED' and self.allocation == 'STATIC':
result = ' size_t ' + self.name + '_count;\n'
result += ' pb_packed'
result += ' %s;' % self.name
+
+ if self.packed:
+ result = 'PB_PACKED_STRUCT_START\n' + result
+ result += '\nPB_PACKED_STRUCT_END'
+
return result
def types(self):