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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
a5953c6c
Commit
a5953c6c
authored
Aug 12, 2009
by
Kurt Smith
Committed by
Mark Florisson
Sep 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring of MemoryViewSliceType utility code.
parent
c041335f
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
197 additions
and
121 deletions
+197
-121
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+0
-1
Cython/Compiler/MemoryView.py
Cython/Compiler/MemoryView.py
+175
-87
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+22
-33
No files found.
Cython/Compiler/ExprNodes.py
View file @
a5953c6c
...
@@ -592,7 +592,6 @@ class ExprNode(Node):
...
@@ -592,7 +592,6 @@ class ExprNode(Node):
error
(
self
.
pos
,
"Memoryview '%s' not conformable to memoryview '%s'."
%
error
(
self
.
pos
,
"Memoryview '%s' not conformable to memoryview '%s'."
%
(
src
.
type
,
dst_type
))
(
src
.
type
,
dst_type
))
elif
dst_type
.
is_pyobject
:
elif
dst_type
.
is_pyobject
:
if
not
src
.
type
.
is_pyobject
:
if
not
src
.
type
.
is_pyobject
:
if
dst_type
is
bytes_type
and
src
.
type
.
is_int
:
if
dst_type
is
bytes_type
and
src
.
type
.
is_int
:
...
...
Cython/Compiler/MemoryView.py
View file @
a5953c6c
This diff is collapsed.
Click to expand it.
Cython/Compiler/PyrexTypes.py
View file @
a5953c6c
...
@@ -387,6 +387,7 @@ class MemoryViewSliceType(PyrexType):
...
@@ -387,6 +387,7 @@ class MemoryViewSliceType(PyrexType):
import
Symtab
,
MemoryView
import
Symtab
,
MemoryView
from
MemoryView
import
axes_to_str
from
MemoryView
import
axes_to_str
self
.
scope
=
scope
=
Symtab
.
CClassScope
(
self
.
scope
=
scope
=
Symtab
.
CClassScope
(
'mvs_class_'
+
self
.
specialization_suffix
(),
'mvs_class_'
+
self
.
specialization_suffix
(),
None
,
None
,
...
@@ -408,53 +409,41 @@ class MemoryViewSliceType(PyrexType):
...
@@ -408,53 +409,41 @@ class MemoryViewSliceType(PyrexType):
to_memview_c
=
MemoryViewSliceType
(
self
.
dtype
,
to_axes_c
)
to_memview_c
=
MemoryViewSliceType
(
self
.
dtype
,
to_axes_c
)
to_memview_f
=
MemoryViewSliceType
(
self
.
dtype
,
to_axes_f
)
to_memview_f
=
MemoryViewSliceType
(
self
.
dtype
,
to_axes_f
)
copy_contents_name_c
=
\
cython_name_c
,
cython_name_f
=
"copy"
,
"copy_fortran"
MemoryView
.
get_copy_contents_name
(
self
,
to_memview_c
)
copy_name_c
,
copy_name_f
=
(
copy_contents_name_f
=
\
MemoryView
.
get_copy_func_name
(
to_memview_c
),
MemoryView
.
get_copy_contents_name
(
self
,
to_memview_f
)
MemoryView
.
get_copy_func_name
(
to_memview_f
))
c_copy_decl
,
c_copy_impl
,
c_entry
=
\
MemoryView
.
memoryviewslice_get_copy_func
(
self
,
to_memview_c
,
'c'
,
self
.
scope
)
f_copy_decl
,
f_copy_impl
,
f_entry
=
\
MemoryView
.
memoryviewslice_get_copy_func
(
self
,
to_memview_f
,
'fortran'
,
self
.
scope
)
c_copy_contents_decl
,
c_copy_contents_impl
=
\
MemoryView
.
get_copy_contents_func
(
self
,
to_memview_c
,
copy_contents_name_c
)
f_copy_contents_decl
,
f_copy_contents_impl
=
\
MemoryView
.
get_copy_contents_func
(
self
,
to_memview_f
,
copy_contents_name_f
)
c_util_code
=
UtilityCode
(
for
(
to_memview
,
cython_name
,
copy_name
)
in
((
to_memview_c
,
cython_name_c
,
copy_name_c
),
proto
=
"%s%s"
%
(
c_copy_decl
,
c_copy_contents_decl
),
(
to_memview_f
,
cython_name_f
,
copy_name_f
)):
impl
=
"%s%s"
%
(
c_copy_impl
,
c_copy_contents_impl
))
f_util_code
=
UtilityCode
(
proto
=
f_copy_decl
,
impl
=
f_copy_impl
)
c_entry
.
utility_code_definition
=
c_util_code
entry
=
scope
.
declare_cfunction
(
cython_name
,
f_entry
.
utility_code_definition
=
f_util_code
CFuncType
(
self
,
[
CFuncTypeArg
(
"memviewslice"
,
self
,
None
)]),
pos
=
None
,
defining
=
1
,
cname
=
copy_name
)
if
copy_contents_name_c
!=
copy_contents_name_f
:
entry
.
utility_code_definition
=
\
f_util_code
.
proto
+=
f_copy_contents_decl
MemoryView
.
CopyFuncUtilCode
(
self
,
to_memview
)
f_util_code
.
impl
+=
f_copy_contents_impl
# is_c_contiguous and is_f_contiguous functions
# is_c_contig and is_f_contig functions
for
(
c_or_f
,
cython_name
)
in
((
'c'
,
'is_c_contig'
),
(
'fortran'
,
'is_f_contig'
)):
for
c_or_f
,
cython_name
in
((
'c'
,
'is_c_contig'
),
(
'fortran'
,
'is_f_contig'
)):
is_contig_name
=
\
MemoryView
.
get_is_contig_func_name
(
c_or_f
)
is_contig_name
=
MemoryView
.
get_is_contig_func_name
(
c_or_f
)
entry
=
scope
.
declare_cfunction
(
cython_name
,
scope
.
declare_cfunction
(
cython_name
,
CFuncType
(
c_int_type
,
CFuncType
(
c_int_type
,
[
CFuncTypeArg
(
"memviewslice"
,
self
,
None
)]),
[
CFuncTypeArg
(
"memviewslice"
,
self
,
None
)]),
pos
=
None
,
pos
=
None
,
defining
=
1
,
defining
=
1
,
cname
=
is_contig_name
)
cname
=
is_contig_name
)
contig_decl
,
contig_impl
=
MemoryView
.
get_is_contiguous_func
(
c_or_f
)
entry
.
utility_code_definition
=
\
MemoryView
.
IsContigFuncUtilCode
(
c_or_f
)
contig_util_code
=
UtilityCode
(
proto
=
contig_decl
,
impl
=
contig_impl
)
return
True
return
True
...
...
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