1.1 --- a/generator.py Sat Feb 11 15:34:30 2017 +0100
1.2 +++ b/generator.py Sun Feb 12 00:25:36 2017 +0100
1.3 @@ -1055,7 +1055,7 @@
1.4 __attr %s(__attr __args[])
1.5 {
1.6 /* Allocate the structure. */
1.7 - __args[0] = __new(&%s, &%s, sizeof(%s));
1.8 + __args[0] = __NEWINSTANCE(%s);
1.9
1.10 /* Call the initialiser. */
1.11 %s(__args);
1.12 @@ -1065,9 +1065,7 @@
1.13 }
1.14 """ % (
1.15 encode_instantiator_pointer(path),
1.16 - encode_tablename("<instance>", path),
1.17 encode_path(path),
1.18 - encode_symbol("obj", path),
1.19 encode_function_pointer(init_ref.get_origin())
1.20 )
1.21
1.22 @@ -1087,7 +1085,7 @@
1.23 __attr %s(__attr __args[], __pos number)
1.24 {
1.25 /* Allocate the structure. */
1.26 - __args[0] = __new(&%s, &%s, sizeof(%s));
1.27 + __args[0] = __NEWINSTANCE(%s);
1.28
1.29 /* Allocate a structure for the data and set it on the __data__ attribute. */
1.30 %s(__args, number);
1.31 @@ -1097,9 +1095,7 @@
1.32 }
1.33 """ % (
1.34 encode_literal_instantiator(path),
1.35 - encode_tablename("<instance>", path),
1.36 encode_path(path),
1.37 - encode_symbol("obj", path),
1.38 encode_literal_data_initialiser(style)
1.39 )
1.40
2.1 --- a/templates/progops.h Sat Feb 11 15:34:30 2017 +0100
2.2 +++ b/templates/progops.h Sun Feb 12 00:25:36 2017 +0100
2.3 @@ -75,6 +75,7 @@
2.4
2.5 /* Convenience definitions. */
2.6
2.7 +#define __NEWINSTANCE(__CLS) __new(&__InstanceTable_##__CLS, &__CLS, sizeof(__obj_##__CLS))
2.8 #define __ISINSTANCE(__ATTR, __TYPE) __BOOL(__fn_native_introspection_isinstance((__attr[]) {__NULL, __ATTR, __TYPE}))
2.9
2.10 #endif /* __PROGOPS_H__ */