Windows2003-3790/inetcore/mshtml/tools/unicodedirection_verify.pl
2020-09-30 16:53:55 +02:00

45 lines
868 B
Raku

#
# dirclass_verify.pl
#
# mikejoch@microsoft.com
# 31 Jul 1998
#
# Checks the validity of the directional classifications file generated by
# dirclass_extract.pl.
#
%dirlist = ();
$last = -1;
while (<>)
{
/^([0-9a-fA-F]{4}) (\w\w\w)/;
$char = hex($1);
$dir = $2;
if ($char != $last + 1)
{
$error = sprintf("List out of order at character %d\n", $char);
die($error);
}
if (!($dir =~ /^(UNK|LTR|RTL|ARA|WSP|NEU|SEG|BLK|ANM|ENM|ETM|ESP|CSP|FMT|CBN)$/))
{
$error = sprintf("Unknown classification '%s' for character %d\n", $dir, $char);
die($error);
}
$dirlist{$dir}++;
$last++;
}
$cchTotal = 0;
while (($dir, $cch) = each(%dirlist))
{
printf("%s\t%s\n", $dir, $cch);
$cchTotal += $cch;
}
printf("\n%d total characters\n", $cchTotal);