#! /usr/bin/perl -w use strict; use IO::File; my $locale = $ARGV[0]; my $long_name = `/home/weiv/src/icu/source/extra/colprobe/longname $locale`; print "Long name is $long_name\n"; my $pageTitle = $locale." collation"; my $filename = $locale.".html"; open TABLE, ">$filename"; print TABLE <<"EndOfTemplate"; $pageTitle

Collation: $locale ($long_name) Demo, Cover Page, Locale Diffs Index, Collation Diffs Index

EndOfTemplate my $dirCommon = "icucollations"; my $refCommon = $dirCommon."/UCARules.txt"; my $nameCommon = $dirCommon."/".$locale."_collation.html"; my $colorCommon = "#AD989D"; my $loc = $locale; if(!(-e $nameCommon)) { $locale =~ /_/; $loc = $`; $nameCommon = "$dirCommon/$loc"."_collation.html"; } print "Common is $nameCommon\n"; print TABLE " \n"; my $dirLinux = "linuxcollations"; my $refLinux = $dirLinux."/".$locale.".utf8_default_raw.html"; my $rawLinux = $dirLinux."/".$locale.".utf8_raw.html"; my $defLinux = $dirLinux."/".$locale; my $nameLinux = "$dirLinux/$locale"."_collation.html"; my $colorLinux = "#1191F1"; print TABLE " \n"; my $dirWin = "w2kcollations"; my $refWin = $dirWin."/".$locale."_default_raw.html"; my $rawWin = $dirWin."/".$locale."_raw.html"; my $nameWin = "$dirWin/$locale"."_collation.html"; my $colorWin = "#98FB98"; $loc = $locale; #try fallback for windows print TABLE " \n"; print TABLE " \n "; readRules($nameCommon, "#AD989D", "Same as the UCA."); readRules($nameLinux, "#1191F1", "No data available."); readRules($nameWin, "#98FB98", "No data available."); print TABLE <<"EndOfFooter";
COMMON ("; if(-e $nameCommon) { print TABLE "xml "; } print TABLE "UCA)LINUX"; if (!(-e $nameLinux)) { #try the variant that has @euro stuck in $nameLinux = "$dirLinux/$locale".'.utf8@euro_collation.html'; if(-e $nameLinux) { $refLinux = $dirLinux."/".$locale.'.utf8@euro_default_raw.html'; $rawLinux = $dirLinux."/".$locale.'.utf8@euro_raw.html'; } } if (-e $nameLinux) { print TABLE " (xml"; my $linuxBase = &getBaseLocale("$dirLinux/base", $locale); if($linuxBase ne "") { print TABLE " Base ($linuxBase)"; } print TABLE ")"; } print TABLE "WINDOWS"; if(!(-e $nameWin)) { $locale =~ /_/; $loc = $`; $nameWin = "$dirWin/$loc"."_collation.html"; } print "Windows loc is $loc\n"; if (-e $nameWin) { print TABLE " (xml"; my $winBase = &getBaseLocale("$dirWin/base", $locale); if($winBase ne "") { print TABLE "base ($winBase)"; } print TABLE ")"; } print TABLE "
EndOfFooter sub readRules { # readRules($file, $color) my $filename = shift; my $color = shift; my $comment = shift; my $noLines = 0; my $printOut = 0; my $file; if(-e $filename) { open($file, "<$filename") || die "something very strange happened\n"; print TABLE "\n"; while (<$file>) { if (/\}\$/) { $printOut = 0; } if ($printOut) { if(!/^$/ && !/ 
$/) { print TABLE $_; $noLines++; } } if (/Sequence/) { $printOut = 1; print "found sequence\n"; $noLines = 0; } } if (!$noLines) { print TABLE "Same ordering as base\n"; } print TABLE "\n"; } else { print TABLE "\n$comment\n"; } } sub getBaseLocale(){ my $basefile = shift; my $locale = shift; my $baseFH = IO::File->new($basefile,"r") or die "could not open the file $basefile for reading: $! \n"; my $bse; my $loc; while(defined ( my $line = <$baseFH>)){ if( $line =~ /\<$locale\>/){ ($loc,$bse) = split (/\>/, $line); $bse =~ s/^\s+\1.0-alpha # 1.0 # = # &n
#   < ny
#         = nny / ny
#       <<< nY
# # = # 1.2 # Windows XP # = # =