1.1 --- a/generator.py Fri Feb 10 16:01:18 2017 +0100
1.2 +++ b/generator.py Fri Feb 10 16:51:17 2017 +0100
1.3 @@ -551,7 +551,7 @@
1.4 # Define a macro for the constant.
1.5
1.6 attr_name = encode_path(const_path)
1.7 - print >>f_decls, "#define %s ((__attr) {.context=&%s, .value=&%s})" % (attr_name, structure_name, structure_name)
1.8 + print >>f_decls, "#define %s ((__attr) {{.context=&%s, .value=&%s}})" % (attr_name, structure_name, structure_name)
1.9
1.10 def make_parameter_table(self, f_decls, f_defs, parameters):
1.11
1.12 @@ -887,7 +887,7 @@
1.13 attr = encode_function_pointer(attr)
1.14 unbound_attr = "__unbound_method"
1.15
1.16 - structure.append("{.inv=%s, .fn=%s}" % (unbound_attr, attr))
1.17 + structure.append("{{.inv=%s, .fn=%s}}" % (unbound_attr, attr))
1.18 continue
1.19
1.20 # Special argument specification member.
1.21 @@ -896,13 +896,13 @@
1.22 signature = self.get_signature_for_callable(ref.get_origin())
1.23 ptable = encode_tablename("<function>", signature)
1.24
1.25 - structure.append("{.min=%s, .ptable=&%s}" % (attr, ptable))
1.26 + structure.append("{{.min=%s, .ptable=&%s}}" % (attr, ptable))
1.27 continue
1.28
1.29 # Special internal data member.
1.30
1.31 elif attrname == "__data__":
1.32 - structure.append("{.size=%d, .%s=%s}" % (
1.33 + structure.append("{{.size=%d, .%s=%s}}" % (
1.34 encode_literal_constant_size(attr),
1.35 encode_literal_constant_member(attr),
1.36 encode_literal_constant_value(attr)))
1.37 @@ -911,8 +911,8 @@
1.38 # Special internal key member.
1.39
1.40 elif attrname == "__key__":
1.41 - structure.append("{.code=%s, .pos=%s}" % (attr and encode_symbol("code", attr) or "0",
1.42 - attr and encode_symbol("pos", attr) or "0"))
1.43 + structure.append("{{.code=%s, .pos=%s}}" % (attr and encode_symbol("code", attr) or "0",
1.44 + attr and encode_symbol("pos", attr) or "0"))
1.45 continue
1.46
1.47 # Special cases.
1.48 @@ -955,13 +955,13 @@
1.49 # object paths.
1.50
1.51 value = path.rsplit(".", 1)[0]
1.52 - structure.append("{.context=0, .value=&%s}" % encode_path(value))
1.53 + structure.append("{{.context=0, .value=&%s}}" % encode_path(value))
1.54 continue
1.55
1.56 # Special class relationship attributes.
1.57
1.58 elif is_type_attribute(attrname):
1.59 - structure.append("{.context=0, .value=&%s}" % encode_path(decode_type_attribute(attrname)))
1.60 + structure.append("{{.context=0, .value=&%s}}" % encode_path(decode_type_attribute(attrname)))
1.61 continue
1.62
1.63 # All other kinds of members.
1.64 @@ -1000,19 +1000,19 @@
1.65
1.66 if kind == "<instance>" and origin == self.none_type:
1.67 attr_path = encode_predefined_reference(self.none_value)
1.68 - return "{.context=&%s, .value=&%s} /* %s */" % (attr_path, attr_path, name)
1.69 + return "{{.context=&%s, .value=&%s}} /* %s */" % (attr_path, attr_path, name)
1.70
1.71 # Predefined constant members.
1.72
1.73 if (path, name) in self.predefined_constant_members:
1.74 attr_path = encode_predefined_reference("%s.%s" % (path, name))
1.75 - return "{.context=&%s, .value=&%s} /* %s */" % (attr_path, attr_path, name)
1.76 + return "{{.context=&%s, .value=&%s}} /* %s */" % (attr_path, attr_path, name)
1.77
1.78 # General undetermined members.
1.79
1.80 if kind in ("<var>", "<instance>"):
1.81 attr_path = encode_predefined_reference(self.none_value)
1.82 - return "{.context=&%s, .value=&%s} /* %s */" % (attr_path, attr_path, name)
1.83 + return "{{.context=&%s, .value=&%s}} /* %s */" % (attr_path, attr_path, name)
1.84
1.85 # Set the context depending on the kind of attribute.
1.86 # For methods: {&<parent>, &<attr>}
1.87 @@ -1026,7 +1026,7 @@
1.88 context = "&%s" % encode_path(origin)
1.89 else:
1.90 context = "0"
1.91 - return "{.context=%s, .value=&%s}" % (context, encode_path(origin))
1.92 + return "{{.context=%s, .value=&%s}}" % (context, encode_path(origin))
1.93
1.94 def append_defaults(self, path, structure):
1.95
1.96 @@ -1138,7 +1138,7 @@
1.97 }
1.98 __Catch(__tmp_exc)
1.99 {
1.100 - if (__ISINSTANCE(__tmp_exc.arg, ((__attr) {.context=0, .value=&__builtins___exception_system_SystemExit})))
1.101 + if (__ISINSTANCE(__tmp_exc.arg, ((__attr) {{.context=0, .value=&__builtins___exception_system_SystemExit}})))
1.102 return __load_via_object(
1.103 __load_via_object(__tmp_exc.arg.value, %s).value,
1.104 %s).intvalue;