return Naming.modules_prefix + module_name.replace("_", "__").replace(".", "_")
def generate_imported_module(self, module, code):
- import_module = 0
+ import_module = module.has_extern_class
for entry in module.cfunc_entries:
if entry.defined_in_pxd:
import_module = 1
def generate_module_import_code(self, module, env, code):
- import_module = 0
+ import_module = module.has_extern_class
for entry in module.cfunc_entries:
if entry.defined_in_pxd:
import_module = 1
for entry in module.c_class_entries:
if entry.defined_in_pxd:
import_module = 1
- print "generate_module_import_code", module, import_module
if import_module:
env.use_utility_code(import_module_utility_code)
name = self.build_module_var_name(module.qualified_name)
self.module = module
if self.module is None:
self.module = ModuleScope(self.module_name, None, env.context)
+ self.module.has_extern_class = 1
env.cimported_modules.append(self.module)
- print [e.name for e in env.cimported_modules]
+
if self.base_class_name:
if self.base_class_module:
base_class_scope = env.find_module(self.base_class_module, self.pos)
api = self.api)
scope = self.entry.type.scope
- if self.module_name:
- self.entry.defined_in_pxd = 1
- self.module.c_class_entries.append(self.entry)
-
if self.doc:
if Options.embed_pos_in_docstring:
scope.doc = 'File: %s (starting at line %s)'%relative_position(self.pos)
def as_argument_type(self):
return self
+ def cast_code(self, expr_code):
+ # If self is really an array (rather than pointer), we can't cast.
+ # For example, the gmp mpz_t.
+ if self.typedef_base_type.is_ptr:
+ return self.typedef_base_type.cast_code(expr_code)
+ else:
+ return BaseType.cast_code(self, expr_code)
+
def __repr__(self):
return "<CTypedefType %s>" % self.typedef_cname
self.all_pystring_entries = []
self.types_imported = {}
self.pynum_entries = []
+ self.has_extern_class = 0
def qualifying_scope(self):
return self.parent_module