diff options
-rw-r--r-- | build-aux/qmi-codegen/Container.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/Variable.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableArray.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableInteger.py | 13 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableSequence.py | 4 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableString.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableStruct.py | 8 |
7 files changed, 17 insertions, 16 deletions
diff --git a/build-aux/qmi-codegen/Container.py b/build-aux/qmi-codegen/Container.py index d7488f1..d79722b 100644 --- a/build-aux/qmi-codegen/Container.py +++ b/build-aux/qmi-codegen/Container.py @@ -140,7 +140,7 @@ class Container: if self.fields is not None: for field in self.fields: if field.variable is not None: - variable_declaration = field.variable.build_variable_declaration(' ', field.variable_name) + variable_declaration = field.variable.build_variable_declaration(False, ' ', field.variable_name) translations['field_variable_name'] = field.variable_name translations['field_name'] = field.name template = ( diff --git a/build-aux/qmi-codegen/Variable.py b/build-aux/qmi-codegen/Variable.py index cc992c6..d3691a3 100644 --- a/build-aux/qmi-codegen/Variable.py +++ b/build-aux/qmi-codegen/Variable.py @@ -94,7 +94,7 @@ class Variable: """ Builds the code to include the declaration of a variable of this kind. """ - def build_variable_declaration(self, line_prefix, variable_name): + def build_variable_declaration(self, public, line_prefix, variable_name): return '' """ diff --git a/build-aux/qmi-codegen/VariableArray.py b/build-aux/qmi-codegen/VariableArray.py index b1c8110..a00fae5 100644 --- a/build-aux/qmi-codegen/VariableArray.py +++ b/build-aux/qmi-codegen/VariableArray.py @@ -325,7 +325,7 @@ class VariableArray(Variable): """ Variable declaration """ - def build_variable_declaration(self, line_prefix, variable_name): + def build_variable_declaration(self, public, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'name' : variable_name } diff --git a/build-aux/qmi-codegen/VariableInteger.py b/build-aux/qmi-codegen/VariableInteger.py index 44a0761..060548d 100644 --- a/build-aux/qmi-codegen/VariableInteger.py +++ b/build-aux/qmi-codegen/VariableInteger.py @@ -245,13 +245,18 @@ class VariableInteger(Variable): """ Variable declaration """ - def build_variable_declaration(self, line_prefix, variable_name): + def build_variable_declaration(self, public, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'private_format' : self.private_format, + 'public_format' : self.public_format, 'name' : variable_name } - - template = ( - '${lp}${private_format} ${name};\n') + template = '' + if public: + template += ( + '${lp}${public_format} ${name};\n') + else: + template += ( + '${lp}${private_format} ${name};\n') return string.Template(template).substitute(translations) diff --git a/build-aux/qmi-codegen/VariableSequence.py b/build-aux/qmi-codegen/VariableSequence.py index c69a0e6..e0d2e00 100644 --- a/build-aux/qmi-codegen/VariableSequence.py +++ b/build-aux/qmi-codegen/VariableSequence.py @@ -120,10 +120,10 @@ class VariableSequence(Variable): """ Variable declaration """ - def build_variable_declaration(self, line_prefix, variable_name): + def build_variable_declaration(self, public, line_prefix, variable_name): built = '' for member in self.members: - built += member['object'].build_variable_declaration(line_prefix, variable_name + '_' + member['name']) + built += member['object'].build_variable_declaration(public, line_prefix, variable_name + '_' + member['name']) return built diff --git a/build-aux/qmi-codegen/VariableString.py b/build-aux/qmi-codegen/VariableString.py index 355fe4a..f7e1dcb 100644 --- a/build-aux/qmi-codegen/VariableString.py +++ b/build-aux/qmi-codegen/VariableString.py @@ -152,7 +152,7 @@ class VariableString(Variable): """ Variable declaration """ - def build_variable_declaration(self, line_prefix, variable_name): + def build_variable_declaration(self, public, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'name' : variable_name } diff --git a/build-aux/qmi-codegen/VariableStruct.py b/build-aux/qmi-codegen/VariableStruct.py index b19b4c6..445af71 100644 --- a/build-aux/qmi-codegen/VariableStruct.py +++ b/build-aux/qmi-codegen/VariableStruct.py @@ -81,11 +81,7 @@ class VariableStruct(Variable): f.write(string.Template(template).substitute(translations)) for member in self.members: - translations['variable_format'] = member['object'].public_format - translations['variable_name'] = member['name'] - template = ( - ' ${variable_format} ${variable_name};\n') - f.write(string.Template(template).substitute(translations)) + f.write(member['object'].build_variable_declaration(True, ' ', member['name'])) template = ('} ${format};\n') f.write(string.Template(template).substitute(translations)) @@ -149,7 +145,7 @@ class VariableStruct(Variable): """ Variable declaration """ - def build_variable_declaration(self, line_prefix, variable_name): + def build_variable_declaration(self, public, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'format' : self.public_format, 'name' : variable_name } |