# HG changeset patch # User Paul Boddie # Date 1548978740 -3600 # Node ID 2eae728285eecb801b4f82013a8fe4daa16067be # Parent c77216b79bebf428513d0a51b3754ad88e6d29ab# Parent c34258c626307606b8a3a13449120a9182703ce4 Merged changes from the default branch. As a consequence floating point instances use considerably less space, and performance is also increased. diff -r c77216b79beb -r 2eae728285ee generator.py --- a/generator.py Sat Jan 26 21:38:12 2019 +0100 +++ b/generator.py Fri Feb 01 00:52:20 2019 +0100 @@ -3,7 +3,7 @@ """ Generate C code from object layouts and other deduced information. -Copyright (C) 2015, 2016, 2017, 2018 Paul Boddie +Copyright (C) 2015, 2016, 2017, 2018, 2019 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -257,7 +257,7 @@ self.populate_trailing(Reference(kind, path), attrs, trailing) if kind == "": - self.write_instance_structure(f_decls, path, structure_size) + self.write_instance_structure(f_decls, path) self.write_structure(f_decls, f_defs, path, table_name, structure, trailing, ref) @@ -300,7 +300,6 @@ cls = self.function_type table_name = encode_tablename("", cls) - structure_size = encode_size("", path) # Set a special callable attribute on the instance. @@ -313,7 +312,7 @@ # Functions with defaults need to declare instance structures. if self.importer.function_defaults.get(path): - self.write_instance_structure(f_decls, path, structure_size) + self.write_instance_structure(f_decls, path) extra_function_instances.append(path) # Write function declarations. @@ -838,13 +837,14 @@ """ % (table_name, min_parameters, max_parameters, structure_size, ",\n ".join(members)) - def write_instance_structure(self, f_decls, path, structure_size): + def write_instance_structure(self, f_decls, path): """ - Write a declaration to 'f_decls' for the object having the given 'path' - and the given 'structure_size'. + Write a declaration to 'f_decls' for the object having the given 'path'. """ + structure_size = encode_size("", path) + # Write an instance-specific type definition for instances of classes. # See: templates/types.h