diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-10 19:16:07 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-21 19:28:14 +0200 |
commit | 49f0a99e4ce47ba93aaab1ade4df88f06110dc41 (patch) | |
tree | 77532dfa005952bbe20db196fe9616f45c7670c4 /build-aux | |
parent | 916d20baf46d5bd59204e8910a516b6d1bf50497 (diff) | |
download | libmbim-49f0a99e4ce47ba93aaab1ade4df88f06110dc41.tar.gz |
mbim-codegen: simplify API
Instead of per-variable getters, just dump a parser() method which reads all the
requested variables from the message.
Same logic for the message creators, passing all variables altogether.
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/mbim-codegen/Container.py | 140 | ||||
-rw-r--r-- | build-aux/mbim-codegen/Message.py | 225 | ||||
-rw-r--r-- | build-aux/mbim-codegen/Struct.py | 6 | ||||
-rw-r--r-- | build-aux/mbim-codegen/Value.py | 17 | ||||
-rw-r--r-- | build-aux/mbim-codegen/ValueString.py | 13 | ||||
-rw-r--r-- | build-aux/mbim-codegen/ValueStringArray.py | 16 | ||||
-rw-r--r-- | build-aux/mbim-codegen/ValueStruct.py | 15 | ||||
-rw-r--r-- | build-aux/mbim-codegen/ValueStructArray.py | 13 | ||||
-rw-r--r-- | build-aux/mbim-codegen/ValueUint32.py | 13 | ||||
-rw-r--r-- | build-aux/mbim-codegen/ValueUint32Array.py | 15 | ||||
-rw-r--r-- | build-aux/mbim-codegen/ValueUuid.py | 13 |
11 files changed, 276 insertions, 210 deletions
diff --git a/build-aux/mbim-codegen/Container.py b/build-aux/mbim-codegen/Container.py index 0becb32..46a77f2 100644 --- a/build-aux/mbim-codegen/Container.py +++ b/build-aux/mbim-codegen/Container.py @@ -76,138 +76,34 @@ class Container: elif field['format'] == 'guint32': self.fields.append(ValueUint32(field)) elif field['format'] == 'guint32-array': - self.fields.append(ValueUint32Array(field)) + new_field = ValueUint32Array(field) + self.mark_array_length(new_field.array_size_field) + self.fields.append(new_field) elif field['format'] == 'string': self.fields.append(ValueString(field)) elif field['format'] == 'string-array': - self.fields.append(ValueStringArray(field)) + new_field = ValueStringArray(field) + self.mark_array_length(new_field.array_size_field) + self.fields.append(new_field) elif field['format'] == 'struct': self.fields.append(ValueStruct(field)) elif field['format'] == 'struct-array': - self.fields.append(ValueStructArray(field)) + new_field = ValueStructArray(field) + self.mark_array_length(new_field.array_size_field) + self.fields.append(new_field) else: raise ValueError('Cannot handle field type \'%s\'' % field['format']) """ - Emit the container handling implementation + Flag the values which are used as length of arrays """ - def emit(self, hfile, cfile): - # Setup offset for reading fields - offset = 0 - # Additional offset string computation - additional_offset_str = '' - - translations = { 'underscore' : utils.build_underscore_name (self.fullname), - 'command_underscore' : utils.build_underscore_name (self.command), - 'name_underscore' : utils.build_underscore_name (self.name), - 'message_type_underscore' : utils.build_underscore_name (self.message_type), - 'message_type_enum' : self.message_type_enum } - + def mark_array_length(self, array_size_field): + found = False for field in self.fields: - translations['offset'] = offset - translations['field_name'] = field.name - translations['field_name_underscore'] = utils.build_underscore_name (field.name) - translations['method_prefix'] = '_' if field.visible == False else '' - translations['static'] = 'static ' if field.visible == False else '' - translations['getter_return'] = field.getter_return - translations['getter_return_error'] = field.getter_return_error - translations['getter_return_description'] = field.getter_return_description - translations['reader_method_name'] = field.reader_method_name - translations['additional_offset_str'] = additional_offset_str - if field.is_array: - translations['array_size_field_name_underscore'] = utils.build_underscore_name (field.array_size_field) - translations['array_member_size'] = str(field.array_member_size) - - cfile.write('\n') - - if field.visible: - # Dump the getter header - template = ( - '\n' - '${getter_return} ${underscore}_get_${field_name_underscore} (\n') - if field.is_array: - template += ( - ' const MbimMessage *self,\n' - ' guint32 *size);\n') - else: - template += ( - ' const MbimMessage *self);\n') - hfile.write(string.Template(template).substitute(translations)) - - # Dump the getter documentation - template = ( - '/**\n' - ' * ${underscore}_get_${field_name_underscore}:\n' - ' * @self: a #MbimMessage.\n') - - if field.is_array: - template += ( - ' * @size: (out) (allow-none): number of items in the output array.\n') - - template += ( - ' *\n' - ' * Get the \'${field_name}\' field from the \'${command_underscore}\' ${message_type_underscore} ${name_underscore}\n' - ' *\n' - ' * Returns: ${getter_return_description}\n' - ' */\n') - cfile.write(string.Template(template).substitute(translations)) - - # Dump the getter source - template = ( - '${static}${getter_return}\n' - '${method_prefix}${underscore}_get_${field_name_underscore} (\n') - - if field.is_array: - template += ( - ' const MbimMessage *self,\n' - ' guint32 *size)\n') - else: - template += ( - ' const MbimMessage *self)\n') - - template += ( - '{\n' - ' guint32 offset = ${offset};\n') - - if field.is_array: - template += ( - ' guint32 tmp;\n') - - template += ( - '\n' - ' g_return_val_if_fail (MBIM_MESSAGE_GET_MESSAGE_TYPE (self) == ${message_type_enum}, ${getter_return_error});\n') - - if additional_offset_str != '': - template += ( - '\n' - ' offset += ${additional_offset_str};\n') - - if field.is_array: - # Arrays need two inputs: offset of the element indicating the size of the array, - # and the offset of where the array itself starts. The size of the array will - # be given by another field, which we must look for. - template += ( - ' tmp = _${underscore}_get_${array_size_field_name_underscore} (self);\n' - ' if (size)\n' - ' *size = tmp;\n' - ' return (${getter_return}) ${reader_method_name} (self, tmp, offset)\n;') - else: - template += ( - ' return (${getter_return}) ${reader_method_name} (self, offset);\n') - - template += ( - '}\n') - cfile.write(string.Template(template).substitute(translations)) - - # Update offsets - if field.size > 0: - offset += field.size - if field.size_string != '': - if additional_offset_str != '': - additional_offset_str += ' + ' - additional_offset_str += field.size_string - if field.is_array: - if additional_offset_str != '': - additional_offset_str += ' + ' - additional_offset_str += string.Template('(${array_member_size} * _${underscore}_get_${array_size_field_name_underscore} (self))').substitute(translations) + if field.name == array_size_field: + field.is_array_size = True + found = True + break + if found == False: + raise ValueError('Couldn\'t find array size field \'%s\'' % array_size_field) diff --git a/build-aux/mbim-codegen/Message.py b/build-aux/mbim-codegen/Message.py index a5fe08e..5dd41cc 100644 --- a/build-aux/mbim-codegen/Message.py +++ b/build-aux/mbim-codegen/Message.py @@ -62,20 +62,21 @@ class Message: self.set_output = None if self.can_set: if 'input' in dictionary['set']: - self.query_input = Container(self.service, self.name, 'Set', 'Input', dictionary['set']['input']) + self.set_input = Container(self.service, self.name, 'Set', 'Input', dictionary['set']['input']) if 'output' in dictionary['set']: - self.query_output = Container(self.service, self.name, 'Set', 'Output', dictionary['set']['output']) + self.set_output = Container(self.service, self.name, 'Set', 'Output', dictionary['set']['output']) # Build Notify containers self.notify_output = None if self.can_notify: if 'output' in dictionary['notify']: - self.query_output = Container(self.service, self.name, 'Notify', 'Output', dictionary['notify']['output']) + self.notify_output = Container(self.service, self.name, 'Notify', 'Output', dictionary['notify']['output']) + """ - Emit request creator + Emit message creator """ - def _emit_request_creator(self, hfile, cfile, message_type): + def _emit_message_creator(self, hfile, cfile, message_type, container): translations = { 'name' : self.name, 'service' : self.service, 'underscore' : utils.build_underscore_name (self.fullname), @@ -85,26 +86,203 @@ class Message: 'name_underscore_upper' : utils.build_underscore_name (self.name).upper() } template = ( '\n' - 'MbimMessage *${underscore}_${message_type}_request_new (guint32 transaction_id);\n') + 'MbimMessage *${underscore}_${message_type}_request_new (\n' + ' guint32 transaction_id,\n') + + if container != None: + for field in container.fields: + translations['field_name_underscore'] = utils.build_underscore_name (field.name) + translations['field_in_format'] = field.in_format + inner_template = ( + ' ${field_in_format}${field_name_underscore},\n') + template += (string.Template(inner_template).substitute(translations)) + + template += ( + ' GError **error);\n') hfile.write(string.Template(template).substitute(translations)) template = ( '\n' '/**\n' ' * ${underscore}_${message_type}_request_new:\n' - ' * @transaction_id: the transaction ID to use in the request.\n' + ' * @transaction_id: the transaction ID to use in the request.\n') + + if container != None: + for field in container.fields: + translations['field_name'] = field.name + translations['field_name_underscore'] = utils.build_underscore_name (field.name) + translations['field_in_description'] = field.in_description + inner_template = ( + ' * @${field_name_underscore}: the \'${field_name}\' field, given as ${field_in_description}\n') + template += (string.Template(inner_template).substitute(translations)) + + template += ( + ' * @error: return location for error or %NULL.\n' ' *\n' - ' * Create a new request for the \'${name}\' command in the \'${service}\' service.\n' + ' * Create a new request for the \'${name}\' ${message_type} command in the \'${service}\' service.\n' ' *\n' ' * Returns: a newly allocated #MbimMessage, which should be freed with mbim_message_unref().\n' ' */\n' 'MbimMessage *\n' - '${underscore}_${message_type}_request_new (guint32 transaction_id)\n' + '${underscore}_${message_type}_request_new (\n' + ' guint32 transaction_id,\n') + + if container != None: + for field in container.fields: + translations['field_name_underscore'] = utils.build_underscore_name (field.name) + translations['field_in_format'] = field.in_format + inner_template = ( + ' ${field_in_format}${field_name_underscore},\n') + template += (string.Template(inner_template).substitute(translations)) + + template += ( + ' GError **error)\n' '{\n' - ' return mbim_message_command_new (transaction_id,\n' - ' MBIM_SERVICE_${service_underscore_upper},\n' - ' MBIM_CID_${service_underscore_upper}_${name_underscore_upper},\n' - ' MBIM_MESSAGE_COMMAND_TYPE_${message_type_upper});\n' + ' MbimMessageCommandBuilder *builder;\n' + '\n' + ' builder = _mbim_message_command_builder_new (transaction_id,\n' + ' MBIM_SERVICE_${service_underscore_upper},\n' + ' MBIM_CID_${service_underscore_upper}_${name_underscore_upper},\n' + ' MBIM_MESSAGE_COMMAND_TYPE_${message_type_upper});\n') + + if container != None: + template += ('\n') + for field in container.fields: + translations['field_name_underscore'] = utils.build_underscore_name(field.name) + translations['field_format_underscore'] = utils.build_underscore_name(field.format) + inner_template = ( + ' _mbim_message_command_builder_append_${field_format_underscore} (builder, ${field_name_underscore});\n') + template += (string.Template(inner_template).substitute(translations)) + + template += ( + '\n' + ' return _mbim_message_command_builder_complete (builder);\n' + '}\n') + cfile.write(string.Template(template).substitute(translations)) + + + """ + Emit message parser + """ + def _emit_message_parser(self, hfile, cfile, request_or_response, message_type, container): + translations = { 'name' : self.name, + 'service' : self.service, + 'underscore' : utils.build_underscore_name (self.fullname), + 'request_or_response' : request_or_response, + 'message_type' : message_type, + 'message_type_upper' : message_type.upper(), + 'service_underscore_upper' : utils.build_underscore_name (self.service).upper(), + 'name_underscore_upper' : utils.build_underscore_name (self.name).upper() } + template = ( + '\n' + 'gboolean ${underscore}_${message_type}_${request_or_response}_parse (\n' + ' const MbimMessage *message,\n') + + if container != None: + for field in container.fields: + translations['field_name_underscore'] = utils.build_underscore_name (field.name) + translations['field_out_format'] = field.out_format + inner_template = ( + ' ${field_out_format}${field_name_underscore},\n') + template += (string.Template(inner_template).substitute(translations)) + + template += ( + ' GError **error);\n') + hfile.write(string.Template(template).substitute(translations)) + + template = ( + '\n' + '/**\n' + ' * ${underscore}_${message_type}_${request_or_response}_parse:\n' + ' * @message: the #MbimMessage.\n') + + if container != None: + for field in container.fields: + translations['field_name'] = field.name + translations['field_name_underscore'] = utils.build_underscore_name (field.name) + translations['field_out_description'] = field.out_description + inner_template = ( + ' * @${field_name_underscore}: ${field_out_description}\n') + template += (string.Template(inner_template).substitute(translations)) + + template += ( + ' * @error: return location for error or %NULL.\n' + ' *\n' + ' * Create a new request for the \'${name}\' ${message_type} command in the \'${service}\' service.\n' + ' *\n' + ' * Returns: %TRUE if the message was correctly parsed, %FALSE if @error is set.\n' + ' */\n' + 'gboolean\n' + '${underscore}_${message_type}_${request_or_response}_parse (\n' + ' const MbimMessage *message,\n') + + if container != None: + for field in container.fields: + translations['field_name_underscore'] = utils.build_underscore_name (field.name) + translations['field_out_format'] = field.out_format + inner_template = ( + ' ${field_out_format}${field_name_underscore},\n') + template += (string.Template(inner_template).substitute(translations)) + + template += ( + ' GError **error)\n' + '{\n' + ' guint32 offset = 0;\n') + if container != None: + for field in container.fields: + if field.is_array_size: + translations['field_name_underscore'] = utils.build_underscore_name (field.name) + inner_template = ( + ' guint32 _${field_name_underscore};\n') + template += (string.Template(inner_template).substitute(translations)) + + if container != None: + for field in container.fields: + translations['field_name_underscore'] = utils.build_underscore_name(field.name) + translations['field_format_underscore'] = utils.build_underscore_name(field.format) + translations['field_size'] = field.size + translations['field_size_string'] = field.size_string + translations['field_name'] = field.name + + inner_template = ( + '\n' + ' /* Read the \'${field_name}\' variable */\n' + ' {\n') + + if field.is_array: + translations['array_size_field_name_underscore'] = utils.build_underscore_name (field.array_size_field) + translations['array_member_size'] = str(field.array_member_size) + translations['struct_name'] = (field.struct_type_underscore + '_') if field.format == 'struct-array' else '' + + inner_template += ( + ' if (${field_name_underscore} != NULL)\n' + ' *${field_name_underscore} = _mbim_message_read_${struct_name}${field_format_underscore} (message, _${array_size_field_name_underscore}, offset);\n' + ' offset += (${array_member_size} * _${array_size_field_name_underscore});\n') + else: + if field.is_array_size: + inner_template += ( + ' _${field_name_underscore} = _mbim_message_read_${field_format_underscore} (message, offset);\n' + ' if (${field_name_underscore} != NULL)\n' + ' *${field_name_underscore} = _${field_name_underscore};\n') + else: + inner_template += ( + ' if (${field_name_underscore} != NULL)\n' + ' *${field_name_underscore} = _mbim_message_read_${field_format_underscore} (message, offset);\n') + if field.size > 0: + inner_template += ( + ' offset += ${field_size};\n') + if field.size_string != '': + inner_template += ( + ' offset += ${field_size_string};\n') + + inner_template += ( + ' }\n') + + template += (string.Template(inner_template).substitute(translations)) + + template += ( + '\n' + ' return TRUE;\n' '}\n') cfile.write(string.Template(template).substitute(translations)) @@ -117,34 +295,25 @@ class Message: utils.add_separator(hfile, 'Message (Query)', self.fullname); utils.add_separator(cfile, 'Message (Query)', self.fullname); - self._emit_request_creator(hfile, cfile, 'query') - + self._emit_message_creator(hfile, cfile, 'query', self.query_input) if self.query_input: - hfile.write('\n/* Query request */') - self.query_input.emit(hfile, cfile) + self._emit_message_parser(hfile, cfile, 'request', 'query', self.query_input) if self.query_output: - hfile.write('\n/* Query response */') - self.query_output.emit(hfile, cfile) + self._emit_message_parser(hfile, cfile, 'response', 'query', self.query_output) if self.can_set: utils.add_separator(hfile, 'Message (Set)', self.fullname); utils.add_separator(cfile, 'Message (Set)', self.fullname); - self._emit_request_creator(hfile, cfile, 'set') - + self._emit_message_creator(hfile, cfile, 'set', self.set_input) if self.set_input: - hfile.write('\n/* Set request */') - self.set_input.emit(hfile, cfile) + self._emit_message_parser(hfile, cfile, 'request', 'set', self.set_input) if self.set_output: - hfile.write('\n/* Set response */') - self.set_output.emit(hfile, cfile) + self._emit_message_parser(hfile, cfile, 'response', 'set', self.set_output) if self.can_notify: utils.add_separator(hfile, 'Message (Notify)', self.fullname); utils.add_separator(cfile, 'Message (Notify)', self.fullname); - if self.notify_output: - hfile.write('\n/* Indication */') - self.notify_output.emit(hfile, cfile) """ diff --git a/build-aux/mbim-codegen/Struct.py b/build-aux/mbim-codegen/Struct.py index 49065a8..8163ff6 100644 --- a/build-aux/mbim-codegen/Struct.py +++ b/build-aux/mbim-codegen/Struct.py @@ -148,7 +148,7 @@ class Struct: template = ( '\n' 'static ${name} *\n' - '_${name_underscore}_read (\n' + '_mbim_message_read_${name_underscore}_struct (\n' ' const MbimMessage *self,\n' ' guint32 relative_offset)\n' '{\n' @@ -207,7 +207,7 @@ class Struct: template = ( '\n' 'static ${name} **\n' - '_${name_underscore}_read_array (\n' + '_mbim_message_read_${name_underscore}_struct_array (\n' ' const MbimMessage *self,\n' ' guint32 array_size,\n' ' guint32 relative_offset_array_start)\n' @@ -219,7 +219,7 @@ class Struct: ' out = g_new (${name} *, array_size + 1);\n' ' offset = relative_offset_array_start;\n' ' for (i = 0; i < array_size; i++, offset += 8)\n' - ' out[i] = _${name_underscore}_read (self, _mbim_message_read_guint32 (self, offset));\n' + ' out[i] = _mbim_message_read_${name_underscore}_struct (self, _mbim_message_read_guint32 (self, offset));\n' ' out[array_size] = NULL;\n' '\n' ' return out;\n' diff --git a/build-aux/mbim-codegen/Value.py b/build-aux/mbim-codegen/Value.py index 55c68d3..389a9ba 100644 --- a/build-aux/mbim-codegen/Value.py +++ b/build-aux/mbim-codegen/Value.py @@ -33,20 +33,25 @@ class Value: """ The name of the variable """ self.name = dictionary['name'] + """ The type of the variable """ + self.format = dictionary['format'] + """ Whether this field is visible or not """ self.visible = False if 'visibility' in dictionary and dictionary['visibility'] == 'private' else True """ The public format of the value """ self.public_format = '' - """ The return type on value getters """ - self.getter_return = '' + """ Type of the value when used as input parameter """ + self.in_format = '' + self.in_description = '' - """ The return value when getter fails """ - self.getter_return_error = '' + """ Type of the value when used as output parameter """ + self.out_format = '' + self.out_description = '' - """ The description of the value returned from the getter """ - self.getter_return_description = '' + """ Flag to identify this value as being used as an array size """ + self.is_array_size = False """ The name of the method used to read the value """ self.reader_method_name = '' diff --git a/build-aux/mbim-codegen/ValueString.py b/build-aux/mbim-codegen/ValueString.py index 8e3f364..b1578a5 100644 --- a/build-aux/mbim-codegen/ValueString.py +++ b/build-aux/mbim-codegen/ValueString.py @@ -36,14 +36,13 @@ class ValueString(Value): """ The public format of the value """ self.public_format = 'gchar *' - """ The return type on value getters """ - self.getter_return = self.public_format + """ Type of the value when used as input parameter """ + self.in_format = 'const gchar *' + self.in_description = 'The \'' + self.name + '\' field, given as a constant string.' - """ The return value when getter fails """ - self.getter_return_error = 'NULL' - - """ The description of the value returned from the getter """ - self.getter_return_description = 'a newly allocated string, which should be freed with g_free().' + """ Type of the value when used as output parameter """ + self.out_format = 'gchar **' + self.out_description = 'Return location for a newly allocated string, or %NULL if the \'' + self.name + '\' field is not needed. Free the returned value with g_free().' """ The name of the method used to read the value """ self.reader_method_name = '_mbim_message_read_string' diff --git a/build-aux/mbim-codegen/ValueStringArray.py b/build-aux/mbim-codegen/ValueStringArray.py index cbc6eab..d6650a8 100644 --- a/build-aux/mbim-codegen/ValueStringArray.py +++ b/build-aux/mbim-codegen/ValueStringArray.py @@ -33,17 +33,19 @@ class ValueStringArray(Value): # Call the parent constructor Value.__init__(self, dictionary) + """ The type of the variable """ + self.type = 'string_array' + """ The public format of the value """ self.public_format = 'gchar **' - """ The return type on value getters """ - self.getter_return = self.public_format - - """ The return value when getter fails """ - self.getter_return_error = 'NULL' + """ Type of the value when used as input parameter """ + self.in_format = 'const gchar *const *' + self.in_description = 'The \'' + self.name + '\' field, given as an array of strings.' - """ The description of the value returned from the getter """ - self.getter_return_description = 'a newly allocated array of strings, which should be freed with g_strfreev().' + """ Type of the value when used as output parameter """ + self.out_format = 'gchar ***' + self.out_description = 'Return location for a newly allocated array of strings, or %NULL if the \'' + self.name + '\' field is not needed. Free the returned value with g_strfreev().' """ The name of the method used to read the value """ self.reader_method_name = '_mbim_message_read_string_array' diff --git a/build-aux/mbim-codegen/ValueStruct.py b/build-aux/mbim-codegen/ValueStruct.py index 01d1189..9609e90 100644 --- a/build-aux/mbim-codegen/ValueStruct.py +++ b/build-aux/mbim-codegen/ValueStruct.py @@ -39,16 +39,15 @@ class ValueStruct(Value): self.struct_type_underscore = utils.build_underscore_name_from_camelcase (self.struct_type) """ The public format of the value """ - self.public_format = self.struct_type + ' *' + self.public_format = self.struct_type - """ The return type on value getters """ - self.getter_return = self.public_format + """ Type of the value when used as input parameter """ + self.in_format = 'const ' + self.struct_type + ' *' + self.in_description = 'The \'' + self.name + '\' field, given as a #' + self.struct_type + '.' - """ The return value when getter fails """ - self.getter_return_error = 'NULL' - - """ The description of the value returned from the getter """ - self.getter_return_description = 'a newly allocated #' + self.struct_type + ', which should be freed with ' + self.struct_type_underscore + '_free().' + """ Type of the value when used as output parameter """ + self.out_format = self.struct_type + ' **' + self.out_description = 'Return location for a newly allocated #' + self.struct_type + ', or %NULL if the \'' + self.name + '\' field is not needed. Free the returned value with ' + self.struct_type_underscore + '_free().' """ The name of the method used to read the value """ self.reader_method_name = '_' + self.struct_type_underscore + '_read' diff --git a/build-aux/mbim-codegen/ValueStructArray.py b/build-aux/mbim-codegen/ValueStructArray.py index 7535294..2ff19be 100644 --- a/build-aux/mbim-codegen/ValueStructArray.py +++ b/build-aux/mbim-codegen/ValueStructArray.py @@ -42,14 +42,13 @@ class ValueStructArray(Value): """ The public format of the value """ self.public_format = self.struct_type + ' **' - """ The return type on value getters """ - self.getter_return = self.public_format + """ Type of the value when used as input parameter """ + self.in_format = 'const ' + self.struct_type + ' * const *' + self.in_description = 'The \'' + self.name + '\' field, given as an array of #' + self.struct_type + 's.' - """ The return value when getter fails """ - self.getter_return_error = 'NULL' - - """ The description of the value returned from the getter """ - self.getter_return_description = 'a newly allocated array of #' + self.struct_type + ', which should be freed with ' + self.struct_type_underscore + '_free_array().' + """ Type of the value when used as output parameter """ + self.out_format = self.struct_type + ' ***' + self.out_description = 'Return location for a newly allocated array of #' + self.struct_type + 's, or %NULL if the \'' + self.name + '\' field is not needed. Free the returned value with ' + self.struct_type_underscore + '_free_array().' """ The name of the method used to read the value """ self.reader_method_name = '_' + self.struct_type_underscore + '_read_array' diff --git a/build-aux/mbim-codegen/ValueUint32.py b/build-aux/mbim-codegen/ValueUint32.py index 2c7ea16..cabb29d 100644 --- a/build-aux/mbim-codegen/ValueUint32.py +++ b/build-aux/mbim-codegen/ValueUint32.py @@ -36,14 +36,13 @@ class ValueUint32(Value): """ The public format of the value """ self.public_format = dictionary['public-format'] if 'public-format' in dictionary else 'guint32' - """ The return type on value getters """ - self.getter_return = self.public_format + """ Type of the value when used as input parameter """ + self.in_format = self.public_format + ' ' + self.in_description = 'The \'' + self.name + '\' field, given as a #' + self.public_format + '.' - """ The return value when getter fails """ - self.getter_return_error = '0' - - """ The description of the value returned from the getter """ - self.getter_return_description = 'a #' + self.public_format + '.' + """ Type of the value when used as output parameter """ + self.out_format = self.public_format + ' *' + self.out_description = 'Return location for a #' + self.public_format + ', or %NULL if the \'' + self.name + '\' field is not needed.' """ The name of the method used to read the value """ self.reader_method_name = '_mbim_message_read_guint32' diff --git a/build-aux/mbim-codegen/ValueUint32Array.py b/build-aux/mbim-codegen/ValueUint32Array.py index 54ae3c0..615ba62 100644 --- a/build-aux/mbim-codegen/ValueUint32Array.py +++ b/build-aux/mbim-codegen/ValueUint32Array.py @@ -34,16 +34,15 @@ class ValueUint32Array(Value): Value.__init__(self, dictionary) """ The public format of the value """ - self.public_format = 'guint32 *' + self.public_format = dictionary['public-format'] if 'public-format' in dictionary else 'guint32' - """ The return type on value getters """ - self.getter_return = self.public_format + """ Type of the value when used as input parameter """ + self.in_format = 'const ' + self.public_format + ' *' + self.in_description = 'The \'' + self.name + '\' field, given as an array of #' + self.public_format + 's.' - """ The return value when getter fails """ - self.getter_return_error = 'NULL' - - """ The description of the value returned from the getter """ - self.getter_return_description = 'a newly allocated array of #guint32s, which should be freed with g_free().' + """ Type of the value when used as output parameter """ + self.out_format = self.public_format + ' **' + self.out_description = 'Return location for a newly allocated array of #' + self.public_format + 's, or %NULL if the \'' + self.name + '\' field is not needed. Free the returned value with g_free().' """ The name of the method used to read the value """ self.reader_method_name = '_mbim_message_read_guint32_array' diff --git a/build-aux/mbim-codegen/ValueUuid.py b/build-aux/mbim-codegen/ValueUuid.py index 45d647d..92e4e9e 100644 --- a/build-aux/mbim-codegen/ValueUuid.py +++ b/build-aux/mbim-codegen/ValueUuid.py @@ -36,14 +36,13 @@ class ValueUuid(Value): """ The public format of the value """ self.public_format = 'MbimUuid' - """ The return type on value getters """ - self.getter_return = 'const MbimUuid *' + """ Type of the value when used as input parameter """ + self.in_format = 'const MbimUuid *' + self.in_description = 'The \'' + self.name + '\' field, given as a #MbimUuid.' - """ The return value when getter fails """ - self.getter_return_error = 'NULL' - - """ The description of the value returned from the getter """ - self.getter_return_description = 'a #MbimUuid. Do not free the returned value.' + """ Type of the value when used as output parameter """ + self.out_format = 'const MbimUuid **' + self.out_description = 'Return location for a #MbimUuid, or %NULL if the \'' + self.name + '\' field is not needed. Do not free the returned value.' """ The name of the method used to read the value """ self.reader_method_name = '_mbim_message_read_uuid' |