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
daf0017c
Commit
daf0017c
authored
Jun 02, 2009
by
DaniloFreitas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CppClassScope
parent
84384af4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletion
+47
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+46
-0
No files found.
Cython/Compiler/Nodes.py
View file @
daf0017c
...
@@ -12,7 +12,7 @@ import PyrexTypes
...
@@ -12,7 +12,7 @@ import PyrexTypes
import
TypeSlots
import
TypeSlots
from
PyrexTypes
import
py_object_type
,
error_type
,
CTypedefType
,
CFuncType
from
PyrexTypes
import
py_object_type
,
error_type
,
CTypedefType
,
CFuncType
from
Symtab
import
ModuleScope
,
LocalScope
,
GeneratorLocalScope
,
\
from
Symtab
import
ModuleScope
,
LocalScope
,
GeneratorLocalScope
,
\
StructOrUnionScope
,
PyClassScope
,
CClassScope
StructOrUnionScope
,
PyClassScope
,
CClassScope
,
CppClassScope
from
Cython.Utils
import
open_new_file
,
replace_suffix
,
UtilityCode
from
Cython.Utils
import
open_new_file
,
replace_suffix
,
UtilityCode
from
StringEncoding
import
EncodedString
,
escape_byte_string
,
split_docstring
from
StringEncoding
import
EncodedString
,
escape_byte_string
,
split_docstring
import
Options
import
Options
...
...
Cython/Compiler/Symtab.py
View file @
daf0017c
...
@@ -1552,6 +1552,52 @@ class CClassScope(ClassScope):
...
@@ -1552,6 +1552,52 @@ class CClassScope(ClassScope):
return
Scope
.
release_temp
(
self
.
global_scope
(),
cname
)
return
Scope
.
release_temp
(
self
.
global_scope
(),
cname
)
class
CppClassScope
(
Scope
):
# Namespace of a C++ class.
def
__init__
(
self
,
name
=
"?"
):
Scope
.
__init__
(
self
,
name
,
None
,
None
)
def
declare_var
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'extern'
,
is_cdef
=
0
,
allow_pyobject
=
0
):
# Add an entry for an attribute.
if
not
cname
:
cname
=
name
if
visibility
!=
'extern'
:
error
(
"Visibility for C++ class member are extern only"
)
if
type
.
is_cfunction
:
type
=
PyrexTypes
.
CPtrType
(
type
)
entry
=
self
.
declare
(
name
,
cname
,
type
,
pos
,
visibility
)
entry
.
is_variable
=
1
self
.
var_entries
.
append
(
entry
)
if
type
.
is_pyobject
and
not
allow_pyobject
:
error
(
pos
,
"C++ class member cannot be a Python object"
)
return
entry
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'extern'
,
defining
=
0
,
api
=
0
,
in_pxd
=
0
,
modifiers
=
()):
self
.
declare_var
(
name
,
type
,
pos
,
cname
,
visibility
)
def
declare_inherited_cpp_attributes
(
self
,
base_scope
):
# Declare entries for all the C++ attributes of an
# inherited type, with cnames modified appropriately
# to work with this type.
def
adapt
(
cname
):
return
"%s.%s"
%
(
Naming
.
obj_base_cname
,
base_entry
.
cname
)
for
base_entry
in
\
base_scope
.
inherited_var_entries
+
base_scope
.
var_entries
:
entry
=
self
.
declare
(
base_entry
.
name
,
adapt
(
base_entry
.
cname
),
base_entry
.
type
,
None
,
'extern'
)
entry
.
is_variable
=
1
self
.
inherited_var_entries
.
append
(
entry
)
for
base_entry
in
base_scope
.
cfunc_entries
:
entry
=
self
.
declare_cfunction
(
base_entry
.
name
,
base_entry
.
type
,
base_entry
.
pos
,
adapt
(
base_entry
.
cname
),
base_entry
.
visibility
,
base_entry
.
func_modifiers
)
entry
.
is_inherited
=
1
class
PropertyScope
(
Scope
):
class
PropertyScope
(
Scope
):
# Scope holding the __get__, __set__ and __del__ methods for
# Scope holding the __get__, __set__ and __del__ methods for
# a property of an extension type.
# a property of an extension 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