Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 92 lines (76 sloc) 2.29 KB
#!/usr/bin/perl -w
require "PrefixBits.pl";
sub find_prefixes {
my $INQUISITIVE_HE=shift;
my ($mask,$prefix);
my %prefixes;
foreach $W ('','å'){
foreach $S ('','ä','ù'){
foreach $K ('','ëù','îù','ìëù'){
foreach $k ('','ë'){
foreach $B ('','á','ä','ë','ì','î','îä'){
next if (!$INQUISITIVE_HE && $S eq 'ä');
next if ($k eq 'ë' && $B eq 'ä');
$prefix = "$W$S$K$k$B";
$mask = $PS_MISC;
$mask |= $PS_L if $B =~ m/[áëìî]$/;
$mask |= $PS_B if $prefix =~ m/^å?ù?á$/;
$mask |= $PS_VERB if ($k eq "" && $B eq "");
$mask |= $PS_NONDEF if $B !~ m/ä$/;
$prefixes{$prefix} = 0 if !defined $prefixes{$prefix};
$prefixes{$prefix} |= $mask;
}
}
}
}
}
foreach $W ('','å'){
foreach $S ('','ä','ù'){
foreach $K ('','ëù','îù','ìëù'){
foreach $B ('','á','ì','î'){
foreach $k ('','ë'){
next if (!$INQUISITIVE_HE && $S eq 'ä');
$prefix = "$W$S$K$B$k";
$mask = $PS_MISC;
$mask |= $PS_L if $B =~ m/[áëìî]$/;
$mask |= $PS_B if $prefix =~ m/^å?ù?á$/;
$mask |= $PS_VERB if ($k eq "" && $B eq "");
$mask |= $PS_NONDEF if $B !~ m/ä$/;
$prefixes{$prefix} = 0 if !defined $prefixes{$prefix};
$prefixes{$prefix} |= $mask;
}
}
}
}
}
foreach $B ('á','ì'){
$prefix = "î$B";
$mask = $PS_MISC;
$mask |= $PS_L if $B =~ m/[áëìî]$/;
$mask |= $PS_B if $prefix =~ m/^å?ù?á$/;
$mask |= $PS_NONDEF if $B !~ m/ä$/;
$prefixes{$prefix} = 0 if !defined $prefixes{$prefix};
$prefixes{$prefix} |= $mask;
}
$prefixes{""} |= $PS_IMPER;
$prefixes{"å"} |= $PS_IMPER;
return %prefixes;
}
print "/* This file is automatically generated by genprefixes.pl.\n";
print " DO NOT EDIT THIS FILE DIRECTLY!\n */\n\n";
# Prefix list without He Ha-She'ela (but with He Ha-Yedi`a, of course)
my %prefixes = find_prefixes(0);
print "static char *prefixes_noH[]={";
foreach (sort keys %prefixes) {print "\"$_\",\n"}
print "0};\n";
print "static int masks_noH[]={";
foreach (sort keys %prefixes) {print "$prefixes{$_},\n"}
print "-1};\n";
# Output the same thing, but with He Ha-She'ela...
%prefixes = find_prefixes(1);
print "static char *prefixes_H[]={";
foreach (sort keys %prefixes) {print "\"$_\",\n"}
print "0};\n";
print "static int masks_H[]={";
foreach (sort keys %prefixes) {print "$prefixes{$_},\n"}
print "-1};\n";