1f4a2713aSLionel Sambuc#! /usr/bin/env python 2f4a2713aSLionel Sambucimport sys, os, re 3f4a2713aSLionel Sambuc 4f4a2713aSLionel Sambucindex = 'cwg_index.html' 5f4a2713aSLionel Sambucoutput = 'cxx_dr_status.html' 6f4a2713aSLionel Sambucdr_test_dir = '../test/CXX/drs' 7f4a2713aSLionel Sambuc 8f4a2713aSLionel Sambucif len(sys.argv) == 1: 9f4a2713aSLionel Sambuc pass 10f4a2713aSLionel Sambucelif len(sys.argv) == 2: 11f4a2713aSLionel Sambuc index = sys.argv[1] 12f4a2713aSLionel Sambucelse: 13f4a2713aSLionel Sambuc print >>sys.stderr, 'Usage: make_drs [<path to cwg_index.html>]' 14f4a2713aSLionel Sambuc sys.exit(1) 15f4a2713aSLionel Sambuc 16f4a2713aSLionel Sambucclass DR: 17f4a2713aSLionel Sambuc def __init__(self, section, issue, url, status, title): 18f4a2713aSLionel Sambuc self.section, self.issue, self.url, self.status, self.title = \ 19f4a2713aSLionel Sambuc section, issue, url, status, title 20f4a2713aSLionel Sambuc def __repr__(self): 21f4a2713aSLionel Sambuc return '%s (%s): %s' % (self.issue, self.status, self.title) 22f4a2713aSLionel Sambuc 23f4a2713aSLionel Sambucdef parse(dr): 24f4a2713aSLionel Sambuc section, issue_link, status, title = [ 25f4a2713aSLionel Sambuc col.split('>', 1)[1].split('</TD>')[0] 26f4a2713aSLionel Sambuc for col in dr.split('</TR>', 1)[0].split('<TD')[1:] 27f4a2713aSLionel Sambuc ] 28f4a2713aSLionel Sambuc _, url, issue = issue_link.split('"', 2) 29f4a2713aSLionel Sambuc url = url.strip() 30f4a2713aSLionel Sambuc issue = int(issue.split('>', 1)[1].split('<', 1)[0]) 31f4a2713aSLionel Sambuc title = title.replace('<issue_title>', '').replace('</issue_title>', '').strip() 32f4a2713aSLionel Sambuc return DR(section, issue, url, status, title) 33f4a2713aSLionel Sambuc 34f4a2713aSLionel Sambucstatus_re = re.compile(r'\bdr([0-9]+): (.*)') 35f4a2713aSLionel Sambucstatus_map = {} 36f4a2713aSLionel Sambucfor test_cpp in os.listdir(dr_test_dir): 37f4a2713aSLionel Sambuc if not test_cpp.endswith('.cpp'): 38f4a2713aSLionel Sambuc continue 39f4a2713aSLionel Sambuc test_cpp = os.path.join(dr_test_dir, test_cpp) 40f4a2713aSLionel Sambuc found_any = False; 41f4a2713aSLionel Sambuc for match in re.finditer(status_re, file(test_cpp, 'r').read()): 42f4a2713aSLionel Sambuc status_map[int(match.group(1))] = match.group(2) 43f4a2713aSLionel Sambuc found_any = True 44f4a2713aSLionel Sambuc if not found_any: 45f4a2713aSLionel Sambuc print >> sys.stderr, "warning:%s: no '// dr123: foo' comments in this file" % test_cpp 46f4a2713aSLionel Sambuc 47f4a2713aSLionel Sambucdrs = sorted((parse(dr) for dr in file(index, 'r').read().split('<TR>')[2:]), 48f4a2713aSLionel Sambuc key = lambda dr: dr.issue) 49f4a2713aSLionel Sambucout_file = file(output, 'w') 50f4a2713aSLionel Sambuc 51f4a2713aSLionel Sambucprint >> out_file, '''\ 52f4a2713aSLionel Sambuc<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 53f4a2713aSLionel Sambuc "http://www.w3.org/TR/html4/strict.dtd"> 54*0a6a1f1dSLionel Sambuc<!-- This file is auto-generated by make_cxx_dr_status. Do not modify. --> 55f4a2713aSLionel Sambuc<html> 56f4a2713aSLionel Sambuc<head> 57f4a2713aSLionel Sambuc <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 58f4a2713aSLionel Sambuc <title>Clang - C++ Defect Report Status</title> 59f4a2713aSLionel Sambuc <link type="text/css" rel="stylesheet" href="menu.css"> 60f4a2713aSLionel Sambuc <link type="text/css" rel="stylesheet" href="content.css"> 61f4a2713aSLionel Sambuc <style type="text/css"> 62f4a2713aSLionel Sambuc .none { background-color: #FFCCCC } 63f4a2713aSLionel Sambuc .partial { background-color: #FFE0B0 } 64f4a2713aSLionel Sambuc .svn { background-color: #FFFF99 } 65f4a2713aSLionel Sambuc .full { background-color: #CCFF99 } 66f4a2713aSLionel Sambuc .na { background-color: #DDDDDD } 67f4a2713aSLionel Sambuc .open * { color: #AAAAAA } 68f4a2713aSLionel Sambuc //.open { filter: opacity(0.2) } 69*0a6a1f1dSLionel Sambuc tr:target { background-color: #FFFFBB } 70f4a2713aSLionel Sambuc th { background-color: #FFDDAA } 71f4a2713aSLionel Sambuc </style> 72f4a2713aSLionel Sambuc</head> 73f4a2713aSLionel Sambuc<body> 74f4a2713aSLionel Sambuc 75f4a2713aSLionel Sambuc<!--#include virtual="menu.html.incl"--> 76f4a2713aSLionel Sambuc 77f4a2713aSLionel Sambuc<div id="content"> 78f4a2713aSLionel Sambuc 79f4a2713aSLionel Sambuc<!--*************************************************************************--> 80f4a2713aSLionel Sambuc<h1>C++ Defect Report Support in Clang</h1> 81f4a2713aSLionel Sambuc<!--*************************************************************************--> 82*0a6a1f1dSLionel Sambuc<p>Last updated: $Date: 2015/01/29 19:57:42 $</p> 83f4a2713aSLionel Sambuc 84f4a2713aSLionel Sambuc<h2 id="cxxdr">C++ defect report implementation status</h2> 85f4a2713aSLionel Sambuc 86f4a2713aSLionel Sambuc<p>This page tracks which C++ defect reports are implemented within Clang.</p> 87f4a2713aSLionel Sambuc 88f4a2713aSLionel Sambuc<table width="689" border="1" cellspacing="0"> 89f4a2713aSLionel Sambuc <tr> 90f4a2713aSLionel Sambuc <th>Number</th> 91f4a2713aSLionel Sambuc <th>Status</th> 92f4a2713aSLionel Sambuc <th>Issue title</th> 93f4a2713aSLionel Sambuc <th>Available in Clang?</th> 94f4a2713aSLionel Sambuc </tr>''' 95f4a2713aSLionel Sambuc 96f4a2713aSLionel Sambucdef availability(issue): 97f4a2713aSLionel Sambuc status = status_map.get(issue, 'unknown') 98f4a2713aSLionel Sambuc avail_suffix = '' 99f4a2713aSLionel Sambuc if status.endswith(' c++11'): 100f4a2713aSLionel Sambuc status = status[:-6] 101f4a2713aSLionel Sambuc avail_suffix = ' (C++11 onwards)' 102f4a2713aSLionel Sambuc if status == 'unknown': 103f4a2713aSLionel Sambuc avail = 'Unknown' 104f4a2713aSLionel Sambuc avail_style = ' class="none"' 105*0a6a1f1dSLionel Sambuc elif status == '3.7': 106f4a2713aSLionel Sambuc avail = 'SVN' 107f4a2713aSLionel Sambuc avail_style = ' class="svn"' 108*0a6a1f1dSLionel Sambuc elif status in ('3.1', '3.2', '3.3', '3.4', '3.5', '3.6'): 109f4a2713aSLionel Sambuc avail = 'Clang %s' % status 110f4a2713aSLionel Sambuc avail_style = ' class="full"' 111f4a2713aSLionel Sambuc elif status == 'yes': 112f4a2713aSLionel Sambuc avail = 'Yes' 113f4a2713aSLionel Sambuc avail_style = ' class="full"' 114f4a2713aSLionel Sambuc elif status == 'partial': 115f4a2713aSLionel Sambuc avail = 'Partial' 116f4a2713aSLionel Sambuc avail_style = ' class="partial"' 117f4a2713aSLionel Sambuc elif status == 'no': 118f4a2713aSLionel Sambuc avail = 'No' 119f4a2713aSLionel Sambuc avail_style = ' class="none"' 120f4a2713aSLionel Sambuc elif status == 'na': 121f4a2713aSLionel Sambuc avail = 'N/A' 122f4a2713aSLionel Sambuc avail_style = ' class="na"' 123f4a2713aSLionel Sambuc elif status.startswith('sup '): 124f4a2713aSLionel Sambuc dup = status.split(' ', 1)[1] 125*0a6a1f1dSLionel Sambuc avail = 'Superseded by <a href="#%s">%s</a>' % (dup, dup) 126f4a2713aSLionel Sambuc try: 127f4a2713aSLionel Sambuc _, avail_style = availability(int(dup)) 128f4a2713aSLionel Sambuc except: 129f4a2713aSLionel Sambuc print >>sys.stderr, "issue %s marked as sup %s" % (issue, dup) 130f4a2713aSLionel Sambuc avail_style = ' class="none"' 131f4a2713aSLionel Sambuc elif status.startswith('dup '): 132f4a2713aSLionel Sambuc dup = int(status.split(' ', 1)[1]) 133*0a6a1f1dSLionel Sambuc avail = 'Duplicate of <a href="#%s">%s</a>' % (dup, dup) 134f4a2713aSLionel Sambuc _, avail_style = availability(dup) 135f4a2713aSLionel Sambuc else: 136f4a2713aSLionel Sambuc assert False, 'unknown status %s for issue %s' % (status, dr.issue) 137f4a2713aSLionel Sambuc return (avail + avail_suffix, avail_style) 138f4a2713aSLionel Sambuc 139f4a2713aSLionel Sambuccount = {} 140f4a2713aSLionel Sambucfor dr in drs: 141f4a2713aSLionel Sambuc if dr.status in ('concepts',): 142f4a2713aSLionel Sambuc # Yeah, cool story bro. 143f4a2713aSLionel Sambuc continue 144f4a2713aSLionel Sambuc if dr.status in ('open', 'concurrency', 'drafting', 'review', 'extension'): 145f4a2713aSLionel Sambuc # We may have to deal with these some day, but not yet. 146f4a2713aSLionel Sambuc row_style = ' class="open"' 147f4a2713aSLionel Sambuc avail = 'Not resolved' 148f4a2713aSLionel Sambuc avail_style = '' 149f4a2713aSLionel Sambuc assert dr.issue not in status_map, "have status for not-ready dr %s" % dr.issue 150f4a2713aSLionel Sambuc else: 151f4a2713aSLionel Sambuc row_style = '' 152f4a2713aSLionel Sambuc avail, avail_style = availability(dr.issue) 153f4a2713aSLionel Sambuc if not avail.startswith('Sup') and not avail.startswith('Dup'): 154f4a2713aSLionel Sambuc count[avail] = count.get(avail, 0) + 1 155f4a2713aSLionel Sambuc 156f4a2713aSLionel Sambuc print >> out_file, '''\ 157*0a6a1f1dSLionel Sambuc <tr%s id="%s"> 158f4a2713aSLionel Sambuc <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/%s">%s</a></td> 159f4a2713aSLionel Sambuc <td>%s</td> 160f4a2713aSLionel Sambuc <td>%s</td> 161f4a2713aSLionel Sambuc <td%s align="center">%s</td> 162*0a6a1f1dSLionel Sambuc </tr>''' % (row_style, dr.issue, dr.url, dr.issue, dr.status, dr.title, avail_style, avail) 163f4a2713aSLionel Sambuc 164f4a2713aSLionel Sambucfor status, num in count.items(): 165f4a2713aSLionel Sambuc print "%s: %s" % (status, num) 166f4a2713aSLionel Sambuc 167f4a2713aSLionel Sambucprint >> out_file, '''\ 168f4a2713aSLionel Sambuc</table> 169f4a2713aSLionel Sambuc 170f4a2713aSLionel Sambuc</div> 171f4a2713aSLionel Sambuc</body> 172f4a2713aSLionel Sambuc</html>''' 173