diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2011-11-29 15:40:51 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2011-11-29 21:20:24 +0100 |
commit | e9ed9d4d4548751b50d45b7082f776d6e69204e3 (patch) | |
tree | bc4fcb6eb9c8ca73615934ba90e18040361fbd7d /oox | |
parent | 86927dd6e88fae25e55748cb3a475518351b8dd7 (diff) |
do no re-sort oox tokens
Search me why writerfilter rolls its own, but otherwise they use
different ids, because writerfilter does not sort them.
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/token/tokens.pl | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/oox/source/token/tokens.pl b/oox/source/token/tokens.pl index a951cee80db2..7aefd28f21c0 100644 --- a/oox/source/token/tokens.pl +++ b/oox/source/token/tokens.pl @@ -30,25 +30,6 @@ $ARGV1 = shift @ARGV; $ARGV2 = shift @ARGV; $ARGV3 = shift @ARGV; -open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!"; -my %tokens; -while ( <INFILE> ) -{ - # trim newline - chomp( $_ ); - # trim leading/trailing whitespace - $_ =~ s/^\s*//g; - $_ =~ s/\s*$//g; - # check for valid characters - $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid character in token '$_'"; - $id = "XML_$_"; - $id =~ s/-/_/g; - $tokens{$_} = $id; -} -close ( INFILE ); - -# generate output files - open ( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!"; open ( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!"; open ( GPERFFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!"; @@ -63,14 +44,27 @@ print( GPERFFILE " sal_Int32 nToken;\n" ); print( GPERFFILE "};\n" ); print( GPERFFILE "%%\n" ); +open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!"; + $i = 0; -foreach( sort( keys( %tokens ) ) ) +while ( <INFILE> ) { - print( IDFILE "const sal_Int32 $tokens{$_} = $i;\n" ); + # trim newline + chomp( $_ ); + # trim leading/trailing whitespace + $_ =~ s/^\s*//g; + $_ =~ s/\s*$//g; + # check for valid characters + $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid character in token '$_'"; + $id = "XML_$_"; + $id =~ s/-/_/g; + $tokens{$_} = $id; + print( IDFILE "const sal_Int32 $id = $i;\n" ); print( NAMEFILE "\"$_\",\n" ); - print( GPERFFILE "$_,$tokens{$_}\n" ); + print( GPERFFILE "$_,$id\n" ); ++$i; } +close ( INFILE ); print( IDFILE "const sal_Int32 XML_TOKEN_COUNT = $i;\n" ); print( GPERFFILE "%%\n" ); |