summaryrefslogtreecommitdiffstats
path: root/generator
AgeCommit message (Collapse)AuthorFilesLines
2017-02-25Add transitional options.proto file (#241)Petteri Aimonen1-0/+120
2017-02-25Add better error message on Python library version imcompatibility (issue #240)Petteri Aimonen1-0/+14
2017-02-22Extend inline / fixed length bytes array support (issue #244)Petteri Aimonen2-31/+38
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".
2017-02-20Add new option max_length for strings (issue #107)Petteri Aimonen2-0/+9
Max_size is the allocated size, so users had to add +1 for the null terminator. Max_length does the +1 automatically in the generator.
2017-01-20Fix documentation for protoc --plugin argumentMaxim Khitrov2-2/+2
2016-12-31Fix multiple oneofs in same message (issue #229)Petteri Aimonen1-5/+15
Previously the field iterator logic didn't know whether two oneof fields were part of the same union, or separate. This caused wrong pointers to be calculated if multiple oneofs were inside a single message. This commit fixes this by using dataoffset of PB_SIZE_MAX to indicate union fields after the first field. Theoretically PB_SIZE_MAX is also a valid value for data offset, which could cause errors. Adding a compile-time assert for this is somewhat difficult. However I consider it extremely unlikely that there is any platform that could trigger this situation, as it would require 255 bytes of extra data/padding between two protobuf oneof fields. On 64-bit architectures the worst case is 16 bytes, and even esoteric platforms only align to 64 bytes or so. Manual modification of the generated .pb.h file could trigger this, but even then it would require pretty bad luck to happen.
2016-12-22Allow overriding proto3 mode (#228)Petteri Aimonen1-4/+4
2016-11-22Small indentation and naming fixes to enum_to_string functionalityPetteri Aimonen1-5/+5
2016-11-21nanopb: update generator to emit optional enum->string mapping functionWilliam A. Kennington III2-0/+27
Google-Bug-Id: 28000875 Signed-off-by: William A. Kennington III <wak@google.com> Change-Id: I1bffd39168abe04593588291b0ebbe5199a00138
2016-10-30Setting version to 0.3.8-devPetteri Aimonen1-1/+1
2016-10-30Publishing nanopb-0.3.7Petteri Aimonen1-1/+1
2016-10-23Set the proto3 option by default if file specifies proto3 syntaxPetteri Aimonen1-0/+3
2016-10-23Fix missing warning with large bytes fields (issue #220)Petteri Aimonen1-2/+5
Need to generate compile time check if the bytes field + size field might exceed 255 bytes. Also eliminated spurious checks generated for some callback fields.
2016-10-09Add proto3 option to handle singular fieldsBernhard Krämer2-5/+10
2016-08-04Add inline allocation of bytes fieldsTom Roeder2-6/+30
This commit adds a new FT_INLINE allocation type that forces bytes fields to be inlined into the struct. E.g., pb_byte_t my_bytes[32]. This requires max_size for the bytes field. The FT_INLINE type is represented as a new LTYPE: FT_LTYPE_FIXED_LENGTH_BYTES. This commit also updates the documentation with FT_INLINE and FT_LTYPE_FIXED_LENGTH_BYTES. Added an AUTHORS file in apparent order of appearance in the git log history from $(git log --all).
2016-07-23Include package name in include guard (issue #207).Petteri Aimonen1-1/+4
Fix suggested by Ulenspiegel. Also added testcase for the same.
2016-06-19Setting version to 0.3.7-devPetteri Aimonen1-1/+1
2016-06-19Publishing nanopb-0.3.6Petteri Aimonen1-1/+1
2016-05-25Fix error in STATIC_ASSERT with multiple files (issue #203)Petteri Aimonen1-1/+1
The FieldMaxSize class was reusing the same list instance, causing problems when multiple files were specified on the protoc command line.
2016-03-04Provide comments about uncalculable message sizes (issue #195)Petteri Aimonen1-1/+3
2016-02-20Merge pull request #194 from isotes/masterPetteri Aimonen1-0/+4
Generate MIN/MAX/ARRAYSIZE for enums
2016-02-19Generate MIN/MAX/ARRAYSIZE for enumsisotes1-0/+4
This generates #defines mirroring the following values from the generated C++ code of GPB * const Foo Foo_MIN: the smallest valid value of the enum (VALUE_A in the example). * const Foo Foo_MAX: the largest valid value of the enum (VALUE_C in the example). * const Foo Foo_ARRAYSIZE: always defined as Foo_MAX + 1.
2016-02-19Add -D option to specify output directoryKenshi Kawaguchi1-7/+21
2016-02-13Setting version to 0.3.6-devPetteri Aimonen1-1/+1
2016-02-13Publishing nanopb-0.3.5Petteri Aimonen1-1/+1
2016-02-06Add code generator insertion points to files (#178).Petteri Aimonen1-0/+6
2016-01-27Fix a few remaining bugs related to CHAR_BIT!=8 platforms.Petteri Aimonen1-1/+1
2015-11-21Fix mistake in previous commitPetteri Aimonen1-1/+2
2015-11-20Fix generator crash with Enum inside Oneof (issue #188).Petteri Aimonen1-6/+10
Add testcase for the same.
2015-11-14Add testcase for anonymous unions + few fixes.Petteri Aimonen1-5/+11
Fixes compilation error with anonymous unions when it is not the last field in message. Also fixes extraneous newlines in header file. Cleanup the pb.h extraneous use of ##.
2015-11-10Add option to allow for anonymous unionsBenjamin Kamath2-3/+19
2015-10-07generator: Remove trailing whitespaceKyle Manna1-137/+137
* Remove trailing whitespace * No functional changes
2015-10-05Fix regression in generating message size defines (issue #172).Petteri Aimonen1-9/+9
This bug was triggered when: 1. A .proto file included another .proto from a different directory. 2. The another .proto has an associated .options file. Added regression test for the same.
2015-09-26Clean up the python2/python3 string type handlingPetteri Aimonen1-10/+9
2015-09-26Merge pull request #169 from kylemanna/python3Petteri Aimonen2-39/+65
Add proper Python3 support to the generator
2015-09-26Setting version to 0.3.5-devPetteri Aimonen1-1/+1
2015-09-26Publishing nanopb-0.3.4Petteri Aimonen1-1/+1
2015-09-21generator: Use search $PATH for pythonKyle Manna1-1/+1
* Search $PATH for the python binary so that this works better with things like virtualenv as used on Travis CI
2015-09-20generator: Fix strange unicode/str issue in python2Kyle Manna1-1/+8
* Work around this by checking the appropriate class for the given * environment.
2015-09-20generator: Attempt to simplify the str/unicode madnessKyle Manna1-0/+2
* This is a shot in the dark.
2015-09-20generator: Strings are utf-8 by default in python3Kyle Manna1-4/+2
* Not sure how to handle this case in python2, seems to work * Python 3 doesn't need this since all strings are utf-8
2015-09-20generator: Remove cmp() to work with Python3Kyle Manna1-5/+2
* Python3 ignores cmp() and __cmp__() and only needs __lt__() for sorting. Delete and update as appropriate. * Ref: https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons
2015-09-20generator: More exhaustive field size checkingKyle Manna1-15/+36
Create a FieldMaxSize class that: * Accumlates all C assertions * Handles the checking of the longest simple field * Also python3 doesn't support max(None)
2015-09-20generator: Use python2/3 binary read/write methodKyle Manna1-3/+4
* This works with python2 and python3
2015-09-20generator: Run python's 2to3 converterKyle Manna1-10/+11
* Invoked with `2to3 -w nanopb_generator.py` * No other changes.
2015-09-20generator: Don't force python2Kyle Manna1-2/+1
Python2 is being phased out of the default python interpreter. Arch Linux has moved some time ago and upcoming Debian realeases will follow. My distro, Arch, doesn't have a python2-protobuf version, but does have a python3 version. With a python 2 & 3 compatible generator the exact interpreter can be ignored and can use the system default as most users expect. Update issue #155
2015-09-13Fix maximum encoded size for negative enums (issue #166).Petteri Aimonen1-1/+15
2015-09-12Make the generator understand included files (issue #165).Petteri Aimonen1-29/+59
This will allow message sizes and enum options to be available across the include files. Currently searching for .options files for included files may not work for all path combinations, this is related to issue #116. Should probably make a pull request to protoc about that.
2015-09-12Refactor the generator logic into a ProtoFile class.Petteri Aimonen1-285/+297
In preparation for multi-file support in generator. No functional changes yet.
2015-09-12Fix handling of unsigned 8- or 16-bit enums.Petteri Aimonen1-1/+16
Previously unsigned enums would throw errors on decoding if the value went outside the signed range (issue #164). Currently only helps for enums defined within the same file, but solving issue #165 will make it work for multiple files also.