1.1 --- a/generator.py Sat Feb 11 16:04:40 2017 +0100
1.2 +++ b/generator.py Sat Feb 11 23:15:21 2017 +0100
1.3 @@ -650,9 +650,14 @@
1.4
1.5 # Write the corresponding definition.
1.6
1.7 - print >>f_defs, "const __table %s = {\n %s,\n {\n %s\n }\n };\n" % (
1.8 - table_name, structure_size,
1.9 - ",\n ".join(table))
1.10 + print >>f_defs, """\
1.11 +const __table %s = {
1.12 + %s,
1.13 + {
1.14 + %s
1.15 + }
1.16 +};
1.17 +""" % (table_name, structure_size, ",\n ".join(table))
1.18
1.19 def write_parameter_table(self, f_decls, f_defs, table_name, structure_size, table):
1.20
1.21 @@ -662,13 +667,22 @@
1.22 with 'table' details used to populate the definition.
1.23 """
1.24
1.25 + members = []
1.26 + for t in table:
1.27 + members.append("{%s, %s}" % t)
1.28 +
1.29 print >>f_decls, "extern const __ptable %s;\n" % table_name
1.30
1.31 # Write the corresponding definition.
1.32
1.33 - print >>f_defs, "const __ptable %s = {\n %s,\n {\n %s\n }\n };\n" % (
1.34 - table_name, structure_size,
1.35 - ",\n ".join([("{%s, %s}" % t) for t in table]))
1.36 + print >>f_defs, """\
1.37 +const __ptable %s = {
1.38 + %s,
1.39 + {
1.40 + %s
1.41 + }
1.42 +};
1.43 +""" % (table_name, structure_size, ",\n ".join(members))
1.44
1.45 def write_instance_structure(self, f_decls, path, structure_size):
1.46
2.1 --- a/templates/progops.c Sat Feb 11 16:04:40 2017 +0100
2.2 +++ b/templates/progops.c Sat Feb 11 23:15:21 2017 +0100
2.3 @@ -33,7 +33,7 @@
2.4 __attr self = {.context=obj, .value=obj};
2.5 __attr tmp = {.context=0, .value=cls};
2.6 obj->table = table;
2.7 - __store_via_object(obj, __pos___class__, tmp);
2.8 + __store_via_object(obj, __ATTRPOS(__class__), tmp);
2.9 return self;
2.10 }
2.11
2.12 @@ -69,7 +69,7 @@
2.13
2.14 /* Store a reference to the data in the object's __data__ attribute. */
2.15
2.16 - __store_via_object(args[0].value, __pos___data__, attr);
2.17 + __store_via_object(args[0].value, __ATTRPOS(__data__), attr);
2.18 }
2.19
2.20 #ifdef __HAVE___builtins___dict_dict
2.21 @@ -183,7 +183,7 @@
2.22 {
2.23 /* Obtain the __args__ special member, referencing the parameter table. */
2.24
2.25 - __attr minparams = __check_and_load_via_object(callable.value, __pos___args__, __code___args__);
2.26 + __attr minparams = __check_and_load_via_object(callable.value, __ATTRPOS(__args__), __ATTRCODE(__args__));
2.27
2.28 /* Refer to the table and minimum/maximum. */
2.29