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
Kirill Smelkov
cython
Commits
2fe3ae06
Commit
2fe3ae06
authored
Aug 15, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working stl vector.
parent
fee03687
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
18 deletions
+38
-18
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-3
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+26
-4
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+9
-9
No files found.
Cython/Compiler/Nodes.py
View file @
2fe3ae06
...
@@ -944,7 +944,7 @@ class CppClassNode(CStructOrUnionDefNode):
...
@@ -944,7 +944,7 @@ class CppClassNode(CStructOrUnionDefNode):
def
analyse_declarations
(
self
,
env
):
def
analyse_declarations
(
self
,
env
):
scope
=
None
scope
=
None
if
len
(
self
.
attributes
)
!=
0
:
if
len
(
self
.
attributes
)
!=
0
:
scope
=
CppClassScope
(
self
.
name
)
scope
=
CppClassScope
(
self
.
name
,
env
)
else
:
else
:
self
.
attributes
=
None
self
.
attributes
=
None
base_class_types
=
[]
base_class_types
=
[]
...
@@ -968,7 +968,7 @@ class CppClassNode(CStructOrUnionDefNode):
...
@@ -968,7 +968,7 @@ class CppClassNode(CStructOrUnionDefNode):
if
self
.
in_pxd
and
not
env
.
in_cinclude
:
if
self
.
in_pxd
and
not
env
.
in_cinclude
:
self
.
entry
.
defined_in_pxd
=
1
self
.
entry
.
defined_in_pxd
=
1
for
attr
in
self
.
attributes
:
for
attr
in
self
.
attributes
:
attr
.
analyse_declarations
(
env
,
scope
)
attr
.
analyse_declarations
(
scope
)
class
CEnumDefNode
(
StatNode
):
class
CEnumDefNode
(
StatNode
):
# name string or None
# name string or None
...
...
Cython/Compiler/Parsing.py
View file @
2fe3ae06
...
@@ -2602,8 +2602,6 @@ def p_cpp_class_definition(s, pos, ctx):
...
@@ -2602,8 +2602,6 @@ def p_cpp_class_definition(s, pos, ctx):
s.next()
s.next()
s.expect(']')
s.expect(']')
base_classes = []
base_classes = []
objstruct_name = None
typeobj_name = None
if s.sy == '(':
if s.sy == '(':
base_class = True
base_class = True
while (base_class):
while (base_class):
...
@@ -2626,7 +2624,7 @@ def p_cpp_class_definition(s, pos, ctx):
...
@@ -2626,7 +2624,7 @@ def p_cpp_class_definition(s, pos, ctx):
s.expect('NEWLINE')
s.expect('NEWLINE')
s.expect_indent()
s.expect_indent()
attributes = []
attributes = []
body_ctx = Ctx()
body_ctx = Ctx(
visibility = ctx.visibility
)
body_ctx.templates = templates
body_ctx.templates = templates
while s.sy != 'DEDENT':
while s.sy != 'DEDENT':
if s.sy != 'pass':
if s.sy != 'pass':
...
...
Cython/Compiler/PyrexTypes.py
View file @
2fe3ae06
...
@@ -1242,7 +1242,23 @@ class CFuncType(CType):
...
@@ -1242,7 +1242,23 @@ class CFuncType(CType):
def
signature_cast_string
(
self
):
def
signature_cast_string
(
self
):
s
=
self
.
declaration_code
(
"(*)"
,
with_calling_convention
=
False
)
s
=
self
.
declaration_code
(
"(*)"
,
with_calling_convention
=
False
)
return
'(%s)'
%
s
return
'(%s)'
%
s
def
specialize
(
self
,
values
):
if
self
.
templates
is
None
:
new_templates
=
None
else
:
new_templates
=
[
v
.
specialize
(
values
)
for
v
in
self
.
templates
]
return
CFuncType
(
self
.
return_type
.
specialize
(
values
),
[
arg
.
specialize
(
values
)
for
arg
in
self
.
args
],
has_varargs
=
0
,
exception_value
=
self
.
exception_value
,
exception_check
=
self
.
exception_check
,
calling_convention
=
self
.
calling_convention
,
nogil
=
self
.
nogil
,
with_gil
=
self
.
with_gil
,
is_overridable
=
self
.
is_overridable
,
optional_arg_count
=
self
.
optional_arg_count
,
templates
=
new_templates
)
class
CFuncTypeArg
(
object
):
class
CFuncTypeArg
(
object
):
# name string
# name string
...
@@ -1266,6 +1282,9 @@ class CFuncTypeArg(object):
...
@@ -1266,6 +1282,9 @@ class CFuncTypeArg(object):
def
declaration_code
(
self
,
for_display
=
0
):
def
declaration_code
(
self
,
for_display
=
0
):
return
self
.
type
.
declaration_code
(
self
.
cname
,
for_display
)
return
self
.
type
.
declaration_code
(
self
.
cname
,
for_display
)
def
specialize
(
self
,
values
):
return
CFuncTypeArg
(
self
.
name
,
self
.
type
.
specialize
(
values
),
self
.
pos
,
self
.
cname
)
class
CStructOrUnionType
(
CType
):
class
CStructOrUnionType
(
CType
):
...
@@ -1736,9 +1755,12 @@ modifiers_and_name_to_type = {
...
@@ -1736,9 +1755,12 @@ modifiers_and_name_to_type = {
}
}
def
is_promotion
(
type
,
other_type
):
def
is_promotion
(
type
,
other_type
):
return
(
type
.
is_int
and
type
.
is_int
and
type
.
signed
==
other_type
.
signed
)
\
if
type
.
is_numeric
and
other_type
.
is_numeric
:
or
(
type
.
is_float
and
other_type
.
is_float
)
\
return
(
type
.
is_int
and
type
.
is_int
and
type
.
signed
==
other_type
.
signed
)
\
or
(
type
.
is_enum
and
other_type
.
is_int
)
or
(
type
.
is_float
and
other_type
.
is_float
)
\
or
(
type
.
is_enum
and
other_type
.
is_int
)
else
:
return
False
def
best_match
(
args
,
functions
,
pos
):
def
best_match
(
args
,
functions
,
pos
):
actual_nargs
=
len
(
args
)
actual_nargs
=
len
(
args
)
...
...
Cython/Compiler/Symtab.py
View file @
2fe3ae06
...
@@ -1137,7 +1137,11 @@ class ModuleScope(Scope):
...
@@ -1137,7 +1137,11 @@ class ModuleScope(Scope):
entry.type.scope = scope
entry.type.scope = scope
self.type_entries.append(entry)
self.type_entries.append(entry)
if not scope and not entry.type.scope:
if not scope and not entry.type.scope:
entry.type.scope = CppClassScope(name)
entry.type.scope = CppClassScope(name, self)
if templates is not None:
for T in templates:
template_entry = entry.type.scope.declare(T.name, T.name, T, None, '
extern
')
template_entry.is_type = 1
def declare_inherited_attributes(entry, base_classes):
def declare_inherited_attributes(entry, base_classes):
for base_class in base_classes:
for base_class in base_classes:
...
@@ -1604,8 +1608,9 @@ class CppClassScope(Scope):
...
@@ -1604,8 +1608,9 @@ class CppClassScope(Scope):
# Namespace of a C++ class.
# Namespace of a C++ class.
inherited_var_entries
=
[]
inherited_var_entries
=
[]
def
__init__
(
self
,
name
=
"?"
):
def
__init__
(
self
,
name
,
outer_scope
):
Scope
.
__init__
(
self
,
name
,
None
,
None
)
Scope
.
__init__
(
self
,
name
,
outer_scope
,
None
)
self
.
directives
=
outer_scope
.
directives
def
declare_var
(
self
,
name
,
type
,
pos
,
def
declare_var
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'extern'
,
is_cdef
=
0
,
allow_pyobject
=
0
):
cname
=
None
,
visibility
=
'extern'
,
is_cdef
=
0
,
allow_pyobject
=
0
):
...
@@ -1622,11 +1627,6 @@ class CppClassScope(Scope):
...
@@ -1622,11 +1627,6 @@ class CppClassScope(Scope):
"C++ class member cannot be a Python object"
)
"C++ class member cannot be a Python object"
)
return
entry
return
entry
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'extern'
,
defining
=
0
,
api
=
0
,
in_pxd
=
0
,
modifiers
=
()):
entry
=
self
.
declare_var
(
name
,
type
,
pos
,
cname
,
visibility
)
def
declare_inherited_cpp_attributes
(
self
,
base_scope
):
def
declare_inherited_cpp_attributes
(
self
,
base_scope
):
# Declare entries for all the C++ attributes of an
# Declare entries for all the C++ attributes of an
# inherited type, with cnames modified appropriately
# inherited type, with cnames modified appropriately
...
@@ -1644,7 +1644,7 @@ class CppClassScope(Scope):
...
@@ -1644,7 +1644,7 @@ class CppClassScope(Scope):
entry
.
is_inherited
=
1
entry
.
is_inherited
=
1
def
specialize
(
self
,
values
):
def
specialize
(
self
,
values
):
scope
=
CppClassScope
()
scope
=
CppClassScope
(
self
.
name
,
self
.
outer_scope
)
for
entry
in
self
.
entries
.
values
():
for
entry
in
self
.
entries
.
values
():
scope
.
declare_var
(
entry
.
name
,
scope
.
declare_var
(
entry
.
name
,
entry
.
type
.
specialize
(
values
),
entry
.
type
.
specialize
(
values
),
...
...
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