summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2015-04-03 20:08:05 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2015-04-03 20:08:05 +0300
commit3bcdd49eac3aabcc121173c0023834f8bcf0a3cb (patch)
tree4d4b1c630762b108fbe6129a54ced3d0e90090a9 /generator
parent90833934a28c4ed5dc57ec649ee3d37dca57fb89 (diff)
Always define enum long names so that cross-file references work.
Update issue 118 Status: FixedInGit
Diffstat (limited to 'generator')
-rwxr-xr-xgenerator/nanopb_generator.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index fc32e2c5..eebe5404 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -164,6 +164,13 @@ class Enum:
result = 'typedef enum _%s {\n' % self.names
result += ',\n'.join([" %s = %d" % x for x in self.values])
result += '\n} %s;' % self.names
+
+ if not self.options.long_names:
+ # Define the long names always so that enum value references
+ # from other files work properly.
+ for i, x in enumerate(self.values):
+ result += '\n#define %s %s' % (self.value_longnames[i], x[0])
+
return result
class Field: