summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-10-29 16:56:45 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-10-29 16:56:45 +0200
commitc3fa362653480159dff15c074f59c5fab301dd0e (patch)
tree35ffa393dc07d6e36d272e101201c8c0cf34b756 /generator
parentbffd3a9accd748f20ad4a2d75942893684b90d81 (diff)
Give names to generated structures to allow forward declaration.
Update issue 39 Status: FixedInGit
Diffstat (limited to 'generator')
-rw-r--r--generator/nanopb_generator.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index b9018ae..1c21422 100644
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -75,7 +75,7 @@ class Enum:
self.values = [(self.names + x.name, x.number) for x in desc.value]
def __str__(self):
- result = 'typedef enum {\n'
+ result = 'typedef enum _%s {\n' % self.names
result += ',\n'.join([" %s = %d" % x for x in self.values])
result += '\n} %s;' % self.names
return result
@@ -276,7 +276,7 @@ class Message:
return [str(field.ctype) for field in self.fields]
def __str__(self):
- result = 'typedef struct {\n'
+ result = 'typedef struct _%s {\n' % self.name
result += '\n'.join([str(f) for f in self.ordered_fields])
result += '\n} %s;' % self.name
return result