'If we have any buffer specializations, write out some variable
declarations and imports.'

def _buffer_declarations(self, pyx_code, decl_code, all_buffer_types):

    decl_code.put_chunk(u'\n                                                                ctypedef    struct    {{memviewslice_cname}}:\n                                                                                void    *memview\n\n                                                                void    __PYX_XDEC_MEMVIEW({{memviewslice_cname}}    *,    int    have_gil)\n                                                                bint    __pyx_memoryview_check(object)\n                                                ')
    pyx_code.local_variable_declarations.put_chunk(u'\n                                                                cdef    {{memviewslice_cname}}    memslice\n                                                                cdef    Py_ssize_t    itemsize\n                                                                cdef    bint    dtype_signed\n                                                                cdef    char    kind\n                                                                cdef    bint    arg_is_pythran_compatible\n\n                                                                itemsize    =    -1\n                                                                arg_is_pythran_compatible    =    False\n                                                ')
    pyx_code.imports.put_chunk(u'\n                                                                cdef    type    ndarray\n                                                                ndarray    =    __Pyx_ImportNumPyArrayTypeIfAvailable()\n                                                ')
    seen_int_dtypes = set()
    for buffer_type in all_buffer_types:
        dtype = buffer_type.dtype
        if dtype.is_typedef:
            decl_code.putln(('ctypedef    %s    %s    "%s"' % (dtype.resolve(), self._dtype_name(dtype), dtype.empty_declaration_code())))
        if buffer_type.dtype.is_int:
            if (str(dtype) not in seen_int_dtypes):
                seen_int_dtypes.add(str(dtype))
                pyx_code.context.update(dtype_name=self._dtype_name(dtype), dtype_type=self._dtype_type(dtype))
                pyx_code.local_variable_declarations.put_chunk(u'\n                                                                                                                cdef    bint    {{dtype_name}}_is_signed\n                                                                                                                {{dtype_name}}_is_signed    =    <{{dtype_type}}>    -1    <    0\n                                                                                                ')
