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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
17c3c6fc
Commit
17c3c6fc
authored
Jun 08, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove windows line break characters.
parent
70d31eb4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
103 deletions
+103
-103
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+28
-28
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-6
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+4
-4
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+40
-40
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+25
-25
No files found.
Cython/Compiler/ModuleNode.py
View file @
17c3c6fc
...
...
@@ -704,34 +704,34 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
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"
)
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/Nodes.py
View file @
17c3c6fc
...
...
@@ -907,20 +907,20 @@ class CppClassNode(CStructOrUnionDefNode):
# name string
# cname string or None
# visibility "extern"
# visibility "extern"
# in_pxd boolean
# attributes [CVarDefNode] or None
# entry Entry
# base_classes [string]
# namespace string or None
# namespace string or None
def
analyse_declarations
(
self
,
env
):
scope
=
None
if
self
.
attributes
is
not
None
:
scope
=
CppClassScope
(
self
.
name
)
self
.
entry
=
env
.
declare_cpp_class
(
self
.
name
,
"cppclass"
,
scope
,
0
,
self
.
pos
,
self
.
cname
,
self
.
base_classes
,
self
.
namespace
,
visibility
=
self
.
visibility
)
scope
=
CppClassScope
(
self
.
name
)
self
.
entry
=
env
.
declare_cpp_class
(
self
.
name
,
"cppclass"
,
scope
,
0
,
self
.
pos
,
self
.
cname
,
self
.
base_classes
,
self
.
namespace
,
visibility
=
self
.
visibility
)
if
self
.
attributes
is
not
None
:
if
self
.
in_pxd
and
not
env
.
in_cinclude
:
self
.
entry
.
defined_in_pxd
=
1
...
...
Cython/Compiler/Parsing.py
View file @
17c3c6fc
...
...
@@ -31,7 +31,7 @@ class Ctx(object):
api
=
0
overridable
=
0
nogil
=
0
namespace
=
None
namespace
=
None
def
__init__
(
self
,
**
kwds
):
self
.
__dict__
.
update
(
kwds
)
...
...
@@ -2124,7 +2124,7 @@ def p_cdef_extern_block(s, pos, ctx):
_
,
include_file
=
p_string_literal
(
s
)
if
s
.
systring
==
"namespace"
:
s
.
next
()
ctx
.
namespace
=
p_ident
(
s
)
ctx
.
namespace
=
p_ident
(
s
)
ctx
=
ctx
(
cdef_flag
=
1
,
visibility
=
'extern'
)
if
p_nogil
(
s
):
ctx
.
nogil
=
1
...
...
@@ -2584,10 +2584,10 @@ def p_cpp_class_definition(s, pos, ctx):
name = class_name,
cname = None,
base_classes = base_classes,
namespace = ctx.namespace,
namespace = ctx.namespace,
visibility = ctx.visibility,
in_pxd = ctx.level == 'module_pxd',
attributes = attributes)
attributes = attributes)
...
...
Cython/Compiler/PyrexTypes.py
View file @
17c3c6fc
...
...
@@ -91,7 +91,7 @@ class PyrexType(BaseType):
is_null_ptr
=
0
is_cfunction
=
0
is_struct_or_union
=
0
is_cpp_class
=
0
is_cpp_class
=
0
is_struct
=
0
is_enum
=
0
is_typedef
=
0
...
...
@@ -1360,32 +1360,32 @@ class CStructOrUnionType(CType):
for
x
in
self
.
scope
.
var_entries
]
return
max
(
child_depths
)
+
1
class
CppClassType
(
CType
):
# name string
# cname string
# kind string "cppclass"
# scope CppClassScope
# typedef_flag boolean
# packed boolean
is_cpp_class
=
1
has_attributes
=
1
class
CppClassType
(
CType
):
# name string
# cname string
# kind string "cppclass"
# scope CppClassScope
# typedef_flag boolean
# packed boolean
is_cpp_class
=
1
has_attributes
=
1
base_classes
=
[]
namespace
=
None
namespace
=
None
def
__init__
(
self
,
name
,
kind
,
scope
,
typedef_flag
,
cname
,
base_classes
,
namespace
=
None
,
packed
=
False
):
self
.
name
=
name
self
.
cname
=
cname
self
.
kind
=
kind
self
.
scope
=
scope
self
.
typedef_flag
=
typedef_flag
self
.
exception_check
=
True
self
.
_convert_code
=
None
self
.
packed
=
packed
namespace
=
None
,
packed
=
False
):
self
.
name
=
name
self
.
cname
=
cname
self
.
kind
=
kind
self
.
scope
=
scope
self
.
typedef_flag
=
typedef_flag
self
.
exception_check
=
True
self
.
_convert_code
=
None
self
.
packed
=
packed
self
.
base_classes
=
base_classes
self
.
namespace
=
namespace
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
:
...
...
@@ -1395,22 +1395,22 @@ class CppClassType(CType):
if
base_class
!=
baseclasses
[
-
1
]:
inherited
+=
" , "
return
"%s%s"
%
(
self
.
name
,
inherited
)
def
is_subclass
(
self
,
other_type
):
if
not
base_classes
.
empty
():
for
base_class
in
self
.
base_classes
:
if
base_class
.
is_subclass
(
other_type
):
return
1
return
0
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
):
return
1
return
0
def
is_subclass
(
self
,
other_type
):
if
not
base_classes
.
empty
():
for
base_class
in
self
.
base_classes
:
if
base_class
.
is_subclass
(
other_type
):
return
1
return
0
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
):
return
1
return
0
class
CEnumType
(
CType
):
# name string
# cname string or None
...
...
Cython/Compiler/Symtab.py
View file @
17c3c6fc
...
...
@@ -384,32 +384,32 @@ class Scope(object):
self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
return entry
def declare_cpp_class(self, name, kind, scope,
def declare_cpp_class(self, name, kind, scope,
typedef_flag, pos, cname = None, base_classes = [], namespace = None,
visibility = 'extern', packed = False):
if visibility != 'extern':
error(pos, "
C
++
classes
may
only
be
extern
")
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):
warning(pos, "'%s'
redeclared
" % name, 0)
elif scope and entry.type.scope:
warning(pos, "'%s'
already
defined
(
ignoring
second
definition
)
" % name, 0)
else:
self.check_previous_typedef_flag(entry, typedef_flag, pos)
if scope:
entry.type.scope = scope
self.type_entries.append(entry)
if not scope and not entry.type.scope:
self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
return entry
visibility = 'extern', packed = False):
if visibility != 'extern':
error(pos, "
C
++
classes
may
only
be
extern
")
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):
warning(pos, "'%s'
redeclared
" % name, 0)
elif scope and entry.type.scope:
warning(pos, "'%s'
already
defined
(
ignoring
second
definition
)
" % name, 0)
else:
self.check_previous_typedef_flag(entry, typedef_flag, pos)
if scope:
entry.type.scope = scope
self.type_entries.append(entry)
if not scope and not entry.type.scope:
self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
return entry
def check_previous_typedef_flag(self, entry, typedef_flag, pos):
if typedef_flag != entry.type.typedef_flag:
error(pos, "'%s'
previously
declared
using
'%s'" % (
...
...
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