diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-14 14:04:47 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-21 19:28:17 +0200 |
commit | 43a8ba9f292348946be6adb6e8f73a0064444911 (patch) | |
tree | 3d8a1423b093f5a287c43c79572a78da7aeb28fd /build-aux | |
parent | 775b00e7d0858b36e90db6e72b7c24f31070e67e (diff) |
mbim-codegen: implement guint64 support
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/mbim-codegen/Container.py | 3 | ||||
-rw-r--r-- | build-aux/mbim-codegen/Message.py | 5 | ||||
-rw-r--r-- | build-aux/mbim-codegen/Struct.py | 10 | ||||
-rw-r--r-- | build-aux/mbim-codegen/ValueUint64.py | 55 |
4 files changed, 73 insertions, 0 deletions
diff --git a/build-aux/mbim-codegen/Container.py b/build-aux/mbim-codegen/Container.py index df818b1..974eef5 100644 --- a/build-aux/mbim-codegen/Container.py +++ b/build-aux/mbim-codegen/Container.py @@ -23,6 +23,7 @@ import utils from ValueUuid import ValueUuid from ValueUint32 import ValueUint32 from ValueUint32Array import ValueUint32Array +from ValueUint64 import ValueUint64 from ValueString import ValueString from ValueStringArray import ValueStringArray from ValueStruct import ValueStruct @@ -60,6 +61,8 @@ class Container: new_field = ValueUint32Array(field) self.mark_array_length(new_field.array_size_field) self.fields.append(new_field) + elif field['format'] == 'guint64': + self.fields.append(ValueUint64(field)) elif field['format'] == 'string': self.fields.append(ValueString(field)) elif field['format'] == 'string-array': diff --git a/build-aux/mbim-codegen/Message.py b/build-aux/mbim-codegen/Message.py index 3026e76..d1f6a08 100644 --- a/build-aux/mbim-codegen/Message.py +++ b/build-aux/mbim-codegen/Message.py @@ -261,6 +261,11 @@ class Message: ' if (${field_name_underscore} != NULL)\n' ' *${field_name_underscore} = _mbim_message_read_guint32_array (message, _{array_size_field_name_underscore}, offset);\n' ' offset += (4 * _${array_size_field_name_underscore});\n') + elif field.format == 'guint64': + inner_template += ( + ' if (${field_name_underscore} != NULL)\n' + ' *${field_name_underscore} = _mbim_message_read_guint64 (message, offset);\n' + ' offset += 8;\n') elif field.format == 'string': inner_template += ( ' if (${field_name_underscore} != NULL)\n' diff --git a/build-aux/mbim-codegen/Struct.py b/build-aux/mbim-codegen/Struct.py index c79e292..a01858a 100644 --- a/build-aux/mbim-codegen/Struct.py +++ b/build-aux/mbim-codegen/Struct.py @@ -53,6 +53,9 @@ class Struct: elif field['format'] == 'guint32-array': inner_template = ( ' guint32 *${field_name_underscore};\n') + elif field['format'] == 'guint64': + inner_template = ( + ' guint64 ${field_name_underscore};\n') elif field['format'] == 'string': inner_template = ( ' gchar *${field_name_underscore};\n') @@ -101,6 +104,8 @@ class Struct: elif field['format'] == 'guint32-array': inner_template += ( ' g_free (var->${field_name_underscore});\n') + elif field['format'] == 'guint64': + pass elif field['format'] == 'string': inner_template += ( ' g_free (var->${field_name_underscore});\n') @@ -182,6 +187,11 @@ class Struct: '\n' ' out->${field_name_underscore} = _mbim_message_read_guint32_array (self, out->${array_size_field_name_underscore}, offset);\n' ' offset += (4 * out->${array_size_field_name_underscore});\n') + elif field['format'] == 'guint64': + inner_template += ( + '\n' + ' out->${field_name_underscore} = _mbim_message_read_guint64 (self, offset);\n' + ' offset += 8;\n') elif field['format'] == 'string': inner_template += ( '\n' diff --git a/build-aux/mbim-codegen/ValueUint64.py b/build-aux/mbim-codegen/ValueUint64.py new file mode 100644 index 0000000..989c003 --- /dev/null +++ b/build-aux/mbim-codegen/ValueUint64.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil -*- +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2013 Aleksander Morgado <aleksander@gnu.org> +# + +from Value import Value + +""" +The ValueUint64 class takes care of UINT64 variables +""" +class ValueUint64(Value): + + """ + Constructor + """ + def __init__(self, dictionary): + + # Call the parent constructor + Value.__init__(self, dictionary) + + """ The public format of the value """ + self.public_format = dictionary['public-format'] if 'public-format' in dictionary else 'guint64' + + """ 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 + '.' + + """ 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_guint64' + + """ The size of this variable """ + self.size = 4 + self.size_string = '' + + """ Whether this value is an array """ + self.is_array = False |