for attribute_name, attribute_type in attribute_types:
scope.declare_var(attribute_name, attribute_type, None,
attribute_name, allow_pyobject=True)
+ binding = Binding(name = name, cname = cname)
builtin_scope.declare_struct_or_union(
- name, "struct", scope, 1, None, cname = cname)
+ binding, kind = 'struct', scope = scope, typedef_flag = True)
def init_builtins():
init_builtin_structs()
for arg in func_type_args[len(func_type_args)-self.optional_arg_count:]:
scope.declare_var(arg.name, arg.type, arg.pos, allow_pyobject = 1)
struct_cname = env.mangle(Naming.opt_arg_prefix, self.base.name)
- self.op_args_struct = env.global_scope().declare_struct_or_union(name = struct_cname,
- kind = 'struct',
- scope = scope,
- typedef_flag = 0,
- pos = self.pos,
- cname = struct_cname)
+ binding = Binding(name = struct_cname, cname = struct_cname)
+ self.op_args_struct = env.global_scope().declare_struct_or_union(
+ binding, kind = 'struct', scope = scope, pos = self.pos)
self.op_args_struct.defined_in_pxd = 1
self.op_args_struct.used = 1
scope = StructOrUnionScope(self.name)
binding = Binding()
binding.pull(self)
- self.entry = env.WTK_declare_struct_or_union(
+ self.entry = env.declare_struct_or_union(
binding, kind = self.kind, scope = scope,
typedef_flag = self.typedef_flag, packed = self.packed,
pos = self.pos)
error(self.lhs.pos, "Invalid declaration.")
name = self.lhs.name
scope = StructOrUnionScope(name)
- env.declare_struct_or_union(name, func_name, scope, False, self.rhs.pos)
+ binding = Binding(name = name)
+ env.declare_struct_or_union(
+ binding, kind = func_name, scope = scope,
+ pos = self.rhs.pos)
for member, type, pos in members:
scope.declare_var(member, type, pos)
entry.redeclared(pos)
else:
if kind == 'struct' or kind == 'union':
- entry = module_scope.declare_struct_or_union(name,
- kind = kind, scope = None, typedef_flag = 0, pos = pos)
+ binding = Binding(name = name)
+ entry = module_scope.declare_struct_or_union(
+ binding, kind = kind, scope = None, pos = pos)
elif kind == 'class':
entry = module_scope.declare_c_class(name, pos = pos,
module_name = self.module_name)
type.qualified_name = entry.qualified_name
return entry
- def declare_struct_or_union(self, name, kind, scope,
- typedef_flag, pos, cname = None, visibility = 'private',
- packed = False):
- binding = self._WTK_setup(name, cname, visibility=visibility)
- return self.WTK_declare_struct_or_union(binding, pos, kind, scope, typedef_flag, packed)
-
- def WTK_declare_struct_or_union(
- self, binding,
- pos, kind, scope, typedef_flag, packed=False):
+ def declare_struct_or_union(self, binding, kind, scope, typedef_flag=False,
+ packed=False, pos = None):
# Add an entry for a struct or union definition.
if not binding.cname:
if self.in_cinclude or binding.c_visibility == 'public':