bump product version to 5.0.4.1
[LibreOffice.git] / solenv / bin / gentoken.pl
blobf742e65c462d82f45010283c2c7d9af68bbb63e5
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 $ARGV0 = shift @ARGV;
20 $ARGV1 = shift @ARGV;
22 open ( TOKENS, $ARGV0 ) || die "can't open token file: $!";
23 my %tokens;
25 while ( defined ($line = <TOKENS>) )
27 if( !($line =~ /^#/) )
29 chomp($line);
30 @token = split(/\s+/,$line);
31 if ( not defined ($token[1]) )
33 $token[1] = "XML_".$token[0];
34 $token[1] =~ tr/\-\.\:/___/;
35 $token[1] =~ s/\+/PLUS/g;
36 $token[1] =~ s/\-/MINUS/g;
39 $tokens{$token[0]} = uc($token[1]);
42 close ( TOKENS );
44 open ( GPERF, ">$ARGV1" ) || die "can't open tokens.gperf file: $!";
46 print ( GPERF "%language=C++\n" );
47 print ( GPERF "%global-table\n" );
48 print ( GPERF "%null-strings\n" );
49 print ( GPERF "%struct-type\n" );
50 print ( GPERF "struct xmltoken\n" );
51 print ( GPERF "{\n" );
52 print ( GPERF " const sal_Char *name; XMLTokenEnum nToken; \n" );
53 print ( GPERF "};\n" );
54 print ( GPERF "%%\n" );
56 $i = 0;
57 foreach( sort(keys(%tokens)) )
59 $i = $i + 1;
60 print( GPERF "$_,$tokens{$_}\n" );
62 print ( GPERF "%%\n" );
63 close ( GPERF );
65 # vim: set noet sw=4 ts=4: