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
3bbefcb4
Commit
3bbefcb4
authored
Feb 14, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: Removed chained CodeWriter calls
parent
a7b92caa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
+19
-30
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+19
-30
No files found.
Cython/Compiler/Code.py
View file @
3bbefcb4
...
@@ -189,13 +189,12 @@ class GlobalState(object):
...
@@ -189,13 +189,12 @@ class GlobalState(object):
self
.
init_cached_builtins_writer
.
putln
(
"static int __Pyx_InitCachedBuiltins(void) {"
)
self
.
init_cached_builtins_writer
.
putln
(
"static int __Pyx_InitCachedBuiltins(void) {"
)
self
.
initwriter
.
enter_cfunc_scope
()
self
.
initwriter
.
enter_cfunc_scope
()
self
.
initwriter
.
putln
(
""
).
putln
(
"static int __Pyx_InitGlobals(void) {"
)
self
.
initwriter
.
putln
(
""
)
self
.
initwriter
.
putln
(
"static int __Pyx_InitGlobals(void) {"
)
(
self
.
pystring_table
self
.
pystring_table
.
putln
(
""
)
.
putln
(
""
)
self
.
pystring_table
.
putln
(
"static __Pyx_StringTabEntry %s[] = {"
%
.
putln
(
"static __Pyx_StringTabEntry %s[] = {"
%
Naming
.
stringtab_cname
)
Naming
.
stringtab_cname
)
)
#
#
# Global constants, interned objects, etc.
# Global constants, interned objects, etc.
...
@@ -207,7 +206,8 @@ class GlobalState(object):
...
@@ -207,7 +206,8 @@ class GlobalState(object):
# This is called when it is known that no more global declarations will
# This is called when it is known that no more global declarations will
# declared (but can be called before or after insert_XXX).
# declared (but can be called before or after insert_XXX).
if
self
.
pystring_table_needed
:
if
self
.
pystring_table_needed
:
self
.
pystring_table
.
putln
(
"{0, 0, 0, 0, 0, 0}"
).
putln
(
"};"
)
self
.
pystring_table
.
putln
(
"{0, 0, 0, 0, 0, 0}"
)
self
.
pystring_table
.
putln
(
"};"
)
import
Nodes
import
Nodes
self
.
use_utility_code
(
Nodes
.
init_string_tab_utility_code
)
self
.
use_utility_code
(
Nodes
.
init_string_tab_utility_code
)
self
.
initwriter
.
putln
(
self
.
initwriter
.
putln
(
...
@@ -216,21 +216,19 @@ class GlobalState(object):
...
@@ -216,21 +216,19 @@ class GlobalState(object):
self
.
initwriter
.
error_goto
(
self
.
module_pos
)))
self
.
initwriter
.
error_goto
(
self
.
module_pos
)))
if
Options
.
cache_builtins
:
if
Options
.
cache_builtins
:
(
self
.
init_cached_builtins_writer
w
=
self
.
init_cached_builtins_writer
.
putln
(
"return 0;"
)
w
.
putln
(
"return 0;"
)
.
put_label
(
self
.
init_cached_builtins_writer
.
error_label
)
w
.
put_label
(
w
.
error_label
)
.
putln
(
"return -1;"
)
w
.
putln
(
"return -1;"
)
.
putln
(
"}"
)
w
.
putln
(
"}"
)
.
exit_cfunc_scope
()
w
.
exit_cfunc_scope
()
)
w
=
self
.
initwriter
(
self
.
initwriter
w
.
putln
(
"return 0;"
)
.
putln
(
"return 0;"
)
w
.
put_label
(
w
.
error_label
)
.
put_label
(
self
.
initwriter
.
error_label
)
w
.
putln
(
"return -1;"
)
.
putln
(
"return -1;"
)
w
.
putln
(
"}"
)
.
putln
(
"}"
)
w
.
exit_cfunc_scope
()
.
exit_cfunc_scope
()
)
def
insert_initcode_into
(
self
,
code
):
def
insert_initcode_into
(
self
,
code
):
if
self
.
pystring_table_needed
:
if
self
.
pystring_table_needed
:
...
@@ -525,7 +523,6 @@ class CCodeWriter(object):
...
@@ -525,7 +523,6 @@ class CCodeWriter(object):
self
.
put
(
code
)
self
.
put
(
code
)
self
.
write
(
"
\
n
"
);
self
.
write
(
"
\
n
"
);
self
.
bol
=
1
self
.
bol
=
1
return
self
def
emit_marker
(
self
):
def
emit_marker
(
self
):
self
.
write
(
"
\
n
"
);
self
.
write
(
"
\
n
"
);
...
@@ -533,7 +530,6 @@ class CCodeWriter(object):
...
@@ -533,7 +530,6 @@ class CCodeWriter(object):
self
.
write
(
"/* %s */
\
n
"
%
self
.
marker
[
1
])
self
.
write
(
"/* %s */
\
n
"
%
self
.
marker
[
1
])
self
.
last_marker_line
=
self
.
marker
[
0
]
self
.
last_marker_line
=
self
.
marker
[
0
]
self
.
marker
=
None
self
.
marker
=
None
return
self
def
put_safe
(
self
,
code
):
def
put_safe
(
self
,
code
):
# put code, but ignore {}
# put code, but ignore {}
...
@@ -556,25 +552,20 @@ class CCodeWriter(object):
...
@@ -556,25 +552,20 @@ class CCodeWriter(object):
self
.
level
+=
dl
self
.
level
+=
dl
elif
fix_indent
:
elif
fix_indent
:
self
.
level
+=
1
self
.
level
+=
1
return
self
def
increase_indent
(
self
):
def
increase_indent
(
self
):
self
.
level
=
self
.
level
+
1
self
.
level
=
self
.
level
+
1
return
self
def
decrease_indent
(
self
):
def
decrease_indent
(
self
):
self
.
level
=
self
.
level
-
1
self
.
level
=
self
.
level
-
1
return
self
def
begin_block
(
self
):
def
begin_block
(
self
):
self
.
putln
(
"{"
)
self
.
putln
(
"{"
)
self
.
increase_indent
()
self
.
increase_indent
()
return
self
def
end_block
(
self
):
def
end_block
(
self
):
self
.
decrease_indent
()
self
.
decrease_indent
()
self
.
putln
(
"}"
)
self
.
putln
(
"}"
)
return
self
def
indent
(
self
):
def
indent
(
self
):
self
.
write
(
" "
*
self
.
level
)
self
.
write
(
" "
*
self
.
level
)
...
@@ -603,12 +594,10 @@ class CCodeWriter(object):
...
@@ -603,12 +594,10 @@ class CCodeWriter(object):
def
put_label
(
self
,
lbl
):
def
put_label
(
self
,
lbl
):
if
lbl
in
self
.
funcstate
.
labels_used
:
if
lbl
in
self
.
funcstate
.
labels_used
:
self
.
putln
(
"%s:;"
%
lbl
)
self
.
putln
(
"%s:;"
%
lbl
)
return
self
def
put_goto
(
self
,
lbl
):
def
put_goto
(
self
,
lbl
):
self
.
funcstate
.
use_label
(
lbl
)
self
.
funcstate
.
use_label
(
lbl
)
self
.
putln
(
"goto %s;"
%
lbl
)
self
.
putln
(
"goto %s;"
%
lbl
)
return
self
def
put_var_declarations
(
self
,
entries
,
static
=
0
,
dll_linkage
=
None
,
def
put_var_declarations
(
self
,
entries
,
static
=
0
,
dll_linkage
=
None
,
definition
=
True
):
definition
=
True
):
...
...
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