# HG changeset patch # User Paul Boddie # Date 1486855601 -3600 # Node ID b53f4dc7f3be7442aa05f22f0ffdb77cb3add0a1 # Parent 4e9856fce8e3f58471664f5b415746df92961f88# Parent b09f64a52daae4339ce007e5a3253c95b7a5c67f Merged changes from the default branch. diff -r 4e9856fce8e3 -r b53f4dc7f3be generator.py --- a/generator.py Sat Feb 11 23:15:21 2017 +0100 +++ b/generator.py Sun Feb 12 00:26:41 2017 +0100 @@ -1068,7 +1068,7 @@ __attr %s(__attr __args[]) { /* Allocate the structure. */ - __args[0] = __new(&%s, &%s, sizeof(%s)); + __args[0] = __NEWINSTANCE(%s); /* Call the initialiser. */ %s(__args); @@ -1078,9 +1078,7 @@ } """ % ( encode_instantiator_pointer(path), - encode_tablename("", path), encode_path(path), - encode_symbol("obj", path), encode_function_pointer(init_ref.get_origin()) ) @@ -1100,7 +1098,7 @@ __attr %s(__attr __args[], __pos number) { /* Allocate the structure. */ - __args[0] = __new(&%s, &%s, sizeof(%s)); + __args[0] = __NEWINSTANCE(%s); /* Allocate a structure for the data and set it on the __data__ attribute. */ %s(__args, number); @@ -1110,9 +1108,7 @@ } """ % ( encode_literal_instantiator(path), - encode_tablename("", path), encode_path(path), - encode_symbol("obj", path), encode_literal_data_initialiser(style) ) diff -r 4e9856fce8e3 -r b53f4dc7f3be templates/progops.h --- a/templates/progops.h Sat Feb 11 23:15:21 2017 +0100 +++ b/templates/progops.h Sun Feb 12 00:26:41 2017 +0100 @@ -76,6 +76,7 @@ /* Convenience definitions. */ +#define __NEWINSTANCE(__CLS) __new(&__InstanceTable_##__CLS, &__CLS, sizeof(__obj_##__CLS)) #define __ISINSTANCE(__ATTR, __TYPE) __BOOL(__fn_native_introspection_isinstance((__attr[]) {__NULL, __ATTR, __TYPE})) #endif /* __PROGOPS_H__ */