#!/usr/bin/perl # Yudit Unicode Editor Source File # # Copyright (C) 2000 Gaspar Sinai # # This program 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; either version 2 of the License, or # (at your option) any later version. # # This program 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, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # This script makes a compressed precompose map. # Compressed means: for a range only the first one will be # encoded. # In order to run the script you need to get # ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt # as and input. # encode composing chars -> precomposed char # decode precomposed char -> composing chars %GeneralCategory = ( "Lu", 1, "Ll", 2, "Lt", 3, "Mn", 4, "Mc", 5, "Me", 6, "Nd", 7, "Nl", 8, "No", 9, "Zs", 10, "Zl", 11, "Zp", 12, "Cc", 13, "Cf", 14, "Cs", 15, "Co", 16, "Cn", 17, # Informative Categories "Lm", 18, "Lo", 19, "Pc", 20, "Pd", 21, "Ps", 22, "Pe", 23, "Pi", 24, "Pf", 25, "Po", 26, "Sm", 27, "Sc", 28, "Sk", 29, "So", 30 ); @encodes = (); @decodes = (); @full_date = localtime(time); $year = $full_date[5] + 1900; $mon = $full_date[4] + 1; $mday = $full_date[3]; $date = sprintf ("%4d-%02d-%02d", $year, $mon, $mday); $name="precompose.my"; die "No version specified." if ($#ARGV == -1); $VERSION=shift; print <) { @_ = split(';', $_); next if ($#_ < 6); $plain = hex $_[0]; $general = $_[2]; if (!defined ($GeneralCategory {$general})) { $general = 0; } else { $general = $GeneralCategory {$general}; } if ($last+1 == $plain && $lastvle == $general) { $last++; next; } # hole if ($last+1 < $plain && $_[1]!~/Last>/) { printf ("%08X -> %02X$/", $last+1, 0); } printf ("%08X -> %02X$/", $plain, $general); $last = $plain; $lastvle = $general; } printf ("%08X -> %02X$/", $last+1, 0); print "$/#END$/";