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
34dd6f27
Commit
34dd6f27
authored
Jun 08, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on cpp types.
parent
17c3c6fc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
14 deletions
+17
-14
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+11
-10
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+5
-3
No files found.
Cython/Compiler/Parsing.py
View file @
34dd6f27
...
...
@@ -2132,7 +2132,7 @@ def p_cdef_extern_block(s, pos, ctx):
return
Nodes
.
CDefExternNode
(
pos
,
include_file
=
include_file
,
body
=
body
,
namespace
=
namespace
)
namespace
=
ctx
.
namespace
)
def
p_c_enum_definition
(
s
,
pos
,
ctx
):
# s.sy == ident 'enum'
...
...
Cython/Compiler/PyrexTypes.py
View file @
34dd6f27
...
...
@@ -1387,15 +1387,13 @@ class CppClassType(CType):
self
.
namespace
=
namespace
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
inherited
=
""
for
base_class
in
self
.
base_classes
:
if
inherited
!=
""
:
inherited
+=
" : public "
inherited
+=
base_class
if
base_class
!=
baseclasses
[
-
1
]:
inherited
+=
" , "
return
"%s%s"
%
(
self
.
name
,
inherited
)
if
for_display
or
pyrex
:
return
self
.
name
else
:
cname
=
self
.
cname
if
self
.
namespace
is
not
None
:
cname
=
"%s::%s"
%
(
self
.
namespace
.
replace
(
'.'
,
'::'
),
cname
)
return
cname
def
is_subclass
(
self
,
other_type
):
if
not
base_classes
.
empty
():
...
...
@@ -1407,10 +1405,13 @@ class CppClassType(CType):
def
assignable_from_resolved_type
(
self
,
other_type
):
if
self
.
same_as_resolved_type
(
other_type
):
return
1
if
self
.
is_subclass
(
other
)
or
self
.
same_as
(
other_type
):
if
other
.
is_subclass
(
self
)
or
self
.
same_as
(
other_type
):
return
1
return
0
def
attributes_known
(
self
):
return
self
.
scope
is
not
None
class
CEnumType
(
CType
):
# name string
# cname string or None
...
...
Cython/Compiler/Symtab.py
View file @
34dd6f27
...
...
@@ -389,12 +389,14 @@ class Scope(object):
visibility = 'extern', packed = False):
if visibility != 'extern':
error(pos, "
C
++
classes
may
only
be
extern
")
if cname is None:
cname = name
entry = self.lookup(name)
if not entry:
type = PyrexTypes.CppClassType(
name, kind, scope, typedef_flag, cname, base_classes, namespace, packed)
entry = self.declare_type(name, type, pos, cname,
visibility = visibility, defining = scope is not None)
self.sue_entries.append(entry)
else:
if not (entry.is_type and entry.type.is_cpp_class
and entry.type.kind == kind):
...
...
@@ -1590,7 +1592,7 @@ class CppClassScope(Scope):
if
not
cname
:
cname
=
name
if
visibility
!=
'extern'
:
error
(
"Visibility for C++ class member are extern only"
)
error
(
pos
,
"Visibility for C++ class member are extern only"
)
if
type
.
is_cfunction
:
type
=
PyrexTypes
.
CPtrType
(
type
)
entry
=
self
.
declare
(
name
,
cname
,
type
,
pos
,
visibility
)
...
...
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