Skip to content

Commit

Permalink
nanopb.proto: add back in again
Browse files Browse the repository at this point in the history
This broke external (i.e. non-machinekit builds) like QtQuickVCP

we'll keep nanopb.proto in machinetalk-protobuf and check during
the machinekit build if the nanopb.proto file from this repo differs
from the one which is brought into the machinekit repo as a git subtree
from machinekit/nanopb (pathname src/machinetalk/nanopb/generator/proto/nanopb.proto)

Since the change frequency of nanopb.proto is fairly low and external builds
are unlikely to use the nanopb options, using an outdated nanopb.proto
in an external build is unlikely to cause issues
  • Loading branch information
Michael Haberler committed Sep 9, 2014
1 parent 8ac9d71 commit 6bf4e05
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions proto/nanopb.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Custom options for defining:
// - Maximum size of string/bytes
// - Maximum number of elements in array
//
// These are used by nanopb to generate statically allocable structures
// for memory-limited environments.

import "google/protobuf/descriptor.proto";

option java_package = "fi.kapsi.koti.jpa.nanopb";

enum FieldType {
FT_DEFAULT = 0; // Automatically decide field type, generate static field if possible.
FT_CALLBACK = 1; // Always generate a callback field.
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.
}

// This is the inner options message, which basically defines options for
// a field. When it is used in message or file scope, it applies to all
// fields.
message NanoPBOptions {
// Allocated size for 'bytes' and 'string' fields.
optional int32 max_size = 1;

// Allocated number of entries in arrays ('repeated' fields)
optional int32 max_count = 2;

// Force type of field (callback or static allocation)
optional FieldType type = 3 [default = FT_DEFAULT];

// Use long names for enums, i.e. EnumName_EnumValue.
optional bool long_names = 4 [default = true];

// Add 'packed' attribute to generated structs.
// Note: this cannot be used on CPUs that break on unaligned
// accesses to variables.
optional bool packed_struct = 5 [default = false];

// Skip this message
optional bool skip_message = 6 [default = false];
}

// Extensions to protoc 'Descriptor' type in order to define options
// inside a .proto file.
//
// Protocol Buffers extension number registry
// --------------------------------
// Project: Nanopb
// Contact: Petteri Aimonen <[email protected]>
// Web site: http://kapsi.fi/~jpa/nanopb
// Extensions: 1010 (all types)
// --------------------------------

extend google.protobuf.FileOptions {
optional NanoPBOptions nanopb_fileopt = 1010;
}

extend google.protobuf.MessageOptions {
optional NanoPBOptions nanopb_msgopt = 1010;
}

extend google.protobuf.EnumOptions {
optional NanoPBOptions nanopb_enumopt = 1010;
}

extend google.protobuf.FieldOptions {
optional NanoPBOptions nanopb = 1010;
}


0 comments on commit 6bf4e05

Please sign in to comment.