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
7269d7b6
Commit
7269d7b6
authored
Dec 14, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C++ cleanup.
parent
44adaf70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
67 deletions
+5
-67
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-34
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+0
-33
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+3
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
7269d7b6
...
...
@@ -3811,20 +3811,13 @@ class UnopNode(ExprNode):
if
type
.
is_ptr
:
type
=
type
.
base_type
entry
=
env
.
lookup
(
type
.
name
)
function
=
entry
.
type
.
scope
.
lookup
(
self
.
operators
[
self
.
operator
]
)
function
=
entry
.
type
.
scope
.
lookup
(
"operator%s"
%
self
.
operator
)
if
not
function
:
error
(
self
.
pos
,
"'%s' operator not defined for %s"
%
(
self
.
operator
,
type
))
self
.
type_error
()
return
self
.
type
=
function
.
type
.
return_type
operators
=
{
"++"
:
u"__inc__"
,
"--"
:
u"__dec__"
,
"*"
:
u"__deref__"
,
"not"
:
u"__not__"
# TODO(danilo): Also handle in NotNode.
}
...
...
@@ -4347,21 +4340,6 @@ class NumBinopNode(BinopNode):
"**"
:
"PyNumber_Power"
}
operators
=
{
"+"
:
u"__add__"
,
"-"
:
u"__sub__"
,
"*"
:
u"__mul__"
,
"/"
:
u"__div__"
,
"%"
:
u"__mod__"
,
"<<"
:
u"__lshift__"
,
">>"
:
u"__rshift__"
,
"&"
:
u"__and__"
,
"|"
:
u"__or__"
,
"^"
:
u"__xor__"
,
}
class
IntBinopNode
(
NumBinopNode
):
# Binary operation taking integer arguments.
...
...
@@ -5001,7 +4979,7 @@ class PrimaryCmpNode(NewTempExprNode, CmpNode):
if
type2
.
is_ptr
:
type2
=
type2
.
base_type
entry
=
env
.
lookup
(
type1
.
name
)
function
=
entry
.
type
.
scope
.
lookup
(
self
.
operators
[
self
.
operator
]
)
function
=
entry
.
type
.
scope
.
lookup
(
"operator%s"
%
self
.
operator
)
if
not
function
:
error
(
self
.
pos
,
"'%s' operator not defined for '%s %s %s'"
%
(
self
.
operator
,
type1
,
self
.
operator
,
type2
))
...
...
@@ -5113,16 +5091,6 @@ class PrimaryCmpNode(NewTempExprNode, CmpNode):
if
self
.
cascade
:
self
.
cascade
.
annotate
(
code
)
operators
=
{
"<"
:
u"__le__"
,
">"
:
u"__gt__"
,
"=="
:
u"__eq__"
,
"<="
:
u"__le__"
,
">="
:
u"__ge__"
,
"!="
:
u"__ne__"
,
"<>"
:
u"__ne__"
}
class
CascadedCmpNode
(
Node
,
CmpNode
):
# A CascadedCmpNode is not a complete expression node. It
...
...
Cython/Compiler/ModuleNode.py
View file @
7269d7b6
...
...
@@ -390,8 +390,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self
.
generate_typedef
(
entry
,
code
)
elif
type
.
is_struct_or_union
:
self
.
generate_struct_union_definition
(
entry
,
code
)
elif
type
.
is_cpp_class
:
self
.
generate_cpp_class_definition
(
entry
,
code
)
elif
type
.
is_enum
:
self
.
generate_enum_definition
(
entry
,
code
)
elif
type
.
is_extension_type
and
entry
not
in
vtabslot_entries
:
...
...
@@ -639,8 +637,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self
.
generate_typedef
(
entry
,
code
)
elif
type
.
is_struct_or_union
:
self
.
generate_struct_union_definition
(
entry
,
code
)
elif
type
.
is_cpp_class
:
self
.
generate_cpp_class_definition
(
entry
,
code
)
elif
type
.
is_enum
:
self
.
generate_enum_definition
(
entry
,
code
)
elif
type
.
is_extension_type
:
...
...
@@ -707,35 +703,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"#pragma pack(pop)"
)
code
.
putln
(
"#endif"
)
def
generate_cpp_class_definition
(
self
,
entry
,
code
):
code
.
mark_pos
(
entry
.
pos
)
type
=
entry
.
type
scope
=
type
.
scope
if
scope
:
kind
=
type
.
kind
packed
=
type
.
is_cpp_class
and
type
.
packed
if
packed
:
kind
=
"%s %s"
%
(
type
.
kind
,
"__Pyx_PACKED"
)
code
.
globalstate
.
use_utility_code
(
packed_struct_utility_code
)
header
,
footer
=
\
self
.
sue_header_footer
(
type
,
kind
,
type
.
cname
)
code
.
putln
(
""
)
if
packed
:
code
.
putln
(
"#if !defined(__GNUC__)"
)
code
.
putln
(
"#pragma pack(push, 1)"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
header
)
var_entries
=
scope
.
var_entries
for
attr
in
var_entries
:
code
.
putln
(
"%s;"
%
attr
.
type
.
declaration_code
(
attr
.
cname
))
code
.
putln
(
footer
)
if
packed
:
code
.
putln
(
"#if !defined(__GNUC__)"
)
code
.
putln
(
"#pragma pack(pop)"
)
code
.
putln
(
"#endif"
)
def
generate_enum_definition
(
self
,
entry
,
code
):
code
.
mark_pos
(
entry
.
pos
)
type
=
entry
.
type
...
...
Cython/Compiler/PyrexTypes.py
View file @
7269d7b6
...
...
@@ -1825,6 +1825,9 @@ def best_match(args, functions, pos):
error_str
=
"Call with wrong number of arguments (expected %s, got %s)"
\
%
(
expectation
,
actual_nargs
)
continue
if
len
(
functions
)
==
1
:
# Optimize the most common case of no overloading...
return
func
score
=
[
0
,
0
,
0
]
for
i
in
range
(
min
(
len
(
args
),
len
(
func_type
.
args
))):
src_type
=
args
[
i
].
type
...
...
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