all: unicode-char.inc.pl unicode-cover.inc.pl countries.inc.pl
+data/DerivedAge.txt:
+ wget http://www.unicode.org/Public/UNIDATA/DerivedAge.txt -O $@
+
+unicode-age.inc.pl: data/DerivedAge.txt
+ tools/mkcharver data/DerivedAge.txt >$@
+
data/rfc1345.txt:
wget http://www.ietf.org/rfc/rfc1345.txt -O $@
clean:
-rm digraphs.inc.pl
-rm unicode-char.inc.pl
+ -rm unicode-age.inc.pl
-rm -rf ttfsupport/
-rm unicode-cover.inc.pl
--- /dev/null
+#!/usr/bin/env perl
+use 5.012;
+use warnings;
+use utf8;
+
+our $VERSION = '1.00';
+
+say '# automatically generated by tools/mkcharver';
+say '+{';
+
+while (my $line = readline) {
+ $line =~ m{
+ \A (?<start> [0-9A-F]+)
+ (?: \.\. (?<end> [0-9A-F]+) )?
+ \h+ ; \h+ (?<major> [0-9]+) \. (?<minor> [0-9])
+ }x or next;
+
+ my $start = hex $+{start};
+ my $end = defined $+{end} ? hex $+{end} : $start;
+ my $version = $+{major} . $+{minor};
+ say "(map {\$_ => $version} $start .. $end),";
+}
+
+say '}';
+
+__END__
+
+=head1 NAME
+
+mkcharver - Create Perl include of Unicode character versions
+
+=head1 SYNOPSIS
+
+ mkcharver DerivedAge.txt >unicode-age.inc.pl
+
+=head1 AUTHOR
+
+Mischa POSLAWSKY <perl@shiar.org>
+
+=head1 LICENSE
+
+Licensed under the GNU Affero General Public License version 3.
+