Commit f4db6743 authored by Kurt Smith's avatar Kurt Smith Committed by Mark Florisson

consistent naming scheme for memoryviews and memoryview slices.

parent a7697342
...@@ -94,9 +94,9 @@ class CythonScope(ModuleScope): ...@@ -94,9 +94,9 @@ class CythonScope(ModuleScope):
# #
self.memviewentry = entry = viewscope.declare_c_class(memview_name, None, self.memviewentry = entry = viewscope.declare_c_class(memview_name, None,
implementing=1, implementing=1,
objstruct_cname = memviewext_objstruct_cname, objstruct_cname = memview_objstruct_cname,
typeobj_cname = memviewext_typeobj_cname, typeobj_cname = memview_typeobj_cname,
typeptr_cname= memviewext_typeptr_cname) typeptr_cname= memview_typeptr_cname)
entry.utility_code_definition = view_utility_code entry.utility_code_definition = view_utility_code
...@@ -236,9 +236,9 @@ cdef object _testscope(int value): ...@@ -236,9 +236,9 @@ cdef object _testscope(int value):
""") """)
memview_name = u'memoryview' memview_name = u'memoryview'
memviewext_typeptr_cname = Naming.typeptr_prefix+memview_name memview_typeptr_cname = Naming.typeptr_prefix+memview_name
memviewext_typeobj_cname = '__pyx_tobj_'+memview_name memview_typeobj_cname = '__pyx_tobj_'+memview_name
memviewext_objstruct_cname = '__pyx_obj_'+memview_name memview_objstruct_cname = '__pyx_obj_'+memview_name
view_utility_code = CythonUtilityCode(u""" view_utility_code = CythonUtilityCode(u"""
cdef class Enum(object): cdef class Enum(object):
cdef object name cdef object name
...@@ -289,8 +289,8 @@ cdef extern from *: ...@@ -289,8 +289,8 @@ cdef extern from *:
ctypedef struct __Pyx_mv_DimInfo: ctypedef struct __Pyx_mv_DimInfo:
Py_ssize_t shape, strides, suboffsets Py_ssize_t shape, strides, suboffsets
ctypedef struct __Pyx_memviewstruct: ctypedef struct __Pyx_memviewslice:
__pyx_obj_memoryview *memviewext __pyx_obj_memoryview *memview
char *data char *data
__Pyx_mv_DimInfo diminfo[BUF_MAX_NDIMS] __Pyx_mv_DimInfo diminfo[BUF_MAX_NDIMS]
...@@ -316,13 +316,13 @@ cdef is_cf_contig(int *specs, int ndim): ...@@ -316,13 +316,13 @@ cdef is_cf_contig(int *specs, int ndim):
return is_c_contig, is_f_contig return is_c_contig, is_f_contig
cdef object pyxmemview_from_memview( cdef object pyxmemviewslice_from_memview(
memoryview memview, memoryview memview,
int *axes_specs, int *axes_specs,
int ndim, int ndim,
Py_ssize_t itemsize, Py_ssize_t itemsize,
char *format, char *format,
__Pyx_memviewstruct *pyx_memview): __Pyx_memviewslice *memviewslice):
cdef int i cdef int i
...@@ -384,13 +384,13 @@ cdef object pyxmemview_from_memview( ...@@ -384,13 +384,13 @@ cdef object pyxmemview_from_memview(
stride = stride * pybuf.shape[i] stride = stride * pybuf.shape[i]
for i in range(ndim): for i in range(ndim):
pyx_memview.diminfo[i].strides = pybuf.strides[i] memviewslice.diminfo[i].strides = pybuf.strides[i]
pyx_memview.diminfo[i].shape = pybuf.shape[i] memviewslice.diminfo[i].shape = pybuf.shape[i]
if has_suboffsets: if has_suboffsets:
pyx_memview.diminfo[i].suboffsets = pybuf.suboffsets[i] memviewslice.diminfo[i].suboffsets = pybuf.suboffsets[i]
pyx_memview.memviewext = <__pyx_obj_memoryview*>memview memviewslice.memview = <__pyx_obj_memoryview*>memview
pyx_memview.data = <char *>pybuf.buf memviewslice.data = <char *>pybuf.buf
""" % Options.buffer_max_dims, name="foobar", prefix="__pyx_viewaxis_") """ % Options.buffer_max_dims, name="foobar", prefix="__pyx_viewaxis_")
......
...@@ -1698,7 +1698,6 @@ class NameNode(AtomicExprNode): ...@@ -1698,7 +1698,6 @@ class NameNode(AtomicExprNode):
def generate_acquire_memoryview(self, rhs, code): def generate_acquire_memoryview(self, rhs, code):
import MemoryView import MemoryView
import pdb; pdb.set_trace()
MemoryView.put_assign_to_memview(self.result(), rhs.result(), self.entry, MemoryView.put_assign_to_memview(self.result(), rhs.result(), self.entry,
is_initialized=not self.lhs_of_first_assignment, is_initialized=not self.lhs_of_first_assignment,
pos=self.pos, code=code) pos=self.pos, code=code)
......
...@@ -332,22 +332,22 @@ spec_constants_code = UtilityCode(proto=""" ...@@ -332,22 +332,22 @@ spec_constants_code = UtilityCode(proto="""
""" """
) )
memviewstruct_cname = u'__Pyx_memviewstruct' memviewslice_cname = u'__Pyx_memviewslice'
memviewstruct_declare_code = UtilityCode(proto=""" memviewslice_declare_code = UtilityCode(proto="""
/* memoryview struct */ /* memoryview slice struct */
typedef struct { typedef struct {
Py_ssize_t shape, strides, suboffsets; Py_ssize_t shape, strides, suboffsets;
} __Pyx_mv_DimInfo; } __Pyx_mv_DimInfo;
typedef struct { typedef struct {
struct %s *memviewext; struct %s *memview;
char *data; char *data;
__Pyx_mv_DimInfo diminfo[%d]; __Pyx_mv_DimInfo diminfo[%d];
} %s; } %s;
""" % (CythonScope.memviewext_objstruct_cname, """ % (CythonScope.memview_objstruct_cname,
Options.buffer_max_dims, Options.buffer_max_dims,
memviewstruct_cname) memviewslice_cname)
) )
...@@ -362,9 +362,9 @@ class MemoryViewType(PyrexType): ...@@ -362,9 +362,9 @@ class MemoryViewType(PyrexType):
assert not pyrex assert not pyrex
assert not dll_linkage assert not dll_linkage
import MemoryView import MemoryView
self.env.use_utility_code(MemoryView.memviewstruct_declare_code) self.env.use_utility_code(MemoryView.memviewslice_declare_code)
return self.base_declaration_code( return self.base_declaration_code(
MemoryView.memviewstruct_cname, MemoryView.memviewslice_cname,
entity_code) entity_code)
class BufferType(BaseType): class BufferType(BaseType):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment