blob: 56c998bd424db9ec382217a572ba0f53a7ac4af3 [file] [log] [blame]
Richard Smithc8adfc82013-05-16 01:23:30 +00001#! /usr/bin/env python
Richard Smith10bb5b92013-05-19 07:22:38 +00002import sys, os, re
Richard Smithc8adfc82013-05-16 01:23:30 +00003
4index = 'cwg_index.html'
Richard Smith10bb5b92013-05-19 07:22:38 +00005output = 'cxx_dr_status.html'
6dr_test_dir = '../test/CXX/drs'
7
Richard Smithc8adfc82013-05-16 01:23:30 +00008if len(sys.argv) == 1:
9 pass
10elif len(sys.argv) == 2:
11 index = sys.argv[1]
12else:
13 print >>sys.stderr, 'Usage: make_drs [<path to cwg_index.html>]'
14 sys.exit(1)
15
16class DR:
17 def __init__(self, section, issue, url, status, title):
18 self.section, self.issue, self.url, self.status, self.title = \
19 section, issue, url, status, title
20 def __repr__(self):
21 return '%s (%s): %s' % (self.issue, self.status, self.title)
22
23def parse(dr):
24 section, issue_link, status, title = [
25 col.split('>', 1)[1].split('</TD>')[0]
26 for col in dr.split('</TR>', 1)[0].split('<TD')[1:]
27 ]
28 _, url, issue = issue_link.split('"', 2)
29 url = url.strip()
30 issue = int(issue.split('>', 1)[1].split('<', 1)[0])
31 title = title.replace('<issue_title>', '').replace('</issue_title>', '').strip()
32 return DR(section, issue, url, status, title)
33
Richard Smith10bb5b92013-05-19 07:22:38 +000034status_re = re.compile(r'\bdr([0-9]+): (.*)')
35status_map = {}
36for test_cpp in os.listdir(dr_test_dir):
37 test_cpp = os.path.join(dr_test_dir, test_cpp)
38 found_any = False;
39 for match in re.finditer(status_re, file(test_cpp, 'r').read()):
40 status_map[int(match.group(1))] = match.group(2)
41 found_any = True
42 if not found_any:
43 print >> sys.stderr, "warning:%s: no '// dr123: foo' comments in this file" % test_cpp
44
Richard Smithc8adfc82013-05-16 01:23:30 +000045drs = sorted((parse(dr) for dr in file(index, 'r').read().split('<TR>')[2:]),
46 key = lambda dr: dr.issue)
Richard Smith10bb5b92013-05-19 07:22:38 +000047out_file = file(output, 'w')
Richard Smithc8adfc82013-05-16 01:23:30 +000048
Richard Smith10bb5b92013-05-19 07:22:38 +000049print >> out_file, '''\
50<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
Richard Smithc8adfc82013-05-16 01:23:30 +000051 "http://www.w3.org/TR/html4/strict.dtd">
52<html>
53<head>
54 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
55 <title>Clang - C++ Defect Report Status</title>
56 <link type="text/css" rel="stylesheet" href="menu.css">
57 <link type="text/css" rel="stylesheet" href="content.css">
58 <style type="text/css">
59 .none { background-color: #FFCCCC }
60 .partial { background-color: #FFE0B0 }
61 .svn { background-color: #FFFF99 }
62 .full { background-color: #CCFF99 }
63 .na { background-color: #DDDDDD }
64 .open * { color: #AAAAAA }
65 //.open { filter: opacity(0.2) }
66 span:target { background-color: #FFFFBB; outline: #DDDD55 solid thin; }
67 th { background-color: #FFDDAA }
68 </style>
69</head>
70<body>
71
72<!--#include virtual="menu.html.incl"-->
73
74<div id="content">
75
76<!--*************************************************************************-->
77<h1>C++ Defect Report Support in Clang</h1>
78<!--*************************************************************************-->
79<p>Last updated: $Date$</p>
80
81<h2 id="cxxdr">C++ defect report implementation status</h2>
82
83<p>This page tracks which C++ defect reports are implemented within Clang.</p>
84
85<table width="689" border="1" cellspacing="0">
86 <tr>
87 <th>Number</th>
88 <th>Status</th>
89 <th>Issue title</th>
90 <th>Available in Clang?</th>
91 </tr>'''
92
93def availability(issue):
94 status = status_map.get(issue, 'unknown')
95 if status == 'unknown':
96 avail = 'Unknown'
97 avail_style = ' class="none"'
98 elif status == '3.4':
99 avail = 'SVN'
100 avail_style = ' class="svn"'
101 elif status in ('3.1', '3.2', '3.3'):
102 avail = 'Clang %s' % status
103 avail_style = ' class="full"'
104 elif status == 'yes':
105 avail = 'Yes'
106 avail_style = ' class="full"'
107 elif status == 'partial':
108 avail = 'Partial'
109 avail_style = ' class="partial"'
110 elif status == 'no':
111 avail = 'No'
112 avail_style = ' class="none"'
113 elif status == 'na':
114 avail = 'N/A'
115 avail_style = ' class="na"'
Richard Smith10bb5b92013-05-19 07:22:38 +0000116 elif status.startswith('sup '):
117 dup = int(status.split(' ', 1)[1])
118 avail = 'Superseded by %s' % dup
119 _, avail_style = availability(dup)
Richard Smithc8adfc82013-05-16 01:23:30 +0000120 elif status.startswith('dup '):
121 dup = int(status.split(' ', 1)[1])
Richard Smith10bb5b92013-05-19 07:22:38 +0000122 avail = 'Duplicate of %s' % dup
Richard Smithc8adfc82013-05-16 01:23:30 +0000123 _, avail_style = availability(dup)
124 else:
125 assert False, 'unknown status %s for issue %s' % (status, dr.issue)
126 return (avail, avail_style)
127
128for dr in drs:
129 if dr.status in ('concepts',):
130 # Yeah, cool story bro.
131 continue
132 if dr.status in ('open', 'concurrency', 'drafting', 'review', 'extension'):
133 # We may have to deal with these some day, but not yet.
134 row_style = ' class="open"'
135 avail = 'Not resolved'
136 avail_style = ''
137 assert dr.issue not in status_map, "have status for not-ready dr %s" % dr.issue
138 else:
139 row_style = ''
140 avail, avail_style = availability(dr.issue)
141
Richard Smith10bb5b92013-05-19 07:22:38 +0000142 print >> out_file, '''\
143 <tr%s>
Richard Smithc8adfc82013-05-16 01:23:30 +0000144 <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/%s">%s</a></td>
145 <td>%s</td>
146 <td>%s</td>
147 <td%s align="center">%s</td>
148 </tr>''' % (row_style, dr.url, dr.issue, dr.status, dr.title, avail_style,
149 avail)
150
Richard Smith10bb5b92013-05-19 07:22:38 +0000151print >> out_file, '''\
152</table>
Richard Smithc8adfc82013-05-16 01:23:30 +0000153
154</div>
155</body>
156</html>'''