#! /usr/bin/env python import sys, os, re index = 'cwg_index.html' output = 'cxx_dr_status.html' dr_test_dir = '../test/CXX/drs' if len(sys.argv) == 1: pass elif len(sys.argv) == 2: index = sys.argv[1] else: print >>sys.stderr, 'Usage: make_drs []' sys.exit(1) class DR: def __init__(self, section, issue, url, status, title): self.section, self.issue, self.url, self.status, self.title = \ section, issue, url, status, title def __repr__(self): return '%s (%s): %s' % (self.issue, self.status, self.title) def parse(dr): section, issue_link, status, title = [ col.split('>', 1)[1].split('')[0] for col in dr.split('', 1)[0].split('', 1)[1].split('<', 1)[0]) title = title.replace('', '').replace('', '').strip() return DR(section, issue, url, status, title) status_re = re.compile(r'\bdr([0-9]+): (.*)') status_map = {} for test_cpp in os.listdir(dr_test_dir): if not test_cpp.endswith('.cpp'): continue test_cpp = os.path.join(dr_test_dir, test_cpp) found_any = False; for match in re.finditer(status_re, file(test_cpp, 'r').read()): status_map[int(match.group(1))] = match.group(2) found_any = True if not found_any: print >> sys.stderr, "warning:%s: no '// dr123: foo' comments in this file" % test_cpp drs = sorted((parse(dr) for dr in file(index, 'r').read().split('')[2:]), key = lambda dr: dr.issue) out_file = file(output, 'w') print >> out_file, '''\ Clang - C++ Defect Report Status

C++ Defect Report Support in Clang

Last updated: $Date$

C++ defect report implementation status

This page tracks which C++ defect reports are implemented within Clang.

''' def availability(issue): status = status_map.get(issue, 'unknown') avail_suffix = '' if status.endswith(' c++11'): status = status[:-6] avail_suffix = ' (C++11 onwards)' if status == 'unknown': avail = 'Unknown' avail_style = ' class="none"' elif status == '3.7': avail = 'SVN' avail_style = ' class="svn"' elif status in ('3.1', '3.2', '3.3', '3.4', '3.5', '3.6'): avail = 'Clang %s' % status avail_style = ' class="full"' elif status == 'yes': avail = 'Yes' avail_style = ' class="full"' elif status == 'partial': avail = 'Partial' avail_style = ' class="partial"' elif status == 'no': avail = 'No' avail_style = ' class="none"' elif status == 'na': avail = 'N/A' avail_style = ' class="na"' elif status.startswith('sup '): dup = status.split(' ', 1)[1] avail = 'Superseded by %s' % (dup, dup) try: _, avail_style = availability(int(dup)) except: print >>sys.stderr, "issue %s marked as sup %s" % (issue, dup) avail_style = ' class="none"' elif status.startswith('dup '): dup = int(status.split(' ', 1)[1]) avail = 'Duplicate of %s' % (dup, dup) _, avail_style = availability(dup) else: assert False, 'unknown status %s for issue %s' % (status, dr.issue) return (avail + avail_suffix, avail_style) count = {} for dr in drs: if dr.status in ('concepts',): # Yeah, cool story bro. continue if dr.status in ('open', 'concurrency', 'drafting', 'review', 'extension'): # We may have to deal with these some day, but not yet. row_style = ' class="open"' avail = 'Not resolved' avail_style = '' assert dr.issue not in status_map, "have status for not-ready dr %s" % dr.issue else: row_style = '' avail, avail_style = availability(dr.issue) if not avail.startswith('Sup') and not avail.startswith('Dup'): count[avail] = count.get(avail, 0) + 1 print >> out_file, '''\ %s ''' % (row_style, dr.issue, dr.url, dr.issue, dr.status, dr.title, avail_style, avail) for status, num in count.items(): print "%s: %s" % (status, num) print >> out_file, '''\
Number Status Issue title Available in Clang?
%s %s %s
'''