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
6e308d10
Commit
6e308d10
authored
Jan 15, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor annotation additions
parent
3716a375
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
Cython/Compiler/Annotate.py
Cython/Compiler/Annotate.py
+9
-3
No files found.
Cython/Compiler/Annotate.py
View file @
6e308d10
# Note: Work in progress
import
os
import
re
import
time
from
StringIO
import
StringIO
import
Version
from
Code
import
CCodeWriter
# need one-characters subsitutions (for now) so offsets aren't off
...
...
@@ -112,12 +113,15 @@ function toggleDiv(id) {
</head>
"""
)
f
.
write
(
'<body>
\
n
'
)
f
.
write
(
'<p>Generated by Cython %s on %s
\
n
'
%
(
Version
.
version
,
time
.
asctime
()))
c_file
=
os
.
path
.
basename
(
filename
)[:
-
3
]
+
'c'
f
.
write
(
'<p>Raw output: <a href="%s">%s</a>
\
n
'
%
(
c_file
,
c_file
))
k
=
0
py_c_api
=
re
.
compile
(
'(Py[A-Z][a-z]+_[A-Z][a-z][A-Za-z_]+)'
)
pyx_api
=
re
.
compile
(
'(__Pyx[A-Za-z_]+)
\
(
'
)
py_marco_api = re.compile('
(
Py
[
A
-
Za
-
z
]
*
_
[
A
-
Z
][
A
-
Z_
]
+
)
')
error_goto = re.compile(r'
(
if
.
*
?
\
{
__pyx_filename
=
.
*
goto
__pyx_L
\
w
+
;
\
})
')
error_goto = re.compile(r'
(
(;
*
if
.
*
)
?
\
{
__pyx_filename
=
.
*
goto
__pyx_L
\
w
+
;
\
})
')
for line in lines:
...
...
@@ -132,6 +136,8 @@ function toggleDiv(id) {
code, macro_api_calls = py_marco_api.subn(r"<span class='
py_macro_api
'>
\
1
</span>", code)
code, error_goto_calls = error_goto.subn(r"<span class='
error_goto
'>
\
1
</span>", code)
code = code.replace("<span class='
error_goto
'>;", ";<span class='
error_goto
'>")
color = "FFFF%02x" % int(255/(1+(5*c_api_calls+2*pyx_api_calls+macro_api_calls)/10.0))
f.write("<pre class='
line
' style='
background
-
color
:
#%s' onclick='toggleDiv(\"line%s\")'>" % (color, k))
...
...
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