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
Hide 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):
...
@@ -2132,7 +2132,7 @@ def p_cdef_extern_block(s, pos, ctx):
return
Nodes
.
CDefExternNode
(
pos
,
return
Nodes
.
CDefExternNode
(
pos
,
include_file
=
include_file
,
include_file
=
include_file
,
body
=
body
,
body
=
body
,
namespace
=
namespace
)
namespace
=
ctx
.
namespace
)
def
p_c_enum_definition
(
s
,
pos
,
ctx
):
def
p_c_enum_definition
(
s
,
pos
,
ctx
):
# s.sy == ident 'enum'
# s.sy == ident 'enum'
...
...
Cython/Compiler/PyrexTypes.py
View file @
34dd6f27
...
@@ -1387,15 +1387,13 @@ class CppClassType(CType):
...
@@ -1387,15 +1387,13 @@ class CppClassType(CType):
self
.
namespace
=
namespace
self
.
namespace
=
namespace
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
inherited
=
""
if
for_display
or
pyrex
:
for
base_class
in
self
.
base_classes
:
return
self
.
name
if
inherited
!=
""
:
else
:
inherited
+=
" : public "
cname
=
self
.
cname
inherited
+=
base_class
if
self
.
namespace
is
not
None
:
if
base_class
!=
baseclasses
[
-
1
]:
cname
=
"%s::%s"
%
(
self
.
namespace
.
replace
(
'.'
,
'::'
),
cname
)
inherited
+=
" , "
return
cname
return
"%s%s"
%
(
self
.
name
,
inherited
)
def
is_subclass
(
self
,
other_type
):
def
is_subclass
(
self
,
other_type
):
if
not
base_classes
.
empty
():
if
not
base_classes
.
empty
():
...
@@ -1407,10 +1405,13 @@ class CppClassType(CType):
...
@@ -1407,10 +1405,13 @@ class CppClassType(CType):
def
assignable_from_resolved_type
(
self
,
other_type
):
def
assignable_from_resolved_type
(
self
,
other_type
):
if
self
.
same_as_resolved_type
(
other_type
):
if
self
.
same_as_resolved_type
(
other_type
):
return
1
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
1
return
0
return
0
def
attributes_known
(
self
):
return
self
.
scope
is
not
None
class
CEnumType
(
CType
):
class
CEnumType
(
CType
):
# name string
# name string
# cname string or None
# cname string or None
...
...
Cython/Compiler/Symtab.py
View file @
34dd6f27
...
@@ -389,12 +389,14 @@ class Scope(object):
...
@@ -389,12 +389,14 @@ class Scope(object):
visibility = 'extern', packed = False):
visibility = 'extern', packed = False):
if visibility != 'extern':
if visibility != 'extern':
error(pos, "
C
++
classes
may
only
be
extern
")
error(pos, "
C
++
classes
may
only
be
extern
")
if cname is None:
cname = name
entry = self.lookup(name)
if not entry:
if not entry:
type = PyrexTypes.CppClassType(
type = PyrexTypes.CppClassType(
name, kind, scope, typedef_flag, cname, base_classes, namespace, packed)
name, kind, scope, typedef_flag, cname, base_classes, namespace, packed)
entry = self.declare_type(name, type, pos, cname,
entry = self.declare_type(name, type, pos, cname,
visibility = visibility, defining = scope is not None)
visibility = visibility, defining = scope is not None)
self.sue_entries.append(entry)
else:
else:
if not (entry.is_type and entry.type.is_cpp_class
if not (entry.is_type and entry.type.is_cpp_class
and entry.type.kind == kind):
and entry.type.kind == kind):
...
@@ -1589,8 +1591,8 @@ class CppClassScope(Scope):
...
@@ -1589,8 +1591,8 @@ class CppClassScope(Scope):
# Add an entry for an attribute.
# Add an entry for an attribute.
if
not
cname
:
if
not
cname
:
cname
=
name
cname
=
name
if
visibility
!=
'extern'
:
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
:
if
type
.
is_cfunction
:
type
=
PyrexTypes
.
CPtrType
(
type
)
type
=
PyrexTypes
.
CPtrType
(
type
)
entry
=
self
.
declare
(
name
,
cname
,
type
,
pos
,
visibility
)
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