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

partial fix of #299. Refactored buffer auxiliary vars.

parent e97c6e59
This diff is collapsed.
...@@ -1699,10 +1699,8 @@ class NameNode(AtomicExprNode): ...@@ -1699,10 +1699,8 @@ class NameNode(AtomicExprNode):
rhstmp = code.funcstate.allocate_temp(self.entry.type, manage_ref=False) rhstmp = code.funcstate.allocate_temp(self.entry.type, manage_ref=False)
code.putln('%s = %s;' % (rhstmp, rhs.result_as(self.ctype()))) code.putln('%s = %s;' % (rhstmp, rhs.result_as(self.ctype())))
buffer_aux = self.entry.buffer_aux
bufstruct = buffer_aux.buffer_info_var.cname
import Buffer import Buffer
Buffer.put_assign_to_buffer(self.result(), rhstmp, buffer_aux, self.entry.type, Buffer.put_assign_to_buffer(self.result(), rhstmp, 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)
......
...@@ -38,10 +38,8 @@ typeobj_prefix = pyrex_prefix + "type_" ...@@ -38,10 +38,8 @@ typeobj_prefix = pyrex_prefix + "type_"
var_prefix = pyrex_prefix + "v_" var_prefix = pyrex_prefix + "v_"
varptr_prefix = pyrex_prefix + "vp_" varptr_prefix = pyrex_prefix + "vp_"
wrapperbase_prefix= pyrex_prefix + "wrapperbase_" wrapperbase_prefix= pyrex_prefix + "wrapperbase_"
bufstruct_prefix = pyrex_prefix + "bstruct_" pybuffernd_prefix = pyrex_prefix + "pybuffernd_"
bufstride_prefix = pyrex_prefix + "bstride_" pybufferstruct_prefix = pyrex_prefix + "pybuffer_"
bufshape_prefix = pyrex_prefix + "bshape_"
bufsuboffset_prefix = pyrex_prefix + "boffset_"
vtable_prefix = pyrex_prefix + "vtable_" vtable_prefix = pyrex_prefix + "vtable_"
vtabptr_prefix = pyrex_prefix + "vtabptr_" vtabptr_prefix = pyrex_prefix + "vtabptr_"
vtabstruct_prefix = pyrex_prefix + "vtabstruct_" vtabstruct_prefix = pyrex_prefix + "vtabstruct_"
......
...@@ -1405,9 +1405,8 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1405,9 +1405,8 @@ class FuncDefNode(StatNode, BlockNode):
code.put_var_incref(entry) code.put_var_incref(entry)
# ----- Initialise local buffer auxiliary variables # ----- Initialise local buffer auxiliary variables
for entry in lenv.var_entries + lenv.arg_entries: for entry in lenv.var_entries + lenv.arg_entries:
if entry.type.is_buffer and entry.buffer_aux.buffer_info_var.used: if entry.type.is_buffer and entry.buffer_aux.buflocal_nd_var.used:
code.putln("%s.buf = NULL;" % Buffer.put_init_vars(entry, code)
entry.buffer_aux.buffer_info_var.cname)
# ----- Check and convert arguments # ----- Check and convert arguments
self.generate_argument_type_tests(code) self.generate_argument_type_tests(code)
# ----- Acquire buffer arguments # ----- Acquire buffer arguments
......
...@@ -67,6 +67,9 @@ old_style_globals = False ...@@ -67,6 +67,9 @@ old_style_globals = False
cimport_from_pyx = False cimport_from_pyx = False
# max # of dims for buffers -- set to same value as max # of dims for numpy
# arrays.
buffer_max_dims = 32
# Declare compiler directives # Declare compiler directives
directive_defaults = { directive_defaults = {
......
...@@ -2481,6 +2481,15 @@ c_size_t_ptr_type = CPtrType(c_size_t_type) ...@@ -2481,6 +2481,15 @@ c_size_t_ptr_type = CPtrType(c_size_t_type)
c_py_buffer_type = CStructOrUnionType("Py_buffer", "struct", None, 1, "Py_buffer") c_py_buffer_type = CStructOrUnionType("Py_buffer", "struct", None, 1, "Py_buffer")
c_py_buffer_ptr_type = CPtrType(c_py_buffer_type) c_py_buffer_ptr_type = CPtrType(c_py_buffer_type)
# buffer-related structs
c_buf_diminfo_type = CStructOrUnionType("__Pyx_Buf_DimInfo", "struct",
None, 1, "__Pyx_Buf_DimInfo")
c_pyx_buffer_type = CStructOrUnionType("__Pyx_Buffer", "struct", None, 1, "__Pyx_Buffer")
c_pyx_buffer_ptr_type = CPtrType(c_pyx_buffer_type)
c_pyx_buffer_nd_type = CStructOrUnionType("__Pyx_LocalBuf_ND", "struct",
None, 1, "__Pyx_LocalBuf_ND")
error_type = ErrorType() error_type = ErrorType()
unspecified_type = UnspecifiedType() unspecified_type = UnspecifiedType()
......
...@@ -39,12 +39,9 @@ def c_safe_identifier(cname): ...@@ -39,12 +39,9 @@ def c_safe_identifier(cname):
class BufferAux(object): class BufferAux(object):
writable_needed = False writable_needed = False
def __init__(self, buffer_info_var, stridevars, shapevars, def __init__(self, buflocal_nd_var, rcbuf_var):
suboffsetvars): self.buflocal_nd_var = buflocal_nd_var
self.buffer_info_var = buffer_info_var self.rcbuf_var = rcbuf_var
self.stridevars = stridevars
self.shapevars = shapevars
self.suboffsetvars = suboffsetvars
def __repr__(self): def __repr__(self):
return "<BufferAux %r>" % self.__dict__ return "<BufferAux %r>" % self.__dict__
......
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