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
Boxiang Sun
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):
...
@@ -704,34 +704,34 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
def
generate_cpp_class_definition
(
self
,
entry
,
code
):
def
generate_cpp_class_definition
(
self
,
entry
,
code
):
code
.
mark_pos
(
entry
.
pos
)
code
.
mark_pos
(
entry
.
pos
)
type
=
entry
.
type
type
=
entry
.
type
scope
=
type
.
scope
scope
=
type
.
scope
if
scope
:
if
scope
:
kind
=
type
.
kind
kind
=
type
.
kind
packed
=
type
.
is_cpp_class
and
type
.
packed
packed
=
type
.
is_cpp_class
and
type
.
packed
if
packed
:
if
packed
:
kind
=
"%s %s"
%
(
type
.
kind
,
"__Pyx_PACKED"
)
kind
=
"%s %s"
%
(
type
.
kind
,
"__Pyx_PACKED"
)
code
.
globalstate
.
use_utility_code
(
packed_struct_utility_code
)
code
.
globalstate
.
use_utility_code
(
packed_struct_utility_code
)
header
,
footer
=
\
header
,
footer
=
\
self
.
sue_header_footer
(
type
,
kind
,
type
.
cname
)
self
.
sue_header_footer
(
type
,
kind
,
type
.
cname
)
code
.
putln
(
""
)
code
.
putln
(
""
)
if
packed
:
if
packed
:
code
.
putln
(
"#if !defined(__GNUC__)"
)
code
.
putln
(
"#if !defined(__GNUC__)"
)
code
.
putln
(
"#pragma pack(push, 1)"
)
code
.
putln
(
"#pragma pack(push, 1)"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
header
)
code
.
putln
(
header
)
var_entries
=
scope
.
var_entries
var_entries
=
scope
.
var_entries
for
attr
in
var_entries
:
for
attr
in
var_entries
:
code
.
putln
(
code
.
putln
(
"%s;"
%
"%s;"
%
attr
.
type
.
declaration_code
(
attr
.
cname
))
attr
.
type
.
declaration_code
(
attr
.
cname
))
code
.
putln
(
footer
)
code
.
putln
(
footer
)
if
packed
:
if
packed
:
code
.
putln
(
"#if !defined(__GNUC__)"
)
code
.
putln
(
"#if !defined(__GNUC__)"
)
code
.
putln
(
"#pragma pack(pop)"
)
code
.
putln
(
"#pragma pack(pop)"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
def
generate_enum_definition
(
self
,
entry
,
code
):
def
generate_enum_definition
(
self
,
entry
,
code
):
code
.
mark_pos
(
entry
.
pos
)
code
.
mark_pos
(
entry
.
pos
)
type
=
entry
.
type
type
=
entry
.
type
...
...
Cython/Compiler/Nodes.py
View file @
17c3c6fc
...
@@ -907,20 +907,20 @@ class CppClassNode(CStructOrUnionDefNode):
...
@@ -907,20 +907,20 @@ class CppClassNode(CStructOrUnionDefNode):
# name string
# name string
# cname string or None
# cname string or None
# visibility "extern"
# visibility "extern"
# in_pxd boolean
# in_pxd boolean
# attributes [CVarDefNode] or None
# attributes [CVarDefNode] or None
# entry Entry
# entry Entry
# base_classes [string]
# base_classes [string]
# namespace string or None
# namespace string or None
def
analyse_declarations
(
self
,
env
):
def
analyse_declarations
(
self
,
env
):
scope
=
None
scope
=
None
if
self
.
attributes
is
not
None
:
if
self
.
attributes
is
not
None
:
scope
=
CppClassScope
(
self
.
name
)
scope
=
CppClassScope
(
self
.
name
)
self
.
entry
=
env
.
declare_cpp_class
(
self
.
entry
=
env
.
declare_cpp_class
(
self
.
name
,
"cppclass"
,
scope
,
0
,
self
.
pos
,
self
.
name
,
"cppclass"
,
scope
,
0
,
self
.
pos
,
self
.
cname
,
self
.
base_classes
,
self
.
namespace
,
visibility
=
self
.
visibility
)
self
.
cname
,
self
.
base_classes
,
self
.
namespace
,
visibility
=
self
.
visibility
)
if
self
.
attributes
is
not
None
:
if
self
.
attributes
is
not
None
:
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
...
...
Cython/Compiler/Parsing.py
View file @
17c3c6fc
...
@@ -31,7 +31,7 @@ class Ctx(object):
...
@@ -31,7 +31,7 @@ class Ctx(object):
api
=
0
api
=
0
overridable
=
0
overridable
=
0
nogil
=
0
nogil
=
0
namespace
=
None
namespace
=
None
def
__init__
(
self
,
**
kwds
):
def
__init__
(
self
,
**
kwds
):
self
.
__dict__
.
update
(
kwds
)
self
.
__dict__
.
update
(
kwds
)
...
@@ -2124,7 +2124,7 @@ def p_cdef_extern_block(s, pos, ctx):
...
@@ -2124,7 +2124,7 @@ def p_cdef_extern_block(s, pos, ctx):
_
,
include_file
=
p_string_literal
(
s
)
_
,
include_file
=
p_string_literal
(
s
)
if
s
.
systring
==
"namespace"
:
if
s
.
systring
==
"namespace"
:
s
.
next
()
s
.
next
()
ctx
.
namespace
=
p_ident
(
s
)
ctx
.
namespace
=
p_ident
(
s
)
ctx
=
ctx
(
cdef_flag
=
1
,
visibility
=
'extern'
)
ctx
=
ctx
(
cdef_flag
=
1
,
visibility
=
'extern'
)
if
p_nogil
(
s
):
if
p_nogil
(
s
):
ctx
.
nogil
=
1
ctx
.
nogil
=
1
...
@@ -2584,10 +2584,10 @@ def p_cpp_class_definition(s, pos, ctx):
...
@@ -2584,10 +2584,10 @@ def p_cpp_class_definition(s, pos, ctx):
name = class_name,
name = class_name,
cname = None,
cname = None,
base_classes = base_classes,
base_classes = base_classes,
namespace = ctx.namespace,
namespace = ctx.namespace,
visibility = ctx.visibility,
visibility = ctx.visibility,
in_pxd = ctx.level == 'module_pxd',
in_pxd = ctx.level == 'module_pxd',
attributes = attributes)
attributes = attributes)
...
...
Cython/Compiler/PyrexTypes.py
View file @
17c3c6fc
...
@@ -91,7 +91,7 @@ class PyrexType(BaseType):
...
@@ -91,7 +91,7 @@ class PyrexType(BaseType):
is_null_ptr
=
0
is_null_ptr
=
0
is_cfunction
=
0
is_cfunction
=
0
is_struct_or_union
=
0
is_struct_or_union
=
0
is_cpp_class
=
0
is_cpp_class
=
0
is_struct
=
0
is_struct
=
0
is_enum
=
0
is_enum
=
0
is_typedef
=
0
is_typedef
=
0
...
@@ -1360,32 +1360,32 @@ class CStructOrUnionType(CType):
...
@@ -1360,32 +1360,32 @@ class CStructOrUnionType(CType):
for
x
in
self
.
scope
.
var_entries
]
for
x
in
self
.
scope
.
var_entries
]
return
max
(
child_depths
)
+
1
return
max
(
child_depths
)
+
1
class
CppClassType
(
CType
):
class
CppClassType
(
CType
):
# name string
# name string
# cname string
# cname string
# kind string "cppclass"
# kind string "cppclass"
# scope CppClassScope
# scope CppClassScope
# typedef_flag boolean
# typedef_flag boolean
# packed boolean
# packed boolean
is_cpp_class
=
1
is_cpp_class
=
1
has_attributes
=
1
has_attributes
=
1
base_classes
=
[]
base_classes
=
[]
namespace
=
None
namespace
=
None
def
__init__
(
self
,
name
,
kind
,
scope
,
typedef_flag
,
cname
,
base_classes
,
def
__init__
(
self
,
name
,
kind
,
scope
,
typedef_flag
,
cname
,
base_classes
,
namespace
=
None
,
packed
=
False
):
namespace
=
None
,
packed
=
False
):
self
.
name
=
name
self
.
name
=
name
self
.
cname
=
cname
self
.
cname
=
cname
self
.
kind
=
kind
self
.
kind
=
kind
self
.
scope
=
scope
self
.
scope
=
scope
self
.
typedef_flag
=
typedef_flag
self
.
typedef_flag
=
typedef_flag
self
.
exception_check
=
True
self
.
exception_check
=
True
self
.
_convert_code
=
None
self
.
_convert_code
=
None
self
.
packed
=
packed
self
.
packed
=
packed
self
.
base_classes
=
base_classes
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
):
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
inherited
=
""
inherited
=
""
for
base_class
in
self
.
base_classes
:
for
base_class
in
self
.
base_classes
:
...
@@ -1395,22 +1395,22 @@ class CppClassType(CType):
...
@@ -1395,22 +1395,22 @@ class CppClassType(CType):
if
base_class
!=
baseclasses
[
-
1
]:
if
base_class
!=
baseclasses
[
-
1
]:
inherited
+=
" , "
inherited
+=
" , "
return
"%s%s"
%
(
self
.
name
,
inherited
)
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
():
for
base_class
in
self
.
base_classes
:
for
base_class
in
self
.
base_classes
:
if
base_class
.
is_subclass
(
other_type
):
if
base_class
.
is_subclass
(
other_type
):
return
1
return
1
return
0
return
0
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
self
.
is_subclass
(
other
)
or
self
.
same_as
(
other_type
):
return
1
return
1
return
0
return
0
class
CEnumType
(
CType
):
class
CEnumType
(
CType
):
# name string
# name string
# cname string or None
# cname string or None
...
...
Cython/Compiler/Symtab.py
View file @
17c3c6fc
...
@@ -384,32 +384,32 @@ class Scope(object):
...
@@ -384,32 +384,32 @@ class Scope(object):
self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
return entry
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,
typedef_flag, pos, cname = None, base_classes = [], namespace = None,
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 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)
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):
warning(pos, "'%s'
redeclared
" % name, 0)
warning(pos, "'%s'
redeclared
" % name, 0)
elif scope and entry.type.scope:
elif scope and entry.type.scope:
warning(pos, "'%s'
already
defined
(
ignoring
second
definition
)
" % name, 0)
warning(pos, "'%s'
already
defined
(
ignoring
second
definition
)
" % name, 0)
else:
else:
self.check_previous_typedef_flag(entry, typedef_flag, pos)
self.check_previous_typedef_flag(entry, typedef_flag, pos)
if scope:
if 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:
self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
return entry
return entry
def check_previous_typedef_flag(self, entry, typedef_flag, pos):
def check_previous_typedef_flag(self, entry, typedef_flag, pos):
if typedef_flag != entry.type.typedef_flag:
if typedef_flag != entry.type.typedef_flag:
error(pos, "'%s'
previously
declared
using
'%s'" % (
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