From: Robert Bradshaw Date: Thu, 22 Oct 2009 20:20:11 +0000 (-0700) Subject: Annotation work. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a1e88e9cc436935892ad4bc0401b0982eadb2bfc;p=cython.git Annotation work. --- diff --git a/Cython/Compiler/Annotate.py b/Cython/Compiler/Annotate.py index dc330711..d252fda6 100644 --- a/Cython/Compiler/Annotate.py +++ b/Cython/Compiler/Annotate.py @@ -93,10 +93,13 @@ class AnnotationCCodeWriter(CCodeWriter): body { font-family: courier; font-size: 12; } .code { font-size: 9; color: #444444; display: none; margin-left: 20px; } -.py_api { color: red; } -.pyx_api { color: #FF3000; } -.py_macro_api { color: #FF8000; } -.error_goto { color: #FF8000; } +.py_c_api { color: red; } +.py_macro_api { color: #FF7000; } +.pyx_c_api { color: #FF3000; } +.pyx_macro_api { color: #FF7000; } +.refnanny { color: #FFA000; } + +.error_goto { color: #FFA000; } .tag { } @@ -126,10 +129,12 @@ function toggleDiv(id) { f.write(u'

Raw output: %s\n' % (c_file, c_file)) k = 0 - py_c_api = re.compile(u'(Py[A-Z][a-z]+_[A-Z][a-z][A-Za-z_]+)') - pyx_api = re.compile(u'(__Pyx[A-Za-z_]+)\(') - py_marco_api = re.compile(u'(Py[A-Za-z]*_[A-Z][A-Z_]+)') + py_c_api = re.compile(u'(Py[A-Z][a-z]+_[A-Z][a-z][A-Za-z_]+)\(') + py_marco_api = re.compile(u'(Py[A-Z][a-z]+_[A-Z][A-Z_]+)\(') + pyx_c_api = re.compile(u'(__Pyx_[A-Z][a-z_][A-Za-z_]+)\(') + pyx_macro_api = re.compile(u'(__Pyx_[A-Z][A-Z_]+)\(') error_goto = re.compile(ur'((; *if .*)? \{__pyx_filename = .*goto __pyx_L\w+;\})') + refnanny = re.compile(u'(__Pyx_X?(GOT|GIVE)REF|__Pyx_RefNanny[A-Za-z]+)') for line in lines: @@ -139,14 +144,17 @@ function toggleDiv(id) { except KeyError: code = '' - code, c_api_calls = py_c_api.subn(ur"\1", code) - code, pyx_api_calls = pyx_api.subn(ur"\1(", code) - code, macro_api_calls = py_marco_api.subn(ur"\1", code) + code, py_c_api_calls = py_c_api.subn(ur"\1(", code) + code, pyx_c_api_calls = pyx_c_api.subn(ur"\1(", code) + code, py_macro_api_calls = py_marco_api.subn(ur"\1(", code) + code, pyx_macro_api_calls = pyx_macro_api.subn(ur"\1(", code) + code, refnanny_calls = refnanny.subn(ur"\1", code) code, error_goto_calls = error_goto.subn(ur"\1", code) code = code.replace(u";", u";") - color = u"FFFF%02x" % int(255/(1+(5*c_api_calls+2*pyx_api_calls+macro_api_calls)/10.0)) + score = 5*py_c_api_calls + 2*pyx_c_api_calls + py_macro_api_calls + pyx_macro_api_calls - refnanny_calls + color = u"FFFF%02x" % int(255/(1+score/10.0)) f.write(u"

" % (color, k))
 
             f.write(u" %d: " % k)