1.1 --- a/generator.py Thu Nov 04 23:44:29 2021 +0100
1.2 +++ b/generator.py Thu Nov 04 23:57:33 2021 +0100
1.3 @@ -69,7 +69,8 @@
1.4 # Data types with a trailing data member of the given native types.
1.5
1.6 trailing_data_types = {
1.7 - float_type : "double",
1.8 + float_type : "__float",
1.9 + int_type : "__int",
1.10 }
1.11
1.12 def __init__(self, importer, optimiser, output):
1.13 @@ -377,11 +378,6 @@
1.14 for constant, n in self.optimiser.constants.items():
1.15 self.make_literal_constant(f_decls, f_defs, n, constant)
1.16
1.17 - # Generate a common integer instance object, referenced when integer
1.18 - # attributes are accessed.
1.19 -
1.20 - self.make_common_integer(f_decls, f_defs)
1.21 -
1.22 # Finish the main source file.
1.23
1.24 self.write_main_program(f_code, f_signatures)
1.25 @@ -575,11 +571,6 @@
1.26
1.27 value, value_type, encoding = constant
1.28
1.29 - # Do not generate individual integer constants.
1.30 -
1.31 - if value_type == self.int_type:
1.32 - return
1.33 -
1.34 const_path = encode_literal_constant(n)
1.35 structure_name = encode_literal_reference(n)
1.36
1.37 @@ -602,16 +593,6 @@
1.38
1.39 self.make_constant(f_decls, f_defs, ref, attr_path, structure_name)
1.40
1.41 - def make_common_integer(self, f_decls, f_defs):
1.42 -
1.43 - """
1.44 - Write common integer instance details to 'f_decls' (to declare a
1.45 - structure) and to 'f_defs' (to define the contents).
1.46 - """
1.47 -
1.48 - ref = Reference("<instance>", self.int_type)
1.49 - self.make_constant(f_decls, f_defs, ref, "__common_integer", "__common_integer_obj")
1.50 -
1.51 def make_constant(self, f_decls, f_defs, ref, const_path, structure_name, data=None, encoding=None):
1.52
1.53 """
1.54 @@ -1202,13 +1183,6 @@
1.55 # Obtain a constant value directly assigned to the attribute.
1.56
1.57 if self.optimiser.constant_numbers.has_key(alias):
1.58 -
1.59 - # Encode integer constants differently.
1.60 -
1.61 - value, value_type, encoding = self.importer.all_constant_values[alias]
1.62 - if value_type == self.int_type:
1.63 - return "__INTVALUE(%s) /* %s */" % (value, name)
1.64 -
1.65 constant_number = self.optimiser.constant_numbers[alias]
1.66 constant_value = encode_literal_constant(constant_number)
1.67 return "%s /* %s */" % (constant_value, name)