diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-10-08 13:28:28 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-10-09 15:23:47 +0200 |
commit | 148791b4ca5f20d35ffc22f623be91f1bb79177b (patch) | |
tree | 0a414d5f6a3941c09b5f7f08829119fbb42d6ffa /build-aux/qmi-codegen/VariableStruct.py | |
parent | c0c06efb3991fdbf28741c4e5edebfa5823d09cf (diff) | |
download | external_libqmi-148791b4ca5f20d35ffc22f623be91f1bb79177b.zip external_libqmi-148791b4ca5f20d35ffc22f623be91f1bb79177b.tar.gz external_libqmi-148791b4ca5f20d35ffc22f623be91f1bb79177b.tar.bz2 |
docs: improve generated `libqmi-glib' documentation
Among the tons of fixes done here, we now generate some per-service .sections
file which we then concatenate to build the final libqmi-glib-sections.txt file.
Diffstat (limited to 'build-aux/qmi-codegen/VariableStruct.py')
-rw-r--r-- | build-aux/qmi-codegen/VariableStruct.py | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/build-aux/qmi-codegen/VariableStruct.py b/build-aux/qmi-codegen/VariableStruct.py index 5b582b2..c22d9c2 100644 --- a/build-aux/qmi-codegen/VariableStruct.py +++ b/build-aux/qmi-codegen/VariableStruct.py @@ -67,6 +67,16 @@ class VariableStruct(Variable): translations = { 'format' : self.public_format } template = ( '\n' + '/**\n' + ' * ${format}:\n') + f.write(string.Template(template).substitute(translations)) + for member in self.members: + f.write(member['object'].build_struct_field_documentation(' * ', member['name'])) + + template = ( + ' *\n' + ' * A ${format} struct.\n' + ' */\n' 'typedef struct _${format} {\n') f.write(string.Template(template).substitute(translations)) @@ -173,7 +183,7 @@ class VariableStruct(Variable): 'name' : variable_name } template = ( - '${lp}@${name}: a placeholder for the output constant #${format}, or #NULL if not required.\n') + '${lp}@${name}: a placeholder for the output constant #${format}, or %NULL if not required.\n') return string.Template(template).substitute(translations) @@ -235,6 +245,19 @@ class VariableStruct(Variable): """ + Documentation for the struct field + """ + def build_struct_field_documentation(self, line_prefix, variable_name): + translations = { 'lp' : line_prefix, + 'format' : self.public_format, + 'name' : variable_name } + + template = ( + '${lp}@${name}: a #${format} struct.\n') + return string.Template(template).substitute(translations) + + + """ Disposing a struct is just about disposing each of the struct fields one by one. """ @@ -243,3 +266,14 @@ class VariableStruct(Variable): for member in self.members: built += member['object'].build_dispose(line_prefix, variable_name + '.' + member['name']) return built + + + """ + Add sections + """ + def add_sections(self, sections): + # Add sections for each member + for member in self.members: + member['object'].add_sections(sections) + + sections['public-types'] += self.public_format + '\n' |