summaryrefslogtreecommitdiffstats
path: root/generator/proto
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-02-22 21:06:32 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-02-22 21:10:26 +0200
commit07375a126337916f3a34ea94f8085b8f89d789a1 (patch)
treeef95d9138252d8ae4797e0a7092bc7417c1abefb /generator/proto
parentca74746e23b5a9e7916e8fde6632d71d61603f50 (diff)
Extend inline / fixed length bytes array support (issue #244)
Adds support for proto3 and POINTER field types to have fixed length bytes arrays. Also changed the .proto option to a separate fixed_length:true, while also supporting the old FT_INLINE option. Restructured the generator and decoder logic to threat the inline bytes fields more like "just another field type".
Diffstat (limited to 'generator/proto')
-rw-r--r--generator/proto/nanopb.proto5
1 files changed, 4 insertions, 1 deletions
diff --git a/generator/proto/nanopb.proto b/generator/proto/nanopb.proto
index 7d39e1c3..e4c1da79 100644
--- a/generator/proto/nanopb.proto
+++ b/generator/proto/nanopb.proto
@@ -16,7 +16,7 @@ enum FieldType {
FT_POINTER = 4; // Always generate a dynamically allocated field.
FT_STATIC = 2; // Generate a static field or raise an exception if not possible.
FT_IGNORE = 3; // Ignore the field completely.
- FT_INLINE = 5; // Always generate an inline array of fixed size.
+ FT_INLINE = 5; // Legacy option, use the separate 'fixed_length' option instead
}
enum IntSize {
@@ -77,6 +77,9 @@ message NanoPBOptions {
// Generate an enum->string mapping function (can take up lots of space).
optional bool enum_to_string = 13 [default = false];
+
+ // Generate bytes arrays with fixed length
+ optional bool fixed_length = 15 [default = false];
}
// Extensions to protoc 'Descriptor' type in order to define options