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
Kirill Smelkov
cython
Commits
04a00eaf
Commit
04a00eaf
authored
Jan 05, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
42881e62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
23 deletions
+28
-23
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+19
-15
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-1
t/sum.c
t/sum.c
+7
-7
No files found.
Cython/Compiler/Nodes.py
View file @
04a00eaf
...
@@ -2479,28 +2479,32 @@ class CFuncDefNode(FuncDefNode):
...
@@ -2479,28 +2479,32 @@ class CFuncDefNode(FuncDefNode):
arg_decls
.
append
(
type
.
op_arg_struct
.
declaration_code
(
Naming
.
optional_args_cname
))
arg_decls
.
append
(
type
.
op_arg_struct
.
declaration_code
(
Naming
.
optional_args_cname
))
if
type
.
has_varargs
:
if
type
.
has_varargs
:
arg_decls
.
append
(
"..."
)
arg_decls
.
append
(
"..."
)
if
not
arg_decls
:
#
if not arg_decls:
arg_decls
=
[
"void"
]
#
arg_decls = ["void"]
if
cname
is
None
:
if
cname
is
None
:
cname
=
self
.
entry
.
func_cname
cname
=
self
.
entry
.
func_cname
entity
=
type
.
function_header_code
(
cname
,
', '
.
join
(
arg_decls
))
entity
=
type
.
function_header_code
(
cname
,
', '
.
join
(
arg_decls
))
if
self
.
entry
.
visibility
==
'private'
and
'::'
not
in
cname
:
storage_class
=
"static "
# TODO(go) exported/non-exported
else
:
#if self.entry.visibility == 'private' and '::' not in cname:
storage_class
=
""
# storage_class = "static "
#else:
# storage_class = ""
storage_class
=
""
dll_linkage
=
None
dll_linkage
=
None
modifiers
=
code
.
build_function_modifiers
(
self
.
entry
.
func_modifiers
)
modifiers
=
code
.
build_function_modifiers
(
self
.
entry
.
func_modifiers
)
header
=
self
.
return_type
.
declaration_code
(
entity
,
dll_linkage
=
dll_linkage
)
header
=
self
.
return_type
.
declaration_code
(
entity
,
dll_linkage
=
dll_linkage
)
#print (storage_class, modifiers, header)
#print (storage_class, modifiers, header)
needs_proto
=
self
.
is_c_class_method
needs_proto
=
self
.
is_c_class_method
if
self
.
template_declaration
:
#
if self.template_declaration:
if
needs_proto
:
#
if needs_proto:
code
.
globalstate
.
parts
[
'module_declarations'
].
putln
(
self
.
template_declaration
)
#
code.globalstate.parts['module_declarations'].putln(self.template_declaration)
code
.
putln
(
self
.
template_declaration
)
#
code.putln(self.template_declaration)
if
needs_proto
:
#
if needs_proto:
code
.
globalstate
.
parts
[
'module_declarations'
].
putln
(
#
code.globalstate.parts['module_declarations'].putln(
"%s%s%s; /* proto*/"
%
(
storage_class
,
modifiers
,
header
))
#
"%s%s%s; /* proto*/" % (storage_class, modifiers, header))
code
.
putln
(
"%s%s%s {"
%
(
storage_class
,
modifiers
,
header
))
code
.
putln
(
"%s%s%s {"
%
(
storage_class
,
modifiers
,
header
))
def
generate_argument_declarations
(
self
,
env
,
code
):
def
generate_argument_declarations
(
self
,
env
,
code
):
...
@@ -6011,12 +6015,12 @@ class WhileStatNode(LoopNode, StatNode):
...
@@ -6011,12 +6015,12 @@ class WhileStatNode(LoopNode, StatNode):
code
.
mark_pos
(
self
.
pos
)
code
.
mark_pos
(
self
.
pos
)
old_loop_labels
=
code
.
new_loop_labels
()
old_loop_labels
=
code
.
new_loop_labels
()
code
.
putln
(
code
.
putln
(
"
while (1)
{"
)
"
for
{"
)
if
self
.
condition
:
if
self
.
condition
:
self
.
condition
.
generate_evaluation_code
(
code
)
self
.
condition
.
generate_evaluation_code
(
code
)
self
.
condition
.
generate_disposal_code
(
code
)
self
.
condition
.
generate_disposal_code
(
code
)
code
.
putln
(
code
.
putln
(
"if
(!%s) break;
"
%
self
.
condition
.
result
())
"if
!%s { break }
"
%
self
.
condition
.
result
())
self
.
condition
.
free_temps
(
code
)
self
.
condition
.
free_temps
(
code
)
self
.
body
.
generate_execution_code
(
code
)
self
.
body
.
generate_execution_code
(
code
)
code
.
put_label
(
code
.
continue_label
)
code
.
put_label
(
code
.
continue_label
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
04a00eaf
...
@@ -60,7 +60,8 @@ class BaseType(object):
...
@@ -60,7 +60,8 @@ class BaseType(object):
def
base_declaration_code
(
self
,
base_code
,
entity_code
):
def
base_declaration_code
(
self
,
base_code
,
entity_code
):
if
entity_code
:
if
entity_code
:
return
"%s %s"
%
(
base_code
,
entity_code
)
#return "%s %s" % (base_code, entity_code)
return
"%s %s"
%
(
entity_code
,
base_code
)
else
:
else
:
return
base_code
return
base_code
...
...
t/sum.c
View file @
04a00eaf
...
@@ -755,12 +755,12 @@ static PyObject *__pyx_n_s_test;
...
@@ -755,12 +755,12 @@ static PyObject *__pyx_n_s_test;
*/
*/
/* -> CFuncDefNode.generate_function_header (1, 5) */
/* -> CFuncDefNode.generate_function_header (1, 5) */
static
int
__pyx_f_3sum_sumupto
(
int
__pyx_v_n
)
{
__pyx_f_3sum_sumupto
(
__pyx_v_n
int
)
int
{
/* <- CFuncDefNode.generate_function_header (1, 5) */
/* <- CFuncDefNode.generate_function_header (1, 5) */
int
__pyx_v_res
;
__pyx_v_res
int
;
int
__pyx_r
;
__pyx_r
int
;
__Pyx_RefNannyDeclarations
__Pyx_RefNannyDeclarations
int
__pyx_t_1
;
__pyx_t_1
int
;
__Pyx_RefNannySetupContext
(
"sumupto"
,
0
);
__Pyx_RefNannySetupContext
(
"sumupto"
,
0
);
/* -> StatListNode.generate_execution_code (2, 4) */
/* -> StatListNode.generate_execution_code (2, 4) */
...
@@ -784,13 +784,13 @@ static int __pyx_f_3sum_sumupto(int __pyx_v_n) {
...
@@ -784,13 +784,13 @@ static int __pyx_f_3sum_sumupto(int __pyx_v_n) {
* n -= 1
* n -= 1
*/
*/
/* -> WhileStatNode.generate_execution_code (4, 4) */
/* -> WhileStatNode.generate_execution_code (4, 4) */
while
(
1
)
{
for
{
/* -> CoerceToTempNode.generate_evaluation_code (4, 12) */
/* -> CoerceToTempNode.generate_evaluation_code (4, 12) */
/* -> CoerceToTempNode.generate_result_code (4, 12) */
/* -> CoerceToTempNode.generate_result_code (4, 12) */
__pyx_t_1
=
((
__pyx_v_n
>
0
)
!=
0
);
__pyx_t_1
=
((
__pyx_v_n
>
0
)
!=
0
);
/* <- CoerceToTempNode.generate_result_code (4, 12) */
/* <- CoerceToTempNode.generate_result_code (4, 12) */
/* <- CoerceToTempNode.generate_evaluation_code (4, 12) */
/* <- CoerceToTempNode.generate_evaluation_code (4, 12) */
if
(
!
__pyx_t_1
)
break
;
if
!
__pyx_t_1
{
break
}
/* -> StatListNode.generate_execution_code (5, 8) */
/* -> StatListNode.generate_execution_code (5, 8) */
/* "sum.pyx":5
/* "sum.pyx":5
...
@@ -898,7 +898,7 @@ PyMODINIT_FUNC PyInit_sum(void); /*proto*/
...
@@ -898,7 +898,7 @@ PyMODINIT_FUNC PyInit_sum(void); /*proto*/
PyMODINIT_FUNC
PyInit_sum
(
void
)
PyMODINIT_FUNC
PyInit_sum
(
void
)
#endif
#endif
{
{
PyObject
*
__pyx_t_1
=
NULL
;
*
__pyx_t_1
PyObject
=
NULL
;
__Pyx_RefNannyDeclarations
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
#if CYTHON_REFNANNY
__Pyx_RefNanny
=
__Pyx_RefNannyImportAPI
(
"refnanny"
);
__Pyx_RefNanny
=
__Pyx_RefNannyImportAPI
(
"refnanny"
);
...
...
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