Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
ce7e62f9
Commit
ce7e62f9
authored
Aug 09, 2009
by
Kurt Smith
Committed by
Mark Florisson
Sep 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stubs for MemoryViewSliceType copy() and copy_fortran() functions
parent
135495aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
5 deletions
+44
-5
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+44
-5
No files found.
Cython/Compiler/PyrexTypes.py
View file @
ce7e62f9
...
...
@@ -381,13 +381,52 @@ class MemoryViewSliceType(PyrexType):
def
attributes_known
(
self
):
if
self
.
scope
is
None
:
import
Symtab
self
.
scope
=
Symtab
.
StructOrUnionScope
(
self
.
specalization_name
())
# XXX: we don't necessarily want to have this exposed -- for
# testing purposes currently.
self
.
scope
.
declare_var
(
"data"
,
c_char_ptr_type
,
None
,
"data"
)
import
Symtab
,
MemoryView
self
.
scope
=
scope
=
Symtab
.
CClassScope
(
'mvs_class_'
+
self
.
specialization_suffix
(),
self
.
env
.
global_scope
(),
visibility
=
'private'
)
scope
.
parent_type
=
self
# the C copy method
c_copy_name
=
'__Pyx_CopyBuffer_C_'
+
self
.
specialization_suffix
()
scope
.
declare_cfunction
(
'copy'
,
CFuncType
(
cython_memoryview_ptr_type
,
[
CFuncTypeArg
(
"memviewslice"
,
self
,
None
)]),
pos
=
None
,
defining
=
1
,
cname
=
c_copy_name
)
# the Fortran copy method
f_copy_name
=
'__Pyx_CopyBuffer_F_'
+
self
.
specialization_suffix
()
scope
.
declare_cfunction
(
'copy_fortran'
,
CFuncType
(
cython_memoryview_ptr_type
,
[
CFuncTypeArg
(
"memviewslice"
,
self
,
None
)]),
pos
=
None
,
defining
=
1
,
cname
=
f_copy_name
)
# ensure the right util code is used
MemoryView
.
use_cython_array
(
self
.
env
)
MemoryView
.
use_memview_util_code
(
self
.
env
)
# C copy method implementation.
ccopy_util_code
=
UtilityCode
()
# ccopy_util_code.proto =#XXX
return
True
def
axes_to_str
(
self
):
return
""
.
join
([
access
[
0
]
+
packing
[
0
]
for
(
access
,
packing
)
in
self
.
axes
])
def
specialization_suffix
(
self
):
return
self
.
axes_to_str
()
+
'_'
+
self
.
dtype
.
specalization_name
()
def
global_init_code
(
self
,
entry
,
code
):
code
.
putln
(
"%s.data = NULL;"
%
entry
.
cname
)
code
.
put_init_to_py_none
(
"%s.memview"
%
entry
.
cname
,
cython_memoryview_ptr_type
,
nanny
=
False
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment