aboutsummaryrefslogtreecommitdiffstats
path: root/libwc/map/mk_ucs_isdigit_map.pl
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:41:45 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:41:45 +0000
commit5397d09e585a1938fb64bc9c5cd5daed1959eb90 (patch)
treecd2673d4ca9584c426f9291e54b7bbb508c11e76 /libwc/map/mk_ucs_isdigit_map.pl
parentAdding upstream version 0.5.2 (diff)
downloadw3m-5397d09e585a1938fb64bc9c5cd5daed1959eb90.tar.gz
w3m-5397d09e585a1938fb64bc9c5cd5daed1959eb90.zip
Adding upstream version 0.5.3upstream/0.5.3
Diffstat (limited to 'libwc/map/mk_ucs_isdigit_map.pl')
-rw-r--r--libwc/map/mk_ucs_isdigit_map.pl56
1 files changed, 56 insertions, 0 deletions
diff --git a/libwc/map/mk_ucs_isdigit_map.pl b/libwc/map/mk_ucs_isdigit_map.pl
new file mode 100644
index 0000000..c67f645
--- /dev/null
+++ b/libwc/map/mk_ucs_isdigit_map.pl
@@ -0,0 +1,56 @@
+
+open(MAP, "> ucs_isdigit.map");
+print MAP <<EOF;
+/*
+ File generated from UnicodeData-4.1.0.txt.
+*/
+
+EOF
+
+for (<DATA>) {
+ chop;
+ ($name, $class) = split;
+
+ @cp = ();
+
+ open(UCD, "< private/UnicodeData-4.1.0.txt");
+ while(<UCD>) {
+ chop;
+ @entry = split(';');
+ last if $entry[0] =~ m/.{5,}/;
+ if ($entry[2] eq $class) {
+ push (@cp, $entry[0]);
+ }
+ }
+ close UCD;
+
+ @bs = ();
+ $last = -1;
+ $seq = -1;
+ for my $e (@cp) {
+ if (++$last != hex $e) {
+ $seq = $e;
+ $last = hex $e;
+ push (@bs, $seq);
+ }
+ $end{$seq} = $e;
+ }
+ $nobs = @bs;
+
+ print MAP <<EOF;
+
+#define N_ucs_${name}_map ${nobs}
+
+static wc_map ucs_${name}_map[ N_ucs_${name}_map ] = {
+EOF
+
+ for (@bs) {
+ print MAP " { 0x$_, 0x$end{$_} },\n";
+ }
+ print MAP <<EOF
+};
+EOF
+}
+
+__END__
+isdigit Nd