Ok for trunk? -- >8 -- I use this script to keep <https://gcc.gnu.org/projects/cxx-dr-status.html> up-to-date. I thought it might be good to have it in contrib/, so I've polished it a little bit.
contrib/ChangeLog: * cxx-dr-table.sh: New file. --- contrib/cxx-dr-table.sh | 108 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100755 contrib/cxx-dr-table.sh diff --git a/contrib/cxx-dr-table.sh b/contrib/cxx-dr-table.sh new file mode 100755 index 00000000000..9d67d176cad --- /dev/null +++ b/contrib/cxx-dr-table.sh @@ -0,0 +1,108 @@ +#!/bin/bash +# Script to check/update <https://gcc.gnu.org/projects/cxx-dr-status.html> +# from <https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_toc.html>. +# Use --generate only to add new DRs; don't use it to update the existing +# ones because it would rewrite the Notes column. +# Use --check to check if the existing entries need to be updated. +# May need $ iconv -f iso-8859-1 -t utf-8 cwg_toc.html > cwg_toc2.html + +# Written by Marek Polacek <pola...@redhat.com> + +AWK=/usr/bin/awk +DIFF=/usr/bin/vimdiff +SED=/usr/bin/sed + +usage() +{ + echo "Usage: $0 --check cwg_toc.html ~/src/gcc-wwwdocs/htdocs/projects/cxx-dr-status.html" + echo " or: $0 --generate cwg_toc.html" +} + +fatal_usage() +{ + usage >&2 + exit 1 +} + +# Generate new DR entries. +do_generate() { + $AWK '/A NAME=/{ + # <A NAME="2838"></A><A HREF="cwg_active.html#2838">2838</A> + num = gensub(/(<.+>)(<.+>)(<.+>)(.+)(<.+>)/, "\\4", "g", $0) + getline + # Eat </TD> + getline + # Eat <TD ALIGN="LEFT">6.7.6</TD> + getline + # <TD ALIGN="CENTER">open</TD> + status = gensub(/(<.+>)(.+)(<.+>)/, "\\2", "g", $0) + getline + # Eat <TD ALIGN="LEFT"><issue_title> + getline + title = $0 + + # Generate the HTML fragment. + if (status == "open" || status == "drafting") { + print " <tr class=\"open\">" + } else { + print " <tr>" + } + print " <td><a href=\"https://wg21.link/cwg" num "\">" num "</a></td>" + print " <td>" status "</td>" + print " <td>" title "</td>" + if (status == "open" || status == "drafting") { + print " <td>-</td>" + } else { + print " <td class=\"unsupported\">?</td>" + } + print " <td></td>" + print " </tr>" + }' $1 +} + +# Check existing DR entries against the ISO version. +do_check() { + # Generate a table from the upstream table: DR# + status + summary + # First, fix the quotes. + $SED -i $1 -e 's/\(“\|”\)/"/g' + $AWK '/A NAME=/{ print; getline; getline; getline; print; getline; getline; print }' $1 | \ + $AWK -v RS='<[^>]+>' -v ORS= '1' | iconv -f UTF-8 -t ASCII//TRANSLIT > $tmp1 + + # Generate a table from our table: DR# + status + summary + $AWK '/wg21.link.cwg/{ print; getline; print; getline; print }' $2 | \ + $AWK -v RS='<[^>]+>' -v ORS= '1' > $tmp2 + $SED -i $tmp2 -e 's/^[ \t]*//' + + # Compare the tables. + $DIFF $tmp1 $tmp2 +} + +if [ $# -lt 2 ]; then + fatal_usage +fi + +tmp1="$(mktemp)" +tmp2="$(mktemp)" + +cleanup() { + rm -f -- "$tmp1" "$tmp2" +} + +trap cleanup 0 + +case "$1" in + -c | --check) + if [ $# -lt 3 ]; then + fatal_usage + fi + do_check "$2" "$3" + ;; + -g | --generate) + do_generate "$2" + ;; + *) + fatal_usage + ;; +esac + +exit base-commit: d1a21a6f9474e519926d20a7c6d664be03aff3ee -- 2.44.0