1.1 --- a/generator.py Mon Nov 28 23:51:45 2016 +0100
1.2 +++ b/generator.py Tue Nov 29 00:47:19 2016 +0100
1.3 @@ -51,11 +51,12 @@
1.4
1.5 "A code generator."
1.6
1.7 + # NOTE: These must be synchronised with the library.
1.8 +
1.9 function_type = "__builtins__.core.function"
1.10 type_error_type = "__builtins__.core.TypeError"
1.11 memory_error_type = "__builtins__.core.MemoryError"
1.12 -
1.13 - # NOTE: These must be synchronised with the library.
1.14 + type_type = "__builtins__.core.type"
1.15
1.16 predefined_constant_members = (
1.17 ("__builtins__.boolean", "False"),
1.18 @@ -352,12 +353,18 @@
1.19 #define __FUNCTION_INSTANCE_SIZE %s
1.20 #define __TYPE_ERROR_INSTANTIATOR %s
1.21 #define __MEMORY_ERROR_INSTANTIATOR %s
1.22 +#define __TYPE_CLASS_TYPE %s
1.23 +#define __TYPE_CLASS_POS %s
1.24 +#define __TYPE_CLASS_CODE %s
1.25
1.26 #endif /* __PROGTYPES_H__ */""" % (
1.27 encode_path(self.function_type),
1.28 encode_size("<instance>", self.function_type),
1.29 encode_instantiator_pointer(self.type_error_type),
1.30 - encode_instantiator_pointer(self.memory_error_type)
1.31 + encode_instantiator_pointer(self.memory_error_type),
1.32 + encode_path(self.type_type),
1.33 + encode_symbol("pos", encode_type_attribute(self.type_type)),
1.34 + encode_symbol("code", encode_type_attribute(self.type_type)),
1.35 )
1.36
1.37 print >>f_signatures, """\