ICU-1948 fix alias handling in the perl file

X-SVN-Rev: 9110
This commit is contained in:
Ram Viswanadha 2002-07-12 05:18:15 +00:00
parent 2d0512330f
commit 525f969f4c
2 changed files with 14 additions and 13 deletions

View File

@ -99,7 +99,7 @@ foreach my $loc (sort keys %aliases) {
my $aliasee = $aliases{$loc}; my $aliasee = $aliases{$loc};
if (!exists($patched{$alias})) { if (!exists($patched{$alias})) {
# Patch the alias # Patch the alias
patchAliasee($aliasee); #patchAliasee($aliasee);
$patched{$aliasee} = 1; $patched{$aliasee} = 1;
} }
patchAlias($loc, $aliasee); patchAlias($loc, $aliasee);
@ -182,10 +182,10 @@ sub patchAliasee {
open(IN, $file) or die; open(IN, $file) or die;
open(OUT, ">$file.new") or die; open(OUT, ">$file.new") or die;
while (<IN>) { while (<IN>) {
# if (/^\s*contents\s*=\s*new\s+Object/) { #if (/^\s*data\s*=\s*new\s+Object/) {
# print OUT " contents = _contents;\n"; # print OUT " super.contents = data;\n";
# print OUT " };\n"; # print OUT " };\n";
# print OUT ' static final Object[][] _contents =', "\n"; # print OUT ' static final Object[][] data =', "\n";
# s/^\s*contents\s*=\s*/ /; # s/^\s*contents\s*=\s*/ /;
# print OUT; # print OUT;
# } elsif (/^\s*\}\s*;/) { # } elsif (/^\s*\}\s*;/) {
@ -214,16 +214,17 @@ sub patchAlias {
my $file = "LocaleElements_$loc.java"; my $file = "LocaleElements_$loc.java";
open(IN, $file) or die; open(IN, $file) or die;
open(OUT, ">$file.new") or die; open(OUT, ">$file.new") or die;
my $var = "static final Object";
while (<IN>) { while (<IN>) {
if (/^\s*contents\s*=\s*new\s+Object/) { if(/$var/){
# Consume the next 5 lines
<IN>;
<IN>;
<IN>;
<IN>;
<IN>;
# Output our new data # Output our new data
print OUT " contents = LocaleElements_$aliasee._contents;\n"; print OUT " static final Object[][] data = LocaleElements_$aliasee.data;\n";
#consume the next 3 lines
<IN>;
<IN>;
<IN>;
<IN>;
<IN>;
} else { } else {
print OUT; print OUT;
} }

View File

@ -78,7 +78,7 @@ static const char* javaClassICU= " extends ICUListResourceBundle {\n\n"
" public %s () {\n" " public %s () {\n"
" super.contents = data;\n" " super.contents = data;\n"
" }\n" " }\n"
" private static Object[][] data = new Object[][] { \n"; " static final Object[][] data = new Object[][] { \n";
static int tabCount = 3; static int tabCount = 3;
static FileStream* out=NULL; static FileStream* out=NULL;