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 .
22 open ( TOKENS
, $ARGV0 ) || die "can't open token file: $!";
25 while ( defined ($line = <TOKENS
>) )
27 if( !($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]);
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" );
57 foreach( sort(keys(%tokens)) )
60 print( GPERF
"$_,$tokens{$_}\n" );
62 print ( GPERF
"%%\n" );
65 # vim: set noet sw=4 ts=4: