From e5d5e68eb543fdacc3d81f1603ebcf22ee9c6d04 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 30 May 2014 20:00:49 +0100 Subject: Required IDNA/Unicode properties files and generation. --- utils/idna-derived-props-gen.pl | 96 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 utils/idna-derived-props-gen.pl (limited to 'utils/idna-derived-props-gen.pl') diff --git a/utils/idna-derived-props-gen.pl b/utils/idna-derived-props-gen.pl new file mode 100644 index 000000000..515f62a40 --- /dev/null +++ b/utils/idna-derived-props-gen.pl @@ -0,0 +1,96 @@ +#!/usr/bin/perl +# +# Copyright 2014 Chris Young +# +# This file is part of NetSurf, http://www.netsurf-browser.org/ +# +# NetSurf is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# NetSurf is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +print <; # discard header line + +while($line = ) { + @items = split(/\,/, $line); + @codepoints = split(/-/, $items[0]); + if($#codepoints == 0) { $codepoints[1] = $codepoints[0]; } + print "\t{ 0x" . $codepoints[0] . ", 0x" . $codepoints[1] . ", .p.property = IDNA_P_" . $items[1] . " },\n"; +} + +close(CSVFILE); + +print <) { + chop($line); + if(substr($line, 0, 1) eq '#') {next;} + if(length($line) == 0) {next;} + @items = split(/;/, $line); + @codepoints = split(/\./, $items[0]); + if($#codepoints == 0) { $codepoints[2] = $codepoints[0]; } + print "\t{ 0x" . $codepoints[0] . ", 0x" . $codepoints[2] . ", .p.jt = IDNA_UNICODE_JT_" . substr($items[1], 1, 1) . " },\n"; +} + +close(TXTFILE); + +print <