self.__dict__[key] = value
-class CSource(_BindingAttributes):
- """Configure the location of an object's C source.
-
- * source_name (string): Source symbol name (if the symbol is
- external)
- * source_namespace (string): C++ namespace (`None` for C objects,
- set if the symbol is external)
- * cdef_flag (boolean): Symbol (data) has a C definition.
- * extern (boolean): Symbol is defined elsewhere (otherwise a local
- defition is created).
- """
- source_name = None
- source_namespace = None
- cdef_flag = 0
- extern = 0
-
-
class CBinding(_BindingAttributes):
"""Configure the presence and behaviour of an object's C bindings.
* cname (string): Generated symbol name (or source name, is the
symbol is external.
- * cnamespace (string): C++ namespace (`None` for C objects)
- * api (boolean): Add to generated header file
- * visibility ('private'|'public'):
+ * namespace (string): C++ namespace of the source (`None` for C
+ objects, set if the symbol is external)
+ * cdef_flag (boolean): Symbol (data) has a C definition.
+ * extern (boolean): Symbol is defined elsewhere (otherwise a local
+ defition is created).
+ * visibility ('private'|'public'|'ignore'):
* private: Symbol is not accessible to external C code
* public: Symbol is accessible to external C code
+ * ignore: ? something about symbol re-definition?
* const (boolean): Symbol data is readonly.
+ * api (boolean): Add to generated header file
"""
cname = None
namespace = None
- api = 0
+ cdef_flag = 0
+ extern = 0
c_visibility = 'private'
const = 0
+ api = 0
class PythonBinding(_BindingAttributes):
class methods.
"""
name = None
- visibility = 'public' #private'
+ visibility = 'public'
overridable = 0
-class Binding(CSource, CBinding, PythonBinding):
+class Binding(CBinding, PythonBinding):
"Combine all binding attributes in a single, flat namespace."
def visibility_string(self):
"Summarize binding visibility in a single string"
error(s.position(), "Empty declarator")
name = ""
cname = None
- if cname is None and ctx.source_namespace is not None and nonempty:
- cname = ctx.source_namespace + "::" + name
+ if cname is None and ctx.namespace is not None and nonempty:
+ cname = ctx.namespace + "::" + name
if name == 'operator' and ctx.extern and nonempty:
op = s.sy
if [1 for c in op if c in '+-*/<=>!%&|([^~,']:
ctx.extern = 1
if s.systring == "namespace":
s.next()
- ctx.source_namespace = p_string_literal(s, 'u')[2]
+ ctx.namespace = p_string_literal(s, 'u')[2]
if p_nogil(s):
ctx.nogil = 1
body = p_suite(s, ctx)
return Nodes.CDefExternNode(pos,
include_file = include_file,
body = body,
- namespace = ctx.source_namespace)
+ namespace = ctx.namespace)
def p_c_enum_definition(s, pos, ctx):
# s.sy == ident 'enum'
name = s.systring
s.next()
cname = p_opt_cname(s)
- if cname is None and ctx.source_namespace is not None:
- cname = ctx.source_namespace + "::" + name
+ if cname is None and ctx.namespace is not None:
+ cname = ctx.namespace + "::" + name
else:
name = None
cname = None
ctx = p_binding(s, ctx)
name = p_ident(s)
cname = p_opt_cname(s)
- if cname is None and ctx.source_namespace is not None:
- cname = ctx.source_namespace + "::" + name
+ if cname is None and ctx.namespace is not None:
+ cname = ctx.namespace + "::" + name
value = None
if s.sy == '=':
s.next()
s.next()
name = p_ident(s)
cname = p_opt_cname(s)
- if cname is None and ctx.source_namespace is not None:
- cname = ctx.source_namespace + "::" + name
+ if cname is None and ctx.namespace is not None:
+ cname = ctx.namespace + "::" + name
attributes = None
if s.sy == ':':
s.next()
module_path = []
class_name = p_ident(s)
cname = p_opt_cname(s)
- if cname is None and ctx.source_namespace is not None:
- cname = ctx.source_namespace + "::" + class_name
+ if cname is None and ctx.namespace is not None:
+ cname = ctx.namespace + "::" + class_name
if s.sy == '.':
error(pos, "Qualified class name not allowed C++ class")
if s.sy == '[':