#!/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 <